From 94ba8aedbcc0ae43278f594ae90473f0ffc22e3a Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Fri, 13 Aug 2010 13:23:19 +0000 Subject: [PATCH] -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 --- xCAT-server/lib/xcat/plugins/kvm.pm | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index 189e4578e..5473a87b7 100644 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -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) {