import keystoneauth1
import novaclient
-from log import LOG
+from .log import LOG
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",
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,
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,