-Have rpower reset on Xen act more like a baremetal server
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2618 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
d6988ca2f0
commit
9500ff045a
@ -400,6 +400,22 @@ sub getpowstate {
|
||||
}
|
||||
}
|
||||
|
||||
sub makedom {
|
||||
my $node=shift;
|
||||
my $dom;
|
||||
my $xml=build_xmldesc($node);
|
||||
my $errstr;
|
||||
eval { $dom=$hypconn->create_domain($xml); };
|
||||
if ($@) { $errstr = $@; }
|
||||
if (ref $errstr) {
|
||||
$errstr = ":".$errstr->{message};
|
||||
}
|
||||
if ($errstr) { return (undef,$errstr); }
|
||||
if ($dom) {
|
||||
refresh_vm($dom);
|
||||
}
|
||||
return $dom;
|
||||
}
|
||||
|
||||
|
||||
sub power {
|
||||
@ -418,20 +434,11 @@ sub power {
|
||||
$subcommand="reset";
|
||||
}
|
||||
}
|
||||
my $errstr;
|
||||
if ($subcommand eq 'on') {
|
||||
unless ($dom) {
|
||||
my $xml=build_xmldesc($node);
|
||||
my $errstr;
|
||||
eval { $dom=$hypconn->create_domain($xml); };
|
||||
|
||||
if ($@) { $errstr = $@; }
|
||||
if (ref $errstr) {
|
||||
$errstr = ":".$errstr->{message};
|
||||
}
|
||||
$dom,$errstr = makedom($node);
|
||||
if ($errstr) { return (1,$errstr); }
|
||||
if ($dom) {
|
||||
refresh_vm($dom);
|
||||
}
|
||||
} else {
|
||||
$retstring .= " $status_noop";
|
||||
}
|
||||
@ -445,8 +452,9 @@ sub power {
|
||||
} else { $retstring .= " $status_noop"; }
|
||||
} elsif ($subcommand eq 'reset') {
|
||||
if ($dom) {
|
||||
$dom->reboot(1); #TODO: Sys::Virt *nor* libvirt have meaningful flags,
|
||||
#but require it
|
||||
$dom->destroy();
|
||||
$dom = makedom($node);
|
||||
if ($errstr) { return (1,$errstr); }
|
||||
$retstring.="reset";
|
||||
} else { $retstring .= " $status_noop"; }
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user