def modify_ioclass(self, name, new_name=None, iotype=None, lun_ids=None, smp_names=None, ctrlmethod=None, minsize=None, maxsize=None): cmd = ['nqm', '-ioclass', '-modify', '-name', name] cmd += text_var('-newname', new_name) cmd += text_var('-iotype', iotype) cmd += int_var('-minsize', minsize) cmd += int_var('-maxsize', maxsize) # Currently we do not support reset to anyio # if anyio is True: # cmd += text_var('-anyio') cmd += list_var('-luns', lun_ids) cmd += list_var('-snapshots', smp_names) # Currently we do not support clear all luns # if (lun_ids and len(lun_ids) == 0) # and (smp_names and len(smp_names) == 0): # cmd += ['-nolun'] cmd += VNXCtrlMethod.parse_cmd(ctrlmethod) cmd.append('-o') return cmd
def test_list_var(self): assert_that(list_var('-a', []), equal_to([])) assert_that(list_var('-a', None), equal_to([])) assert_that(list_var('-a', ['b', 'c']), equal_to(['-a', 'b', 'c'])) def _inner(): list_var('-a', 'asf') assert_that(_inner, raises(ValueError))
def create_ioclass(self, name, iotype='rw', lun_ids=None, smp_names=None, ctrlmethod=VNXCtrlMethod.NO_CTRL, minsize=None, maxsize=None): cmd = ['nqm', '-ioclass', '-create', '-name', name, '-iotype', iotype] cmd += int_var('-minsize', minsize) cmd += int_var('-maxsize', maxsize) cmd += list_var('-luns', lun_ids) cmd += list_var('-snapshots', smp_names) cmd += VNXCtrlMethod.parse_cmd(ctrlmethod) return cmd
def create_policy(self, name, ioclasses=None, fail_action=None, time_limit=None, eval_window=None): cmd = ['nqm', '-policy', '-create', '-name', name] cmd += list_var('-ioclasses', ioclasses) cmd += text_var('-failaction', fail_action) cmd += int_var('-timelimit', time_limit) cmd += int_var('-evalwindow', eval_window) return cmd
def modify_policy(self, name, new_name=None, new_ioclasses=None, time_limit=None, fail_action=None, eval_window=None): cmd = ['nqm', '-policy', '-modify', '-name', name] cmd += text_var('-newname', new_name) # This will clear all existing ioclasses if new_ioclasses is not None and len(new_ioclasses) == 0: cmd.append('-noclass') else: cmd += list_var('-ioclasses', new_ioclasses) cmd += text_var('-failaction', fail_action) cmd += int_var('-timelimit', time_limit) cmd += int_var('-evalwindow', eval_window) return cmd
def _inner(): list_var('-a', 'asf')