Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions xenserver_parallel_evacuate.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ def handleArguments(self,argv):
self.DEBUG = 0
self.DRYRUN = 1
self.threads = 5
self.skip_checks = False

# Usage message
help = "Usage: " + os.path.basename(__file__) + ' --threads [--debug --exec ]'
help = "Usage: " + os.path.basename(__file__) + ' --threads [--debug --exec --skip-checks]'

try:
opts, args = getopt.getopt(argv,"ht:",["threads=","debug","exec"])
opts, args = getopt.getopt(argv,"ht:",["threads=","debug","exec","skip-checks"])
except getopt.GetoptError:
print help
sys.exit(2)
Expand All @@ -53,6 +54,8 @@ def handleArguments(self,argv):
self.DEBUG = 1
elif opt in ("--exec"):
self.DRYRUN = 0
elif opt in ("--skip-checks"):
self.skip_checks = True

# Class to handle XenServer parallel evactation
class xenserver_parallel_evacuation(object):
Expand All @@ -64,6 +67,7 @@ def __init__(self, arg):
self.poolmember = False
self.vmlist = False
self.hvlist = False
self.skip_checks = arg.skip_checks

# Run local command
def run_local_command(self, command):
Expand Down Expand Up @@ -130,15 +134,16 @@ def get_hypervisor_with_most_free_memory(self):

# Generate migration plan
def generate_migration_plan(self, grep_for=None):
# Make sure host is disabled
if self.is_host_enabled() is not False:
print "Error: Host should be disabled first."
return False
if self.skip_checks is False:
# Make sure host is disabled
if self.is_host_enabled() is not False:
print "Error: Host should be disabled first."
return False

# Make sure pool HA is turned off
if self.pool_ha_check() is not False:
print "Error: Pool HA should be disabled first."
return False
# Make sure pool HA is turned off
if self.pool_ha_check() is not False:
print "Error: Pool HA should be disabled first."
return False

# Generate migration plan
migration_cmds = ""
Expand Down