diff --git a/cloudstackops/xenserver.py b/cloudstackops/xenserver.py index e2d419b..494798c 100644 --- a/cloudstackops/xenserver.py +++ b/cloudstackops/xenserver.py @@ -113,7 +113,7 @@ def get_poolmaster(self, host): def get_patch_level(self, host): try: with settings(host_string=self.ssh_user + "@" + host.ipaddress): - return fab.run("for p in $(xe patch-list | grep XS | awk {'print $4'} | tr -d \" \" |\ + return fab.run("for p in $(xe patch-list | grep XS.*E | awk {'print $4'} | tr -d \" \" |\ sort | tr '\n' ' '); do echo -n $p \"(\"; xe patch-list name-label=$p params=hosts |\ awk -F: {'print $2'} | tr -cd , | awk {'print $1 \",\"'} | tr -d '\n' | wc -c | tr -d '\n'; echo -n \") \"; done") except: @@ -220,7 +220,10 @@ def pool_ha_enable(self, host): print "Note: Enabling HA" try: with settings(host_string=self.ssh_user + "@" + host.ipaddress): - return fab.run("xe pool-ha-enable heartbeat-sr-uuids=$(xe sr-list type=nfs params=uuid --minimal) ha-config:timeout=180 ha-config:ha-host-failures-to-tolerate=1") + if fab.run("cat /etc/redhat-release | awk '{ $3 = substr($3,1,3); print $3 }'") == "6.2": + return fab.run("xe pool-ha-enable heartbeat-sr-uuids=$(xe sr-list type=nfs params=uuid --minimal) ha-config:timeout=180 ha-config:ha-host-failures-to-tolerate=1") + else: + return fab.run("xe pool-ha-enable heartbeat-sr-uuids=$(xe sr-list type=nfs params=uuid --minimal) ha-config:timeout=180; xe pool-param-set uuid=$(xe pool-list params=uuid --minimal) ha-host-failures-to-tolerate=1") except: return False