-Implement kvm plugin lsvm command

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7086 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2010-08-13 13:23:19 +00:00
parent d85478a0aa
commit 94ba8aedbc

View File

@ -70,6 +70,7 @@ sub handled_commands {
#rvitals => 'nodehm:mgt',
#rinv => 'nodehm:mgt',
getrvidparms => 'nodehm:mgt',
lsvm => 'hypervisor:type',
rbeacon => 'nodehm:mgt',
revacuate => 'hypervisor:type',
vmstatenotify => 'hypervisor:type',
@ -1095,6 +1096,16 @@ sub power {
return (0,$retstring);
}
sub lsvm {
my $node = shift;
my @doms = $hypconn->list_domains();
my @vms;
foreach (@doms) {
push @vms,$_->get_name();
}
return (0,@vms);
}
sub guestcmd {
$hyp = shift;
@ -1114,6 +1125,8 @@ sub guestcmd {
return getrvidparms($node,@args);
} elsif ($command eq "getcons") {
return getcons($node,@args);
} elsif ($command eq "lsvm") {
return lsvm($node,@args);
}
=cut
} elsif ($command eq "rvitals") {
@ -1401,11 +1414,15 @@ sub process_request {
my $inputs = new IO::Select;;
my $sub_fds = new IO::Select;
%hyphash=();
foreach (keys %{$confdata->{vm}}) {
if ($confdata->{vm}->{$_}->[0]->{host}) {
$hyphash{$confdata->{vm}->{$_}->[0]->{host}}->{nodes}->{$_}=1;
} else {
$orphans{$_}=1;
if ($command eq 'lsvm') { #command intended for hypervisors, not guests
foreach(@$noderange) { $hyphash{$_}->{nodes}->{$_}=1; }
} else {
foreach (keys %{$confdata->{vm}}) {
if ($confdata->{vm}->{$_}->[0]->{host}) {
$hyphash{$confdata->{vm}->{$_}->[0]->{host}}->{nodes}->{$_}=1;
} else {
$orphans{$_}=1;
}
}
}
if (keys %orphans) {