fence-agents: master - bugfix uuid
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: bf66212512ad7f97b38fcb49fc256ac76583afbd
Parent: ab223883b3d79ef46c91c23fb32ba93c72b49762
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Apr 4 15:37:03 2011 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Apr 4 15:37:03 2011 +0200
bugfix uuid
---
fence/agents/lib/fencing.py.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index ef55759..da5b07e 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -767,7 +767,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):
13 years, 1 month
fence-agents: master - library: Add support for URL session instead of hostname
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: ab223883b3d79ef46c91c23fb32ba93c72b49762
Parent: 8a97abd04b8492310c1095413c5cf26bbf98e395
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Apr 4 15:32:03 2011 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Apr 4 15:32:03 2011 +0200
library: Add support for URL session instead of hostname
Fence agent can choose if they prefer to set address to fencing device
as hostname/ip address or URL.
---
fence/agents/lib/fencing.py.py | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 32b5d2b..ef55759 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -387,6 +387,13 @@ all_opt = {
"required" : "0",
"shortdesc" : "Count of attempts to retry power on",
"order" : 201 },
+ "session_url" : {
+ "getopt" : "s:",
+ "longopt" : "session-url",
+ "help" : "-s, --session-url URL to connect to XenServer on.",
+ "required" : "1",
+ "shortdesc" : "The URL of the XenServer host.",
+ "order" : 1},
"uuid" : {
"getopt" : "U:",
"longopt" : "uuid",
@@ -676,7 +683,7 @@ def check_input(device_opt, opt):
if (0 == options.has_key("-l")) and device_opt.count("login") and (device_opt.count("no_login") == 0):
fail_usage("Failed: You have to set login name")
- if 0 == options.has_key("-a"):
+ if 0 == options.has_key("-a") and 0 == options.has_key("-s"):
fail_usage("Failed: You have to enter fence address")
if (device_opt.count("no_password") == 0):
13 years, 1 month
fence-agents: master - fence_ipmilan: Correct return code for diag operation
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: 8a97abd04b8492310c1095413c5cf26bbf98e395
Parent: f31f957471dea5d955758db98226a727405248d7
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Apr 4 15:19:57 2011 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Apr 4 15:19:57 2011 +0200
fence_ipmilan: Correct return code for diag operation
Return code for diag operation should be 0.
Resolves: rhbz#655764
---
fence/agents/ipmilan/ipmilan.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/fence/agents/ipmilan/ipmilan.c b/fence/agents/ipmilan/ipmilan.c
index 040babf..177d216 100644
--- a/fence/agents/ipmilan/ipmilan.c
+++ b/fence/agents/ipmilan/ipmilan.c
@@ -1195,6 +1195,15 @@ metaout:
if (!strcasecmp(op, "monitor"))
translated_ret = ret;
+
+ if (!strcasecmp(op, "diaf")) {
+ /** .. but when a system receive the DIAG signal , it
+ ** switches to a kdump kernel, but the machine is always
+ ** "on" during the dump phase. It only become temporarily
+ ** "off" at the end of the dump just before rebooting.
+ **/
+ translated_ret = 0;
+ }
return translated_ret;
}
13 years, 1 month
fence-agents: master - fence_ipmilan: returns incorrect status on monitor op if chassis is powered off
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: f31f957471dea5d955758db98226a727405248d7
Parent: 1ef8f0605ef021a7f0045d9be19497ef95a2a16e
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Apr 4 15:11:59 2011 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Apr 4 15:11:59 2011 +0200
fence_ipmilan: returns incorrect status on monitor op if chassis is powered off
There is a bug in fence_ipmilan agent: it exits with result code 2 on
"monitor"/"status" command if chassis is powered off. Instead it should return
0 because "monitor" command should return fence device status, not chassis
status.
Reported and patch proposed by Vladislav Bogdanov
Resolves: rhbz#690735
---
fence/agents/ipmilan/ipmilan.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/fence/agents/ipmilan/ipmilan.c b/fence/agents/ipmilan/ipmilan.c
index d34ced5..040babf 100644
--- a/fence/agents/ipmilan/ipmilan.c
+++ b/fence/agents/ipmilan/ipmilan.c
@@ -1192,5 +1192,9 @@ metaout:
else
printf("Failed\n");
}
+
+ if (!strcasecmp(op, "monitor"))
+ translated_ret = ret;
+
return translated_ret;
}
13 years, 1 month
fence-agents: master - fence_cisco_ucs, fence_rhevm: Problems with SSL support
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: 1ef8f0605ef021a7f0045d9be19497ef95a2a16e
Parent: 6c2ac2d240e0c9dc9f46698cf605b24ecfee3da2
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Apr 4 14:59:47 2011 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Apr 4 14:59:47 2011 +0200
fence_cisco_ucs, fence_rhevm: Problems with SSL support
Both of these agents are using pycurl. This library has different default
setting across various distributions, so it is better to set SSL options
directly.
Resolves: rhbz#691392
---
fence/agents/cisco_ucs/fence_cisco_ucs.py | 1 +
fence/agents/rhevm/fence_rhevm.py | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/fence/agents/cisco_ucs/fence_cisco_ucs.py b/fence/agents/cisco_ucs/fence_cisco_ucs.py
index a41349a..eda6aed 100755
--- a/fence/agents/cisco_ucs/fence_cisco_ucs.py
+++ b/fence/agents/cisco_ucs/fence_cisco_ucs.py
@@ -88,6 +88,7 @@ def send_command(opt, command):
c.setopt(pycurl.WRITEFUNCTION, b.write)
c.setopt(pycurl.TIMEOUT, int(opt["-Y"]))
c.setopt(pycurl.SSL_VERIFYPEER, 0)
+ c.setopt(pycurl.SSL_VERIFYHOST, 0)
c.perform()
result = b.getvalue()
diff --git a/fence/agents/rhevm/fence_rhevm.py b/fence/agents/rhevm/fence_rhevm.py
index 6d8df4e..c3ef29a 100755
--- a/fence/agents/rhevm/fence_rhevm.py
+++ b/fence/agents/rhevm/fence_rhevm.py
@@ -100,6 +100,7 @@ def send_command(opt, command, method = "GET"):
c.setopt(pycurl.USERPWD, opt["-l"] + ":" + opt["-p"])
c.setopt(pycurl.TIMEOUT, int(opt["-Y"]))
c.setopt(pycurl.SSL_VERIFYPEER, 0)
+ c.setopt(pycurl.SSL_VERIFYHOST, 0)
if (method == "POST"):
c.setopt(pycurl.POSTFIELDS, "<action />")
13 years, 1 month
fence-agents: master - fence_vmware_soap: New fence agent for VMWare using SOAP API
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: 6c2ac2d240e0c9dc9f46698cf605b24ecfee3da2
Parent: 0144619d57737bd8eba90e6b6c6b5f2bbb45247c
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Apr 4 14:52:38 2011 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Apr 4 14:55:16 2011 +0200
fence_vmware_soap: New fence agent for VMWare using SOAP API
This fence agent depends on package python-suds (https://fedorahosted.org/suds/)
which provides interface to SOAP
Resolves: rhbz#634567
---
configure.ac | 1 +
fence/agents/Makefile.am | 1 +
fence/agents/vmware_soap/Makefile.am | 17 +++
fence/agents/vmware_soap/fence_vmware_soap.py | 175 +++++++++++++++++++++++++
4 files changed, 194 insertions(+), 0 deletions(-)
diff --git a/configure.ac b/configure.ac
index 9b13a98..d8994d2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -253,6 +253,7 @@ AC_CONFIG_FILES([Makefile
fence/agents/virsh/Makefile
fence/agents/vixel/Makefile
fence/agents/vmware/Makefile
+ fence/agents/vmware_soap/Makefile
fence/agents/wti/Makefile
fence/agents/xcat/Makefile
fence/agents/zvm/Makefile
diff --git a/fence/agents/Makefile.am b/fence/agents/Makefile.am
index 945b49b..e2f445f 100644
--- a/fence/agents/Makefile.am
+++ b/fence/agents/Makefile.am
@@ -37,6 +37,7 @@ SUBDIRS = lib \
virsh \
vixel \
vmware \
+ vmware_soap \
wti \
xcat \
zvm
diff --git a/fence/agents/vmware_soap/Makefile.am b/fence/agents/vmware_soap/Makefile.am
new file mode 100644
index 0000000..8e4e061
--- /dev/null
+++ b/fence/agents/vmware_soap/Makefile.am
@@ -0,0 +1,17 @@
+MAINTAINERCLEANFILES = Makefile.in
+
+TARGET = fence_vmware_soap
+
+SRC = $(TARGET).py
+
+EXTRA_DIST = $(SRC)
+
+sbin_SCRIPTS = $(TARGET)
+
+man_MANS = $(TARGET).8
+
+include $(top_srcdir)/make/fencebuild.mk
+include $(top_srcdir)/make/fenceman.mk
+
+clean-local: clean-man
+ rm -f $(TARGET)
diff --git a/fence/agents/vmware_soap/fence_vmware_soap.py b/fence/agents/vmware_soap/fence_vmware_soap.py
new file mode 100644
index 0000000..2718560
--- /dev/null
+++ b/fence/agents/vmware_soap/fence_vmware_soap.py
@@ -0,0 +1,175 @@
+#!/usr/bin/python
+
+import sys, re, pexpect, exceptions
+sys.path.append("@FENCEAGENTSLIBDIR@")
+
+from suds.client import Client
+from suds import WebFault
+from suds.sudsobject import Property
+from fencing import *
+
+#BEGIN_VERSION_GENERATION
+RELEASE_VERSION="New VMWare Agent - test release on steroids"
+REDHAT_COPYRIGHT=""
+BUILD_DATE="April, 2011"
+#END_VERSION_GENERATION
+
+def soap_login(options):
+ if options.has_key("-z"):
+ url = "https://"
+ else:
+ url = "http://"
+
+ url += options["-a"] + ":" + str(options["-u"]) + "/sdk"
+ conn = Client(url + "/vimService.wsdl")
+ conn.set_options(location = url)
+
+ mo_ServiceInstance = Property('ServiceInstance')
+ mo_ServiceInstance._type = 'ServiceInstance'
+ ServiceContent = conn.service.RetrieveServiceContent(mo_ServiceInstance)
+ mo_SessionManager = Property(ServiceContent.sessionManager.value)
+ mo_SessionManager._type = 'SessionManager'
+
+ try:
+ SessionManager = conn.service.Login(mo_SessionManager, options["-l"], options["-p"])
+ except Exception, ex:
+ fail(EC_LOGIN_DENIED)
+
+ options["ServiceContent"] = ServiceContent
+ options["mo_SessionManager"] = mo_SessionManager
+ return conn
+
+def get_power_status(conn, options):
+ mo_ViewManager = Property(options["ServiceContent"].viewManager.value)
+ mo_ViewManager._type = "ViewManager"
+
+ mo_RootFolder = Property(options["ServiceContent"].rootFolder.value)
+ mo_RootFolder._type = "Folder"
+
+ mo_PropertyCollector = Property(options["ServiceContent"].propertyCollector.value)
+ mo_PropertyCollector._type = 'PropertyCollector'
+
+ ContainerView = conn.service.CreateContainerView(mo_ViewManager, recursive = 1, container = mo_RootFolder, type = ['VirtualMachine'])
+ mo_ContainerView = Property(ContainerView.value)
+ mo_ContainerView._type = "ContainerView"
+
+ FolderTraversalSpec = conn.factory.create('ns0:TraversalSpec')
+ FolderTraversalSpec.name = "traverseEntities"
+ FolderTraversalSpec.path = "view"
+ FolderTraversalSpec.skip = False
+ FolderTraversalSpec.type = "ContainerView"
+
+ objSpec = conn.factory.create('ns0:ObjectSpec')
+ objSpec.obj = mo_ContainerView
+ objSpec.selectSet = [ FolderTraversalSpec ]
+ objSpec.skip = True
+
+ propSpec = conn.factory.create('ns0:PropertySpec')
+ propSpec.all = False
+ propSpec.pathSet = ["name", "summary.runtime.powerState", "config.uuid", "summary", "config", "capability", "network"]
+ propSpec.type = "VirtualMachine"
+
+ propFilterSpec = conn.factory.create('ns0:PropertyFilterSpec')
+ propFilterSpec.propSet = [ propSpec ]
+ propFilterSpec.objectSet = [ objSpec ]
+
+ try:
+ raw_machines = conn.service.RetrievePropertiesEx(mo_PropertyCollector, propFilterSpec)
+ except Exception, ex:
+ fail(EC_STATUS)
+
+ machines = { }
+ uuid = { }
+ mappingToUUID = { }
+
+ for m in raw_machines.objects:
+ info = {}
+ for i in m.propSet:
+ info[i.name] = i.val
+ machines[info["name"]] = (info["config.uuid"], info["summary.runtime.powerState"])
+ uuid[info["config.uuid"]] = info["summary.runtime.powerState"]
+ mappingToUUID[m.obj.value] = info["config.uuid"]
+
+ if ["list", "monitor"].count(options["-o"]) == 1:
+ return machines
+ else:
+ if options.has_key("-U") == False:
+ ## Transform InventoryPath to UUID
+ mo_SearchIndex = Property(options["ServiceContent"].searchIndex.value)
+ mo_SearchIndex._type = "SearchIndex"
+
+ vm = conn.service.FindByInventoryPath(mo_SearchIndex, options["-n"])
+
+ try:
+ options["-U"] = mappingToUUID[vm.value]
+ except KeyError, ex:
+ fail(EC_STATUS)
+ except AttributeError, ex:
+ fail(EC_STATUS)
+
+ try:
+ if uuid[options["-U"]] == "poweredOn":
+ return "on"
+ else:
+ return "off"
+ return status
+ except KeyError, ex:
+ fail(EC_STATUS)
+
+def set_power_status(conn, options):
+ mo_SearchIndex = Property(options["ServiceContent"].searchIndex.value)
+ mo_SearchIndex._type = "SearchIndex"
+ vm = conn.service.FindByUuid(mo_SearchIndex, vmSearch = 1, uuid = options["-U"])
+
+ mo_machine = Property(vm.value)
+ mo_machine._type = "VirtualMachine"
+
+ if options["-o"] == "on":
+ conn.service.PowerOnVM_Task(mo_machine)
+ else:
+ conn.service.PowerOffVM_Task(mo_machine)
+
+def main():
+ device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug",
+ "action", "ipaddr", "login", "passwd", "passwd_script",
+ "ssl", "port", "uuid", "separator", "ipport",
+ "power_timeout", "shell_timeout", "login_timeout", "power_wait" ]
+
+ atexit.register(atexit_handler)
+
+ options = check_input(device_opt, process_input(device_opt))
+
+ ##
+ ## Fence agent specific defaults
+ #####
+ docs = { }
+ docs["shortdesc"] = "Fence agent for VMWare over SOAP API"
+ docs["longdesc"] = "fence_vmware_soap is an I/O Fencing agent \
+which can be used with the virtual machines managed by VMWare products \
+that have SOAP API v4.1+. \
+\n.P\n\
+Name of virtual machine (-n / port) has to be used in inventory path \
+format (e.g. /datacenter/vm/Discovered virtual machine/myMachine). Alternatively \
+you can use UUID (-U / uuid) to access virtual machine."
+ docs["vendorurl"] = "http://www.vmware.com"
+ show_docs(options, docs)
+
+ ##
+ ## Operate the fencing device
+ ####
+ conn = soap_login(options)
+
+ result = fence_action(conn, options, set_power_status, get_power_status, get_power_status)
+
+ ##
+ ## Logout from system
+ #####
+ try:
+ conn.service.Logout(options["mo_SessionManager"])
+ except Exception, ex:
+ pass
+
+ sys.exit(result)
+
+if __name__ == "__main__":
+ main()
13 years, 1 month
fence-agents: master - library: Add support for UUID (-U / --uuid / uuid)
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: 0144619d57737bd8eba90e6b6c6b5f2bbb45247c
Parent: 2be096c234ea7f4592c36759ba965a0f2c1879dc
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Apr 4 14:43:36 2011 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Apr 4 14:43:36 2011 +0200
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 | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 8bd6f45..32b5d2b 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -386,7 +386,14 @@ all_opt = {
"default" : "1",
"required" : "0",
"shortdesc" : "Count of attempts to retry power on",
- "order" : 201 }
+ "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" ]
@@ -687,7 +694,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"):
13 years, 1 month