summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pitt <martin.pitt@ubuntu.com>2016-01-18 10:34:54 (GMT)
committerMartin Pitt <martin.pitt@ubuntu.com>2016-01-18 10:34:54 (GMT)
commit9008c6f285bcfa6c4f8f6cf172497116042307db (patch)
treea76e0663b3432eb6400a0600e0ea787a7892190a
parent0d8d1cab6fa39a5999be969144baf81c3390cd4e (diff)
adt-virt-lxc: Add timeouts to all LXC operations
-rw-r--r--debian/changelog1
-rwxr-xr-xvirt-subproc/adt-virt-lxc10
2 files changed, 6 insertions, 5 deletions
diff --git a/debian/changelog b/debian/changelog
index b614245..6d81c52 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -16,6 +16,7 @@ autopkgtest (3.19.2) UNRELEASED; urgency=medium
* adt-buildvm-ubuntu-cloud: Drop duplicate sed of cloud-init.prerm.
* adt-buildvm-ubuntu-cloud: Don't try to run "None" if --post-command is not
given.
+ * adt-virt-lxc: Add timeouts to all LXC operations.
-- Martin Pitt <mpitt@debian.org> Tue, 12 Jan 2016 12:08:47 +0100
diff --git a/virt-subproc/adt-virt-lxc b/virt-subproc/adt-virt-lxc
index b0fe8de..76b988e 100755
--- a/virt-subproc/adt-virt-lxc
+++ b/virt-subproc/adt-virt-lxc
@@ -170,7 +170,7 @@ def hook_open():
if shared_dir:
argv += ['--bdir', shared_dir]
argv += ['--orig', args.template] + args.lxcargs
- VirtSubproc.check_exec(sudoify(argv), outp=True)
+ VirtSubproc.check_exec(sudoify(argv), outp=True, timeout=300)
# work around https://launchpad.net/bugs/1367730
VirtSubproc.check_exec(sudoify([
'lxc-attach', '--name', lxc_container_name, '--', 'chmod', 'go+rx', '/']),
@@ -181,7 +181,7 @@ def hook_open():
if VirtSubproc.execute_timeout(None, 10, argv + ['-B', 'btrfs'],
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)[0] != 0:
adtlog.debug('lxc-clone with btrfs backingstore failed, re-trying without')
- VirtSubproc.check_exec(argv, outp=True)
+ VirtSubproc.check_exec(argv, outp=True, timeout=600)
argv = ['lxc-start', '--name', lxc_container_name, '--daemon']
if shared_dir:
argv += ['--define', 'lxc.mount.entry=%s %s none bind,create=dir 0 0' % (shared_dir, shared_dir[1:])]
@@ -229,7 +229,7 @@ def hook_open():
VirtSubproc.auxverb = ['sudo', '--preserve-env'] + VirtSubproc.auxverb
except:
# Clean up on failure
- VirtSubproc.check_exec(sudoify(['lxc-stop', '--kill', '--name', lxc_container_name]))
+ VirtSubproc.check_exec(sudoify(['lxc-stop', '--kill', '--name', lxc_container_name]), timeout=600)
VirtSubproc.execute_timeout(None, 30, sudoify(['lxc-destroy', '--name', lxc_container_name]))
raise
@@ -241,7 +241,7 @@ def hook_downtmp(path):
d = os.path.join(shared_dir, 'downtmp')
# these permissions are ugly, but otherwise we can't clean up files
# written by the testbed when running as user
- VirtSubproc.check_exec(['mkdir', '-m', '777', d], downp=True)
+ VirtSubproc.check_exec(['mkdir', '-m', '777', d], downp=True, timeout=30)
capabilities.append('downtmp-host=' + d)
else:
d = VirtSubproc.downtmp_mktemp(path)
@@ -267,7 +267,7 @@ def hook_cleanup():
VirtSubproc.downtmp_remove()
capabilities = [c for c in capabilities if not c.startswith('downtmp-host')]
- VirtSubproc.check_exec(sudoify(['lxc-stop', '--kill', '--name', lxc_container_name]))
+ VirtSubproc.check_exec(sudoify(['lxc-stop', '--kill', '--name', lxc_container_name]), timeout=600)
# ephemeral containers don't exist at this point any more, so make failure
# non-fatal
(s, o, e) = VirtSubproc.execute_timeout(