From 88368f9851b29dddb5a12e4b21868cbdef906c5c Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Wed, 29 Nov 2017 15:26:38 -0500 Subject: tests: NoCloudKVMImage do not modify the original local cache image. The NoCloudKVMImage.execute() would modify the image in /srv/citest that meant that after the first time you ran a test, the image was dirty. The change here is to make the image operate on a qcow backed image. Also modify Snapshot to then copy the qcow rather than creating another chained qcow. The reason being that the image might go away or change after the snapshot has been returned. Also * drop use of 'override_templates' which was only relevant to LXD. * NoCloudKVM.create_image() returned an instance before now it has create_instance which creates an instance. * NoCloudKVMInstance has a 'disk' attribute separate from 'name' --- tests/cloud_tests/platforms/nocloudkvm.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'tests/cloud_tests/platforms') diff --git a/tests/cloud_tests/platforms/nocloudkvm.py b/tests/cloud_tests/platforms/nocloudkvm.py index f1f81877..76cd83ad 100644 --- a/tests/cloud_tests/platforms/nocloudkvm.py +++ b/tests/cloud_tests/platforms/nocloudkvm.py @@ -55,19 +55,20 @@ class NoCloudKVMPlatform(base.Platform): for fname in glob.iglob(search_d, recursive=True): images.append(fname) - if len(images) != 1: - raise Exception('No unique images found') + if len(images) < 1: + raise RuntimeError("No images found under '%s'" % search_d) + if len(images) > 1: + raise RuntimeError( + "Multiple images found in '%s': %s" % (search_d, + ' '.join(images))) image = nocloud_kvm_image.NoCloudKVMImage(self, img_conf, images[0]) - if img_conf.get('override_templates', False): - image.update_templates(self.config.get('template_overrides', {}), - self.config.get('template_files', {})) return image - def create_image(self, properties, config, features, - src_img_path, image_desc=None, use_desc=None, - user_data=None, meta_data=None): - """Create an image + def create_instance(self, properties, config, features, + src_img_path, image_desc=None, use_desc=None, + user_data=None, meta_data=None): + """Create an instance @param src_img_path: image path to launch from @param properties: image properties @@ -82,7 +83,7 @@ class NoCloudKVMPlatform(base.Platform): c_util.subp(['qemu-img', 'create', '-f', 'qcow2', '-b', src_img_path, img_path]) - return nocloud_kvm_instance.NoCloudKVMInstance(self, img_path, + return nocloud_kvm_instance.NoCloudKVMInstance(self, name, img_path, properties, config, features, user_data, meta_data) -- cgit v1.2.3