Merge "Disable empty and to be empty computes before instance actions"
This commit is contained in:
commit
e6b796f6b7
|
@ -470,11 +470,12 @@ class Workflow(BaseWorkflow):
|
|||
return hosts_to_be_empty
|
||||
|
||||
def make_empty_hosts(self, state):
|
||||
# TBD disable nova-compute on empty host or parallel to be empty
|
||||
# disable nova-compute on empty host or parallel to be empty
|
||||
# host so cannot move instance to there. Otherwise make math
|
||||
# to find the target host and give it to move operation
|
||||
# done with temporarily_disabled_hosts
|
||||
temporarily_disabled_hosts = []
|
||||
|
||||
hvisors = self.nova.hypervisors.list(detailed=True)
|
||||
weighted_hosts = {}
|
||||
act_instances_hosts = {}
|
||||
|
@ -495,6 +496,7 @@ class Workflow(BaseWorkflow):
|
|||
self.empty_hosts.append(host)
|
||||
temporarily_disabled_hosts.append(host)
|
||||
self.disable_host_nova_compute(host)
|
||||
LOG.info("host %s empty" % host)
|
||||
elif vcpus_used == vcpus:
|
||||
# We do not choose full host
|
||||
continue
|
||||
|
@ -515,15 +517,16 @@ class Workflow(BaseWorkflow):
|
|||
hosts_to_be_empty = self.find_host_to_be_empty(need_empty,
|
||||
weighted_hosts,
|
||||
act_instances_hosts)
|
||||
thrs = []
|
||||
for host in hosts_to_be_empty:
|
||||
temporarily_disabled_hosts.append(host)
|
||||
self.disable_host_nova_compute(host)
|
||||
thrs = []
|
||||
for host in hosts_to_be_empty:
|
||||
thrs.append(self.actions_to_have_empty_host(host, state))
|
||||
LOG.info("waiting hosts %s to be empty..." % hosts_to_be_empty)
|
||||
for thr in thrs:
|
||||
thr.join()
|
||||
LOG.info("hosts %s empty..." % hosts_to_be_empty)
|
||||
LOG.info("hosts %s made empty" % hosts_to_be_empty)
|
||||
for host in temporarily_disabled_hosts:
|
||||
self.enable_host_nova_compute(host)
|
||||
return True
|
||||
|
|
Loading…
Reference in New Issue