Skip to contentSkip to conversation

PDU/xenuse: Support xenuse on machine not locked by current user

PATCH In review Ian Campbell 2 participants 3 messages Oct 25, 2013 – Oct 31, 2013

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 PDU/xenuse: Support xenuse on machine not locked by current user

xenuse checks that whoever is trying to reboot a machine "owns" that machine via a locking mechanism. This is usually fine doesn't work well when one wants to book a machine out of the osstest pool for adhoc testing. In this case machine ownership is maintained by osstest ahd the machine remains locked to osstest as far as xenuse is concerned.

Therefore add a global configuration option and perhost override to override $USER (which xenuse obeys) to osstest.
---
v3: Simplified $ENV{USER} frobbing, more idiomatic Perl.
v2: Use "local $ENV{USER}" which contrary to my previous experiments does actually work.

---
 Osstest/PDU/xenuse.pm |    5 +++++
 production-config     |    1 +
 2 files changed, 6 insertions(+)
Osstest/PDU/xenuse.pm +5 -0
index 73a542d..6b0503f 100644
@@ -44,7 +44,12 @@ sub pdu_power_state {
     my ($mo, $on) = @_;
     my $onoff= $on ? "on" : "off";
     my $xenuse= $c{XenUsePath} || "xenuse";
+    my $user= get_host_property($mo->{Host}, "XenUseUser", $c{XenUseUser} || undef);
 
+    (
+	logm("XenUse overriding \$USER to $user"),
+	local $ENV{USER} = $user
+    ) if $user;
     system_checked($xenuse, "--$onoff", "$mo->{Host}{Name}");
 }
 
production-config +1 -0
index de9e55c..fb9d750 100644
@@ -75,6 +75,7 @@ TftpPxeGroup osstest
 TftpDiVersion 2013-09-23
 
 XenUsePath /usr/groups/xencore/systems/bin/xenuse
+XenUseUser osstest
 
 # We use the IP address because Citrix can't manage reliable nameservice
 #DebianMirrorHost debian.uk.xensource.com
Signature · 1 line
1.7.10.4
Acked-by on v3 1/1
#1 lore raw

Ian Campbell writes ("[PATCH OSSTEST v3] PDU/xenuse: Support xenuse on machine not locked by current user"):

Quoted 8 lines

xenuse checks that whoever is trying to reboot a machine "owns" that machine via a locking mechanism. This is usually fine doesn't work well when one wants to book a machine out of the osstest pool for adhoc testing. In this case machine ownership is maintained by osstest ahd the machine remains locked to osstest as far as xenuse is concerned.

Therefore add a global configuration option and perhost override to override $USER (which xenuse obeys) to osstest.

#2 lore raw
Quoted 11 lines · Ian Jackson

Ian Campbell writes ("[PATCH OSSTEST v3] PDU/xenuse: Support xenuse on machine not locked by current user"):

Quoted 8 lines

xenuse checks that whoever is trying to reboot a machine "owns" that machine via a locking mechanism. This is usually fine doesn't work well when one wants to book a machine out of the osstest pool for adhoc testing. In this case machine ownership is maintained by osstest ahd the machine remains locked to osstest as far as xenuse is concerned.

Therefore add a global configuration option and perhost override to override $USER (which xenuse obeys) to osstest.

Thanks. Pushed to pretest.