X-Git-Url: https://code.grnet.gr/git/ganeti-local/blobdiff_plain/c950e9f2f23c5533db29d9e6c31359a04564ce40..b44bd844c54573e7801fc1ef6b4f8007f193555d:/scripts/gnt-os diff --git a/scripts/gnt-os b/scripts/gnt-os index 6c419bd..f74213a 100755 --- a/scripts/gnt-os +++ b/scripts/gnt-os @@ -44,8 +44,7 @@ def ListOS(opts, args): @return: the desired exit code """ - op = opcodes.OpDiagnoseOS(output_fields=["name", "valid", "variants"], - names=[]) + op = opcodes.OpDiagnoseOS(output_fields=["name", "variants"], names=[]) result = SubmitOpCode(op, opts=opts) if not result: @@ -58,9 +57,8 @@ def ListOS(opts, args): headers = None os_names = [] - for (name, valid, variants) in result: - if valid: - os_names.extend([[n] for n in CalculateOSNames(name, variants)]) + for (name, variants) in result: + os_names.extend([[n] for n in CalculateOSNames(name, variants)]) data = GenerateTable(separator=None, headers=headers, fields=["name"], data=os_names, units=None) @@ -252,19 +250,31 @@ def ModifyOS(opts, args): else: osp = None - if not (os_hvp or osp): + if opts.hidden is not None: + if opts.hidden: + ohid = [(constants.DDM_ADD, os)] + else: + ohid = [(constants.DDM_REMOVE, os)] + else: + ohid = None + + if opts.blacklisted is not None: + if opts.blacklisted: + oblk = [(constants.DDM_ADD, os)] + else: + oblk = [(constants.DDM_REMOVE, os)] + else: + oblk = None + + if not (os_hvp or osp or ohid or oblk): ToStderr("At least one of OS parameters or hypervisor parameters" " must be passed") return 1 - op = opcodes.OpSetClusterParams(vg_name=None, - enabled_hypervisors=None, - hvparams=None, - beparams=None, - nicparams=None, - candidate_pool_size=None, - os_hvp=os_hvp, - osparams=osp) + op = opcodes.OpSetClusterParams(os_hvp=os_hvp, + osparams=osp, + hidden_os=ohid, + blacklisted_os=oblk) SubmitOpCode(op, opts=opts) return 0 @@ -272,16 +282,20 @@ def ModifyOS(opts, args): commands = { 'list': ( - ListOS, ARGS_NONE, [NOHDR_OPT], "", "Lists all valid operating systems" - " on the cluster"), + ListOS, ARGS_NONE, [NOHDR_OPT, PRIORITY_OPT], + "", "Lists all valid operating systems on the cluster"), 'diagnose': ( - DiagnoseOS, ARGS_NONE, [], "", "Diagnose all operating systems"), + DiagnoseOS, ARGS_NONE, [PRIORITY_OPT], + "", "Diagnose all operating systems"), 'info': ( - ShowOSInfo, [ArgOs()], [], "", "Show detailed information about " + ShowOSInfo, [ArgOs()], [PRIORITY_OPT], + "", "Show detailed information about " "operating systems"), 'modify': ( - ModifyOS, ARGS_ONE_OS, [HVLIST_OPT, OSPARAMS_OPT, DRY_RUN_OPT], "", - "Modify the OS parameters"), + ModifyOS, ARGS_ONE_OS, + [HVLIST_OPT, OSPARAMS_OPT, DRY_RUN_OPT, PRIORITY_OPT, + HID_OS_OPT, BLK_OS_OPT], + "", "Modify the OS parameters"), } if __name__ == '__main__':