Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 893b4547bb5f5eb61d2f3af4281e5a38 > files > 1

cman-2.0.115-96.el5_8.1.src.rpm

From 6ac811961ec028e30cd094bb2a10f6f3e996692d Mon Sep 17 00:00:00 2001
From: Marek 'marx' Grac <mgrac@redhat.com>
Date: Mon, 4 Apr 2011 18:19:40 +0200
Subject: [PATCH 3/4] library: Add support for UUID (-U / --uuid / uuid)

Fence agents can use --uuid as a replacement for --port. This is very
useful in a case of virtual machines that have both UUID and name.

Patch proposed by Matt Clark
---
 fence/agents/lib/fencing.py.py |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 933fd75..61c23af 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -390,7 +390,14 @@ all_opt = {
 		"default" : "1",
 		"required" : "0",
 		"shortdesc" : "Count of attempts to retry power on",
-		"order" : 200 }
+		"order" : 201 },
+	"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 }
 }
 
 common_opt = [ "retry_on", "delay" ]
@@ -691,7 +698,7 @@ def check_input(device_opt, opt):
 		if 0 == os.path.isfile(options["-k"]):
 			fail_usage("Failed: Identity file " + options["-k"] + " does not exist")
 
-	if (0 == ["list", "monitor"].count(options["-o"].lower())) and (0 == options.has_key("-n")) and (device_opt.count("port")):
+	if (0 == ["list", "monitor"].count(options["-o"].lower())) and (0 == options.has_key("-n") and 0 == options.has_key("-U")) and (device_opt.count("port")):
 		fail_usage("Failed: You have to enter plug number")
 
 	if options.has_key("-S"):
@@ -757,7 +764,7 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None
 	
 	## Process options that manipulate fencing device
 	#####
-	if (options["-o"] == "list") and (0 == options["device_opt"].count("port")) and (0 == options["device_opt"].count("partition")):
+	if (options["-o"] == "list") and (0 == options["device_opt"].count("port")) and (0 == options["device_opt"].count("partition") and 0 == options["device_opt"].count("uuid")):
 		print "N/A"
 		return
 	elif (options["-o"] == "list" and get_outlet_list == None):
-- 
1.7.4