Added a couple of checks to make sure the vm exists and moved others so they'll be checked less often.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6913 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
cjhardee 2010-07-29 20:03:05 +00:00
parent cd04883b9e
commit b1410412eb

View File

@ -462,10 +462,10 @@ sub inv {
my $hyp = $args{hyp};
if (not defined $args{vmview}) { #attempt one refresh
$args{vmview} = $hyphash{$hyp}->{conn}->find_entity_view(view_type => 'VirtualMachine',properties=>['config.name','runtime.powerState'],filter=>{name=>$node});
}
if (not defined $args{vmview}) {
sendmsg([1,"VM does not appear to exist"],$node);
return;
if (not defined $args{vmview}) {
sendmsg([1,"VM does not appear to exist"],$node);
return;
}
}
my $vmview = $args{vmview};
my $uuid = $vmview->config->uuid;
@ -504,11 +504,11 @@ sub chvm {
$args{vmview} = $hyphash{$hyp}->{conn}->find_entity_view(view_type => 'VirtualMachine',
properties=>['config.name','runtime.powerState'],
filter=>{name=>$node});
}
if (not defined $args{vmview}) {
if (not defined $args{vmview}) {
sendmsg([1,"VM does not appear to exist"],$node);
return;
}
}
}
@ARGV= @{$args{exargs}};
my @deregister;
my @purge;
@ -1203,10 +1203,10 @@ sub rmvm {
my $hyp = $args{hyp};
if (not defined $args{vmview}) { #attempt one refresh
$args{vmview} = $hyphash{$hyp}->{conn}->find_entity_view(view_type => 'VirtualMachine',properties=>['config.name','runtime.powerState'],filter=>{name=>$node});
}
if (not defined $args{vmview}) {
sendmsg([1,"VM does not appear to exist"],$node);
return;
if (not defined $args{vmview}) {
sendmsg([1,"VM does not appear to exist"],$node);
return;
}
}
@ARGV= @{$args{exargs}};
require Getopt::Long;
@ -1286,6 +1286,10 @@ sub power {
my $pretendop = $args{pretendop}; #to pretend a system was on for reset or boot when we have to turn it off internally for reconfig
if (not defined $args{vmview}) { #attempt one refresh
$args{vmview} = $hyphash{$hyp}->{conn}->find_entity_view(view_type => 'VirtualMachine',properties=>['config.name','config','runtime.powerState'],filter=>{name=>$node});
if (not defined $args{vmview}) {
sendmsg([1,"VM does not appear to exist"],$node);
return;
}
}
@ARGV = @{$args{exargs}}; #for getoptions;
my $forceon;
@ -1627,6 +1631,10 @@ sub setboot {
my $hyp = $args{hyp};
if (not defined $args{vmview}) { #attempt one refresh
$args{vmview} = $hyphash{$hyp}->{conn}->find_entity_view(view_type => 'VirtualMachine',properties=>['config.name'],filter=>{name=>$node});
if (not defined $args{vmview}) {
sendmsg([1,"VM does not appear to exist"],$node);
return;
}
}
my $bootorder = ${$args{exargs}}[0];
#NOTE: VMware simply does not currently seem to allow programatically changing the boot