diff --git a/fencing/fence_false b/fencing/fence_false index e4d02d506b..d85c008b3a 100644 --- a/fencing/fence_false +++ b/fencing/fence_false @@ -1,70 +1,70 @@ #!/usr/bin/python # The Following Agent Has Been Tested On: # # Virsh 0.3.3 on RHEL 5.2 with xen-3.0.3-51 # import sys, time sys.path.append("/usr/share/fence") from fencing import * #BEGIN_VERSION_GENERATION RELEASE_VERSION="3.1.6" BUILD_DATE="(built Mon Oct 24 12:14:08 UTC 2011)" REDHAT_COPYRIGHT="Copyright (C) Red Hat, Inc. 2004-2010 All rights reserved." #END_VERSION_GENERATION plug_status="on" def get_outlets_status(conn, options): result={} port=options["-n"] result[port]=[plug_status, "fake"] return result def get_power_status(conn, options): outlets=get_outlets_status(conn,options) if (not (options["-n"] in outlets)): fail_usage("Failed: You have to enter existing machine!") else: return outlets[options["-n"]][0] def set_power_status(conn, options): global plug_status plug_status = "unknown" # Sleep for power_wait before returning if options.has_key("-G"): time.sleep(int(options["-G"])) def main(): device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug", "action", "port", - "no_password", "power_wait", "power_timeout" ] + "no_password", "power_wait", "power_timeout", "nodename" ] atexit.register(atexit_handler) pinput = process_input(device_opt) # Fake options to keep the library happy #pinput["-p"] = "none" pinput["-a"] = "localhost" pinput["-C"] = "," options = check_input(device_opt, pinput) if options["-o"] == "monitor": sys.exit(0) ## Defaults for fence agent docs = { } docs["shortdesc"] = "Fake failed fence agent" docs["longdesc"] = "fence_false is a fake Fencing agent which always reports failure without doing anything." show_docs(options, docs) ## Operate the fencing device result = fence_action(None, options, set_power_status, get_power_status, get_outlets_status) sys.exit(result) if __name__ == "__main__": main() diff --git a/fencing/fence_true b/fencing/fence_true index 3b0310bcfd..146e93ba18 100644 --- a/fencing/fence_true +++ b/fencing/fence_true @@ -1,75 +1,75 @@ #!/usr/bin/python # The Following Agent Has Been Tested On: # # Virsh 0.3.3 on RHEL 5.2 with xen-3.0.3-51 # import sys, time sys.path.append("/usr/share/fence") from fencing import * #BEGIN_VERSION_GENERATION RELEASE_VERSION="3.1.6" BUILD_DATE="(built Mon Oct 24 12:14:08 UTC 2011)" REDHAT_COPYRIGHT="Copyright (C) Red Hat, Inc. 2004-2010 All rights reserved." #END_VERSION_GENERATION plug_status="on" def get_outlets_status(conn, options): result={} if (not (options["-n"])): fail_usage("Failed: You have to enter existing machine!") else: port=options["-n"] result[port]=[plug_status, "fake"] return result def get_power_status(conn, options): outlets=get_outlets_status(conn,options) if (not (options["-n"] in outlets)): fail_usage("Failed: You have to enter existing machine!") else: return outlets[options["-n"]][0] def set_power_status(conn, options): global plug_status plug_status = "off" # Sleep for power_wait seconds before returning if options.has_key("-G"): time.sleep(int(options["-G"])) def main(): device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug", "action", "port", - "no_password", "power_wait", "power_timeout" ] + "no_password", "power_wait", "power_timeout", "nodename" ] atexit.register(atexit_handler) pinput = process_input(device_opt) # Fake options to keep the library happy #pinput["-p"] = "none" pinput["-a"] = "localhost" pinput["-C"] = "," options = check_input(device_opt, pinput) if options["-o"] == "monitor": sys.exit(0) ## Defaults for fence agent docs = { } docs["shortdesc"] = "Fake fence agent" docs["longdesc"] = "fence_true is a fake Fencing agent which always reports success without doing anything." show_docs(options, docs) ## Operate the fencing device result = fence_action(None, options, set_power_status, get_power_status, get_outlets_status) sys.exit(result) if __name__ == "__main__": main()