X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=nfvbench%2Fcompute.py;h=f6f179d62a311a87454e25e144d1fa54c0ff31cc;hb=refs%2Ftags%2F4.2.2;hp=97fd166f863b4a60ca7d57aedd9c1c5807b8dd59;hpb=ed33e56c9b8771ed9d22fc3cc19e049a76137db8;p=nfvbench.git diff --git a/nfvbench/compute.py b/nfvbench/compute.py index 97fd166..f6f179d 100644 --- a/nfvbench/compute.py +++ b/nfvbench/compute.py @@ -24,7 +24,7 @@ except ImportError: import keystoneauth1 import novaclient -from log import LOG +from .log import LOG class Compute(object): @@ -50,7 +50,7 @@ class Compute(object): retry = 0 try: # check image is file/url based. - with open(image_file) as f_image: + with open(image_file, 'rb') as f_image: img = self.glance_client.images.create(name=str(final_image_name), disk_format="qcow2", container_format="bare", @@ -95,6 +95,24 @@ class Compute(object): return True + def image_multiqueue_enabled(self, img): + """Check if multiqueue property is enabled on given image.""" + try: + return img['hw_vif_multiqueue_enabled'] == 'true' + except KeyError: + return False + + def image_set_multiqueue(self, img, enabled): + """Set multiqueue property as enabled or disabled on given image.""" + cur_mqe = self.image_multiqueue_enabled(img) + LOG.info('Image %s hw_vif_multiqueue_enabled property is "%s"', + img.name, str(cur_mqe).lower()) + if cur_mqe != enabled: + mqe = str(enabled).lower() + self.glance_client.images.update(img.id, hw_vif_multiqueue_enabled=mqe) + img['hw_vif_multiqueue_enabled'] = mqe + LOG.info('Image %s hw_vif_multiqueue_enabled property changed to "%s"', img.name, mqe) + # Create a server instance with name vmname # and check that it gets into the ACTIVE state def create_server(self, vmname, image, flavor, key_name, @@ -107,7 +125,7 @@ class Compute(object): security_groups = None # Also attach the created security group for the test - LOG.info('Creating instance %s with AZ %s', vmname, avail_zone) + LOG.info('Creating instance %s with AZ: "%s"', vmname, avail_zone) instance = self.novaclient.servers.create(name=vmname, image=image, flavor=flavor,