def stonith_cmd(argv): if len(argv) == 0: argv = ["show"] sub_cmd = argv.pop(0) if (sub_cmd == "help"): usage.stonith(argv) elif (sub_cmd == "list"): stonith_list_available(argv) elif (sub_cmd == "describe"): if len(argv) == 1: stonith_list_options(argv[0]) else: usage.stonith() sys.exit(1) elif (sub_cmd == "create"): if len(argv) < 2: usage.stonith() sys.exit(1) stn_id = argv.pop(0) stn_type = "stonith:"+argv.pop(0) st_values, op_values, meta_values = resource.parse_resource_options( argv, with_clone=False ) resource.resource_create(stn_id, stn_type, st_values, op_values, meta_values) elif (sub_cmd == "update"): stn_id = argv.pop(0) resource.resource_update(stn_id,argv) elif (sub_cmd == "delete"): if len(argv) == 1: stn_id = argv.pop(0) utils.replace_cib_configuration( stonith_level_rm_device(utils.get_cib_dom(), stn_id) ) resource.resource_remove(stn_id) else: usage.stonith(["delete"]) sys.exit(1) elif (sub_cmd == "show"): resource.resource_show(argv, True) stonith_level([]) elif (sub_cmd == "level"): stonith_level(argv) elif (sub_cmd == "fence"): stonith_fence(argv) elif (sub_cmd == "cleanup"): if len(argv) == 0: resource.resource_cleanup_all() else: res_id = argv.pop(0) resource.resource_cleanup(res_id) elif (sub_cmd == "confirm"): stonith_confirm(argv) else: usage.stonith() sys.exit(1)
def stonith_cmd(argv): if len(argv) == 0: argv = ["show"] sub_cmd = argv.pop(0) if (sub_cmd == "help"): usage.stonith(argv) elif (sub_cmd == "list"): stonith_list_available(argv) elif (sub_cmd == "describe"): if len(argv) == 1: stonith_list_options(argv[0]) else: usage.stonith() sys.exit(1) elif (sub_cmd == "create"): if len(argv) < 2: usage.stonith() sys.exit(1) stn_id = argv.pop(0) stn_type = "stonith:" + argv.pop(0) st_values, op_values, meta_values = resource.parse_resource_options( argv, with_clone=False) resource.resource_create(stn_id, stn_type, st_values, op_values, meta_values) elif (sub_cmd == "update"): stn_id = argv.pop(0) resource.resource_update(stn_id, argv) elif (sub_cmd == "delete"): if len(argv) == 1: stn_id = argv.pop(0) utils.replace_cib_configuration( stonith_level_rm_device(utils.get_cib_dom(), stn_id)) resource.resource_remove(stn_id) else: usage.stonith(["delete"]) sys.exit(1) elif (sub_cmd == "show"): resource.resource_show(argv, True) stonith_level([]) elif (sub_cmd == "level"): stonith_level(argv) elif (sub_cmd == "fence"): stonith_fence(argv) elif (sub_cmd == "cleanup"): if len(argv) == 0: resource.resource_cleanup_all() else: res_id = argv.pop(0) resource.resource_cleanup(res_id) elif (sub_cmd == "confirm"): stonith_confirm(argv) else: usage.stonith() sys.exit(1)
def stonith_cmd(argv): if len(argv) == 0: argv = ["show"] sub_cmd = argv.pop(0) if (sub_cmd == "help"): usage.stonith(argv) elif (sub_cmd == "list"): stonith_list_available(argv) elif (sub_cmd == "describe"): if len(argv) == 1: stonith_list_options(argv[0]) else: usage.stonith() sys.exit(1) elif (sub_cmd == "create"): stonith_create(argv) elif (sub_cmd == "update"): if len(argv) > 1: stn_id = argv.pop(0) resource.resource_update(stn_id,argv) else: usage.stonith(["update"]) sys.exit(1) elif (sub_cmd == "delete"): if len(argv) == 1: stn_id = argv.pop(0) resource.resource_remove(stn_id) else: usage.stonith(["delete"]) sys.exit(1) elif (sub_cmd == "show"): resource.resource_show(argv, True) stonith_level([]) elif (sub_cmd == "level"): stonith_level(argv) elif (sub_cmd == "fence"): stonith_fence(argv) elif (sub_cmd == "cleanup"): if len(argv) == 0: resource.resource_cleanup_all() else: res_id = argv.pop(0) resource.resource_cleanup(res_id) elif (sub_cmd == "confirm"): stonith_confirm(argv) else: usage.stonith() sys.exit(1)