class GlanceCycle(object): def __init__(self, glance, add_test_info): self.timer = wait.Wait() self.glance_img = GlanceActions(glance) self.add_test_info = add_test_info self.image = None def img_create(self, name): self.add_test_info.sub_test_info("1", "create_image") create_image = self.glance_img.upload_images(name=name) assert create_image.status, "Image create initialize error" log.info("image name: %s" % create_image.image.name) self.timer.wait_for_state_change(create_image.image.status, "creating") image = self.glance_img.get_image(create_image.image) self.image = image.image log.info("Image exists")
class GlanceCycle(object): def __init__(self, glance): self.timer = wait.Wait() self.glance_image = GlanceActions(glance.glance) self.img = None def image_create(self, name): add_test_info.sub_test_info('1', 'Create glance image') self.image = self.glance_image.upload_images(name=name) assert self.image.status, 'Image creation failure' log.info('image name: %s' % self.image.image.name) self.timer.wait_for_state_change(self.image.image.status, 'queued') img = self.glance_image.get_image(self.image.image) self.img = img.image log.info('Image created') add_test_info.sub_test_completed_info() return self.img def image_delete(self): add_test_info.sub_test_info('4', 'Delete glance image') image_to_delete = self.glance_image.delete_image(self.img.id) assert image_to_delete.execute, 'Image deletion failure' self.timer.wait_for_state_change(self.image.image.status, 'active') image_exists = self.glance_image.get_image(self.image.image) if not image_exists.status: log.info('Image deleted') else: log.error('Image status: %s' % image_exists.image.status) raise AssertionError("Image still exists") add_test_info.sub_test_completed_info()
def __init__(self, glance): self.timer = wait.Wait() self.glance_image = GlanceActions(glance.glance) self.img = None
def __init__(self, glance, add_test_info): self.timer = wait.Wait() self.glance_img = GlanceActions(glance) self.add_test_info = add_test_info self.image = None