diff options
author | Scott Moser <smoser@brickies.net> | 2017-11-29 15:26:38 -0500 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2017-11-29 15:26:38 -0500 |
commit | 88368f9851b29dddb5a12e4b21868cbdef906c5c (patch) | |
tree | bc82164948ace765b43dd2edbc7054331de2c7ca /tests/cloud_tests/platforms | |
parent | 4964fb38f11c15ed119ff4c7f4379ae3c8785a9a (diff) | |
download | vyos-cloud-init-88368f9851b29dddb5a12e4b21868cbdef906c5c.tar.gz vyos-cloud-init-88368f9851b29dddb5a12e4b21868cbdef906c5c.zip |
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'
Diffstat (limited to 'tests/cloud_tests/platforms')
-rw-r--r-- | tests/cloud_tests/platforms/nocloudkvm.py | 21 |
1 files changed, 11 insertions, 10 deletions
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) |