@@ -34,12 +34,13 @@ def handleArguments(self,argv):
3434 self .DEBUG = 0
3535 self .DRYRUN = 1
3636 self .threads = 5
37+ self .skip_checks = False
3738
3839 # Usage message
39- help = "Usage: " + os .path .basename (__file__ ) + ' --threads [--debug --exec ]'
40+ help = "Usage: " + os .path .basename (__file__ ) + ' --threads [--debug --exec --skip-checks ]'
4041
4142 try :
42- opts , args = getopt .getopt (argv ,"ht:" ,["threads=" ,"debug" ,"exec" ])
43+ opts , args = getopt .getopt (argv ,"ht:" ,["threads=" ,"debug" ,"exec" , "skip-checks" ])
4344 except getopt .GetoptError :
4445 print help
4546 sys .exit (2 )
@@ -53,6 +54,8 @@ def handleArguments(self,argv):
5354 self .DEBUG = 1
5455 elif opt in ("--exec" ):
5556 self .DRYRUN = 0
57+ elif opt in ("--skip-checks" ):
58+ self .skip_checks = True
5659
5760# Class to handle XenServer parallel evactation
5861class xenserver_parallel_evacuation (object ):
@@ -64,6 +67,7 @@ def __init__(self, arg):
6467 self .poolmember = False
6568 self .vmlist = False
6669 self .hvlist = False
70+ self .skip_checks = arg .skip_checks
6771
6872 # Run local command
6973 def run_local_command (self , command ):
@@ -130,15 +134,16 @@ def get_hypervisor_with_most_free_memory(self):
130134
131135 # Generate migration plan
132136 def generate_migration_plan (self , grep_for = None ):
133- # Make sure host is disabled
134- if self .is_host_enabled () is not False :
135- print "Error: Host should be disabled first."
136- return False
137+ if self .skip_checks is False :
138+ # Make sure host is disabled
139+ if self .is_host_enabled () is not False :
140+ print "Error: Host should be disabled first."
141+ return False
137142
138- # Make sure pool HA is turned off
139- if self .pool_ha_check () is not False :
140- print "Error: Pool HA should be disabled first."
141- return False
143+ # Make sure pool HA is turned off
144+ if self .pool_ha_check () is not False :
145+ print "Error: Pool HA should be disabled first."
146+ return False
142147
143148 # Generate migration plan
144149 migration_cmds = ""
0 commit comments