Enhancements and bugfixes for VMTP

1. VMTP should not pick up disabled hypervisors;
2. Check image upload return code before moving forward;

Change-Id: I37513bfff60de8dcdcd1edc3347c890e4659c172
This commit is contained in:
Yichen Wang 2018-03-12 18:58:04 -07:00
parent 8b7bd9e7d0
commit 5c2a5187c2
2 changed files with 7 additions and 2 deletions

View File

@ -361,7 +361,7 @@ class Compute(object):
else: else:
for host in host_list: for host in host_list:
# this host must be a compute node # this host must be a compute node
if host.binary != 'nova-compute' or host.state != 'up': if host.binary != 'nova-compute' or host.state != 'up' or host.status != 'enabled':
continue continue
candidate = None candidate = None
if self.config.availability_zone: if self.config.availability_zone:

View File

@ -220,10 +220,15 @@ class VmtpTest(object):
if self.config.vm_image_url != "": if self.config.vm_image_url != "":
LOG.info('%s: image for VM not found, trying to upload it ...', LOG.info('%s: image for VM not found, trying to upload it ...',
self.config.image_name) self.config.image_name)
self.comp.upload_image_via_url( flag = self.comp.upload_image_via_url(
self.glance_client, self.glance_client,
self.config.image_name, self.config.image_name,
self.config.vm_image_url) self.config.vm_image_url)
if not flag:
# Exit the pogram
LOG.error('Cannot upload image %s to the cloud. ABORTING.',
self.config.image_name)
sys.exit(1)
self.image_instance = self.comp.find_image(self.glance_client, self.image_instance = self.comp.find_image(self.glance_client,
self.config.image_name) self.config.image_name)
self.image_uploaded = True self.image_uploaded = True