summaryrefslogtreecommitdiff
path: root/tests/cloud_tests
diff options
context:
space:
mode:
authorRyan Harper <ryan.harper@canonical.com>2019-07-18 19:53:50 +0000
committerServer Team CI Bot <josh.powers+server-team-bot@canonical.com>2019-07-18 19:53:50 +0000
commita02c0c9aa24a16f1983a81fe5dbfadac3d7e0ad3 (patch)
treeb3a0f22e2ed97062083611f680710fd9aed4e030 /tests/cloud_tests
parent5498107d184815fe2e591748e247ab98a4e6d681 (diff)
downloadvyos-cloud-init-a02c0c9aa24a16f1983a81fe5dbfadac3d7e0ad3.tar.gz
vyos-cloud-init-a02c0c9aa24a16f1983a81fe5dbfadac3d7e0ad3.zip
cloud_tests: updates and fixes
- Update paramiko and cryptography module versions (2.4.2) to address issues with algo and deprecation warnings. - Modify ssh keypair generation to work with updated paramiko - tools/xkvm sync with newer version from curtin - Update NoCloudKvm instance.py to work with updated xkvm - pass -name to instance, useful for debugging on shared host - Add cache_mode platform config; default to cache=none,aio=native - Switch to yaml.safe_load() in platforms.py
Diffstat (limited to 'tests/cloud_tests')
-rw-r--r--tests/cloud_tests/platforms.yaml1
-rw-r--r--tests/cloud_tests/platforms/nocloudkvm/instance.py13
-rw-r--r--tests/cloud_tests/platforms/platforms.py2
-rw-r--r--tests/cloud_tests/setup_image.py3
4 files changed, 13 insertions, 6 deletions
diff --git a/tests/cloud_tests/platforms.yaml b/tests/cloud_tests/platforms.yaml
index 448aa98d..652a7051 100644
--- a/tests/cloud_tests/platforms.yaml
+++ b/tests/cloud_tests/platforms.yaml
@@ -66,5 +66,6 @@ platforms:
{{ config_get("user.vendor-data", properties.default) }}
nocloud-kvm:
enabled: true
+ cache_mode: cache=none,aio=native
# vi: ts=4 expandtab
diff --git a/tests/cloud_tests/platforms/nocloudkvm/instance.py b/tests/cloud_tests/platforms/nocloudkvm/instance.py
index 33ff3f24..96185b75 100644
--- a/tests/cloud_tests/platforms/nocloudkvm/instance.py
+++ b/tests/cloud_tests/platforms/nocloudkvm/instance.py
@@ -74,6 +74,8 @@ class NoCloudKVMInstance(Instance):
self.pid_file = None
self.console_file = None
self.disk = image_path
+ self.cache_mode = platform.config.get('cache_mode',
+ 'cache=none,aio=native')
self.meta_data = meta_data
def shutdown(self, wait=True):
@@ -113,7 +115,10 @@ class NoCloudKVMInstance(Instance):
pass
if self.pid_file:
- os.remove(self.pid_file)
+ try:
+ os.remove(self.pid_file)
+ except Exception:
+ pass
self.pid = None
self._ssh_close()
@@ -160,13 +165,13 @@ class NoCloudKVMInstance(Instance):
self.ssh_port = self.get_free_port()
cmd = ['./tools/xkvm',
- '--disk', '%s,cache=unsafe' % self.disk,
- '--disk', '%s,cache=unsafe' % seed,
+ '--disk', '%s,%s' % (self.disk, self.cache_mode),
+ '--disk', '%s' % seed,
'--netdev', ','.join(['user',
'hostfwd=tcp::%s-:22' % self.ssh_port,
'dnssearch=%s' % CI_DOMAIN]),
'--', '-pidfile', self.pid_file, '-vnc', 'none',
- '-m', '2G', '-smp', '2', '-nographic',
+ '-m', '2G', '-smp', '2', '-nographic', '-name', self.name,
'-serial', 'file:' + self.console_file]
subprocess.Popen(cmd,
close_fds=True,
diff --git a/tests/cloud_tests/platforms/platforms.py b/tests/cloud_tests/platforms/platforms.py
index abbfebba..bebdf1c6 100644
--- a/tests/cloud_tests/platforms/platforms.py
+++ b/tests/cloud_tests/platforms/platforms.py
@@ -48,7 +48,7 @@ class Platform(object):
if os.path.exists(filename):
c_util.del_file(filename)
- c_util.subp(['ssh-keygen', '-t', 'rsa', '-b', '4096',
+ c_util.subp(['ssh-keygen', '-m', 'PEM', '-t', 'rsa', '-b', '4096',
'-f', filename, '-P', '',
'-C', 'ubuntu@cloud_test'],
capture=True)
diff --git a/tests/cloud_tests/setup_image.py b/tests/cloud_tests/setup_image.py
index 39f4517f..a8aaba15 100644
--- a/tests/cloud_tests/setup_image.py
+++ b/tests/cloud_tests/setup_image.py
@@ -222,7 +222,8 @@ def setup_image(args, image):
for name, func, desc in handlers if getattr(args, name, None)]
try:
- data = yaml.load(image.read_data("/etc/cloud/build.info", decode=True))
+ data = yaml.safe_load(
+ image.read_data("/etc/cloud/build.info", decode=True))
info = ' '.join(["%s=%s" % (k, data.get(k))
for k in ("build_name", "serial") if k in data])
except Exception as e: