Skip to contentSkip to conversation

apt: lock osstest's usages of apt-get against each other

PATCH In review Ian Campbell 3 participants 5 messages Apr 23, 2014 – Apr 30, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 apt: lock osstest's usages of apt-get against each other

From: Ian Campbell <[email protected]>

Currently we rely on all apt-get invocations being in a single ts-xen-build-prep job which can't run on a shared host.

That is a bit inflexible so instead use our own lock. We wait indefinitely and rely on osstest's existing command timeout infrastructure to catch problems.

target_install_packages*() previous estimated the time taken to install the packages based on the number of packages. This no longer applies because the install might get stuck behind some other large install. Use a 3000s (nearly an hour) timeout instead (I expect failures here to be unusual so erred on the big side)

---
 Osstest/Debian.pm      | 2 +-
 Osstest/TestSupport.pm | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)
Osstest/Debian.pm +1 -1
index 059858e..0f7bb85 100644
@@ -493,7 +493,7 @@ d-i apt-setup/another boolean false
 d-i apt-setup/non-free boolean false
 d-i apt-setup/contrib boolean false
 
-d-i pkgsel/include string openssh-server, ntp, ntpdate, $extra_packages
+d-i pkgsel/include string openssh-server, ntp, ntpdate, chiark-utils-bin, $extra_packages
 
 $xopts{ExtraPreseed}
 
Osstest/TestSupport.pm +4 -3
index 461fe63..d49ff4f 100644
@@ -430,17 +430,18 @@ sub target_putfile_root ($$$$;$) {
 sub target_run_apt {
     my ($ho, $timeout, @aptopts) = @_;
     target_cmd_root($ho,
-   "DEBIAN_PRIORITY=critical UCF_FORCE_CONFFOLD=y apt-get @aptopts",
+   "DEBIAN_PRIORITY=critical UCF_FORCE_CONFFOLD=y \
+        with-lock-ex -w /var/lock/osstest-apt apt-get @aptopts",
                     $timeout);
 }
 sub target_install_packages {
     my ($ho, @packages) = @_;
-    target_run_apt($ho, 300 + 100 * @packages,
+    target_run_apt($ho, 3000,
 		   qw(-y install), @packages);
 }
 sub target_install_packages_norec {
     my ($ho, @packages) = @_;
-    target_run_apt($ho, 300 + 100 * @packages,
+    target_run_apt($ho, 3000,
 		   qw(--no-install-recommends -y install), @packages);
 }
 
Signature · 1 line
1.9.0
#1 lore raw
Quoted 8 lines · Ian Campbell

From: Ian Campbell <[email protected]>

Currently we rely on all apt-get invocations being in a single ts-xen-build-prep job which can't run on a shared host.

That is a bit inflexible so instead use our own lock. We wait indefinitely and rely on osstest's existing command timeout infrastructure to catch problems.

Quoted 7 lines

target_install_packages*() previous estimated the time taken to install the packages based on the number of packages. This no longer applies because the install might get stuck behind some other large install. Use a 3000s (nearly an hour) timeout instead (I expect failures here to be unusual so erred on the big side)

I would have sworn I had sent this out already, but I can't see any sign of it... I've been testing this along with my libvirt patch, although it doesn't strictly depend on it.

Quoted 44 lines
---
 Osstest/Debian.pm      | 2 +-
 Osstest/TestSupport.pm | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)
Osstest/Debian.pm +1 -1
index 059858e..0f7bb85 100644
@@ -493,7 +493,7 @@ d-i apt-setup/another boolean false
 d-i apt-setup/non-free boolean false
 d-i apt-setup/contrib boolean false
 
-d-i pkgsel/include string openssh-server, ntp, ntpdate, $extra_packages
+d-i pkgsel/include string openssh-server, ntp, ntpdate, chiark-utils-bin, $extra_packages
 
 $xopts{ExtraPreseed}
 
Osstest/TestSupport.pm +4 -3
index 461fe63..d49ff4f 100644
@@ -430,17 +430,18 @@ sub target_putfile_root ($$$$;$) {
 sub target_run_apt {
     my ($ho, $timeout, @aptopts) = @_;
     target_cmd_root($ho,
-   "DEBIAN_PRIORITY=critical UCF_FORCE_CONFFOLD=y apt-get @aptopts",
+   "DEBIAN_PRIORITY=critical UCF_FORCE_CONFFOLD=y \
+        with-lock-ex -w /var/lock/osstest-apt apt-get @aptopts",
                     $timeout);
 }
 sub target_install_packages {
     my ($ho, @packages) = @_;
-    target_run_apt($ho, 300 + 100 * @packages,
+    target_run_apt($ho, 3000,
 		   qw(-y install), @packages);
 }
 sub target_install_packages_norec {
     my ($ho, @packages) = @_;
-    target_run_apt($ho, 300 + 100 * @packages,
+    target_run_apt($ho, 3000,
 		   qw(--no-install-recommends -y install), @packages);
 }
 
#2 lore raw
In reply to Ian Campbell

Ian Campbell writes ("[PATCH osstest] apt: lock osstest's usages of apt-get against each other"):

Quoted 4 lines

From: Ian Campbell <[email protected]>

Currently we rely on all apt-get invocations being in a single ts-xen-build-prep job which can't run on a shared host.

...

Osstest/TestSupport.pm sub target_putfile_root ($$$$;$) { · line 431

Quoted 3 lines
Osstest/TestSupport.pm +0 -0
@@ -430,17 +430,18 @@ sub target_putfile_root ($$$$;$) {
 sub target_run_apt {
     my ($ho, $timeout, @aptopts) = @_;

I think this needs to lose the timeout option completely. If some new caller were to come along and call "apt-get moo", it ought not to be expected to pass a timeout. If it did it would pass 30, one would expect, but of course it might end up blocked behind a long run.

Ian.

#3 lore raw
Quoted 6 lines · Ian Jackson

Ian Campbell writes ("[PATCH osstest] apt: lock osstest's usages of apt-get against each other"):

Quoted 4 lines

From: Ian Campbell <[email protected]>

Currently we rely on all apt-get invocations being in a single ts-xen-build-prep job which can't run on a shared host.

...

Quoted 8 lines

Osstest/TestSupport.pm sub target_putfile_root ($$$$;$) { · line 431

Quoted 3 lines
Osstest/TestSupport.pm +0 -0
@@ -430,17 +430,18 @@ sub target_putfile_root ($$$$;$) {
 sub target_run_apt {
     my ($ho, $timeout, @aptopts) = @_;

I think this needs to lose the timeout option completely. If some new caller were to come along and call "apt-get moo", it ought not to be expected to pass a timeout. If it did it would pass 30, one would expect, but of course it might end up blocked behind a long run.

I think you mean this function should just pick a suitably large timeout for everything, rather than have no timeout at all, is that right?

Ian.

#4 lore raw

Ian Campbell writes ("Re: [PATCH osstest] apt: lock osstest's usages of apt-get against each other"):

Quoted 8 lines · Ian Jackson
Quoted 4 lines

I think this needs to lose the timeout option completely. If some new caller were to come along and call "apt-get moo", it ought not to be expected to pass a timeout. If it did it would pass 30, one would expect, but of course it might end up blocked behind a long run.

I think you mean this function should just pick a suitably large timeout for everything, rather than have no timeout at all, is that right?

Exactly.

Ian.