Skip to content

Commit 725021d

Browse files
author
Ferenc Born
authored
Merge pull request #36 from schubergphilis/minimise-unmanage
Unmanage state only when the poolmaster is being rebooted
2 parents 182b6a5 + c2ac366 commit 725021d

1 file changed

Lines changed: 16 additions & 11 deletions

File tree

xenserver_rolling_reboot.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ def handleArguments(argv):
6565
'\n --clustername -n <clustername> \t\tName of the cluster to work with' + \
6666
'\n --ignore-hosts <list>\t\t\t\tSkip work on the specified hosts (for example if you need to resume): ' \
6767
'Example: --ignore-hosts="host1, host2" ' + \
68-
'\n --threads <nr>\t\t\t\tUse this number or concurrent migration threads" ' + \
68+
'\n --threads <nr>\t\t\t\tUse this number or concurrent migration threads ' + \
6969
'\n --halt\t\t\t\t\tInstead of the default reboot, halt the hypervisor (useful in case of hardware ' \
70-
'upgrades)" ' + \
70+
'upgrades) ' + \
7171
'\n --debug\t\t\t\t\tEnable debug mode' + \
7272
'\n --exec\t\t\t\t\tExecute for real' + \
7373
'\n --prepare\t\t\t\t\tExecute some prepare commands'
@@ -268,6 +268,20 @@ def handleArguments(argv):
268268
checkBonds = True
269269
c.printHypervisors(clusterID, poolmaster.name, checkBonds)
270270

271+
# Set to manage in CloudStack
272+
print "Note: Setting cluster " + clustername + " back to Managed in CloudStack"
273+
clusterUpdateReturn = c.updateCluster(
274+
{'clusterid': clusterID, 'managedstate': 'Managed'})
275+
276+
if clusterUpdateReturn == 1 or clusterUpdateReturn is None:
277+
print "Error: Managing cluster " + clustername + " failed. Please check manually."
278+
disconnect_all()
279+
sys.exit(1)
280+
281+
# Print cluster info
282+
print "Note: Some info about cluster '" + clustername + "':"
283+
c.printCluster(clusterID)
284+
271285
# Then the other hypervisors, one-by-one
272286
for h in cluster_hosts:
273287
if h.name in ignoreHosts:
@@ -310,15 +324,6 @@ def handleArguments(argv):
310324
sys.ext(1)
311325
print "Note: The state of HA on cluster " + clustername + " is " + str(pool_ha)
312326

313-
# Set to manage in CloudStack
314-
clusterUpdateReturn = c.updateCluster(
315-
{'clusterid': clusterID, 'managedstate': 'Managed'})
316-
317-
if clusterUpdateReturn == 1 or clusterUpdateReturn is None:
318-
print "Error: Managing cluster " + clustername + " failed. Please check manually."
319-
disconnect_all()
320-
sys.exit(1)
321-
322327
# Print cluster info
323328
print "Note: Some info about cluster '" + clustername + "':"
324329
c.printCluster(clusterID)

0 commit comments

Comments
 (0)