[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH OSSTEST v2] PDU/xenuse: Support xenuse on machine not locked by current user



On Mon, 2013-10-21 at 10:44 +0100, Ian Jackson wrote:
> Ian Campbell writes ("[PATCH OSSTEST v2] 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.
> ...
> > +    my $user= $c{XenUseUser} || undef;
> > +    $user= get_host_property($mo->{Host}, "XenUseUser", $user);
> 
> I'm not sure what's wrong with:
> 
>     my $user= get_host_property($mo->{Host}, "XenUseUser",
>                                 $c{XenUseUser} || undef $user);
> 
> ?

I just don't think like a Perl programmer ;-)

> > +    local $ENV{USER} = $ENV{USER};
> 
> If USER isn't in the environment, this will set it to an empty value.

Ah yes. I was trying to work around the fact that "local $ENV{USER}" by
itself would clear any existing $USER but didn't think this through.

> If you use the suffix if, you don't get a { } which limits the scope
> of local:
> 
>      ( logm("XenUse overriding \$USER to $user"),
>        local $ENV{USER} = $user )
>          if $user;
> 
> perhaps.

I was trying to avoid the double "if $user", this looks like it might
work. I'll try it.

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.