Does it make sense to have both port and uuid defined in the fence_vmware_soap stanza in cluster.conf?

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 6
  • fence-agents
  • Red Hat cluster running in VMware virtualization environment

Issue

Does it make sense to have both port and uuid defined in the fence_vmware_soap stanza in cluster.conf?
If both port and uuid are set, does any of them have preference? i.e. if uuid is defined, is the port still checked?

Resolution

The parameters are described in manual page of fence_vmware_soap :

  • port - Physical plug number or name of virtual machine This parameter is always required.
  • uuid - The UUID of the virtual machine to fence.
  • -n, --plug= - Physical plug number or name of virtual machine This parameter is always required.

    The code of fence-agents:

The parameters passed by cluster.conf are defined in fence/agents/vmware_soap/fence_vmware_soap.py:

def main():
        global options_global
        global conn_global
        device_opt = ["ipaddr", "login", "passwd", "web", "ssl", "notls", "port", "uuid"]

        atexit.register(atexit_handler)
        atexit.register(logout)

        options_global = check_input(device_opt, process_input(device_opt))

The function check_input takes care of validation of parameters passed. This function is imported from script fencing.py.py. Parameters which can be passed to this script are:

 all_opt = {

<snip>
.
.
        "port" : {
                "getopt" : "n:",
                "longopt" : "plug",
                "help" : "-n, --plug=[id]                Physical plug number on device, UUID or\n" +
        "                                        identification of machine",
                "required" : "1",                                                   
                "shortdesc" : "Physical plug number, name of virtual machine or UUID",
                "order" : 1},
.
.
.

        "uuid" : {
                "getopt" : "U:",
                "longopt" : "uuid",
                "help" : "-U, --uuid                     UUID of the VM to fence",
                "required" : "0",
                "shortdesc" : "The UUID of the virtual machine to fence.",
                "order" : 1},

</snip>

The port parameter is required by the script, parameter UUID is optional. If UUID is not specified in cluster.conf the function check_input will get the UUID on its own based on port/plug:

        # UUID is now only alias for --plug; because we can detect it automatically
        if options.has_key("--uuid"):
                options["--plug"] = options["--uuid"]
                del options["--uuid"]

        _validate_input(options)

        ## automatic detection and set of valid UUID from --plug
        try:
                options["--uuid"] = str(uuid.UUID(options["--plug"]))

Root Cause

The UUID is expected to be configured when you have VMs with same name running on different hypervisors managed by same manager (vCenter). In such a case the UUID should be used (either in combination with port/plug or just UUID - the script will figure out the plug based on UUID).

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.