From fa59c39e4decfa51f19cca9f1b72f8cc3e8a64f7 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Tue, 20 Oct 2009 01:45:04 +0000 Subject: [PATCH] -Add vmstatenotify command support to allow xVMA to work git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4416 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/kvm.pm | 30 ++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index d39d18b85..7e3e04126 100644 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -62,6 +62,7 @@ sub handled_commands { getrvidparms => 'nodehm:mgt', rbeacon => 'nodehm:mgt', revacuate => 'hypervisor:type', + vmstatenotify => 'hypervisor:type', #rspreset => 'nodehm:mgt', #rspconfig => 'nodehm:mgt', #rbootseq => 'nodehm:mgt', @@ -912,6 +913,33 @@ sub process_request { } my $forcemode = 0; my %orphans=(); + if ($command eq 'vmstatenotify') { + print "I see the command $command ".$exargs[0]." ".$exargs[1]."\n"; + unless ($vmtab) { $vmtab = new xCAT::Table('vm',-create=>1); } + my $state = $exargs[0]; + if ($state eq 'vmoff') { + $vmtab->setNodeAttribs($exargs[1],{powerstate=>'off'}); + print "Completion?\n"; + return; + } elsif ($state eq 'vmon') { + print "Completion?\n"; + $vmtab->setNodeAttribs($exargs[1],{powerstate=>'on'}); + return; + } elsif ($state eq 'hypshutdown') { #turn this into an evacuate + $command="revacuate"; + @exargs=(); + } elsif ($state eq 'hypstartup') { #if starting up, check for nodes on this hypervisor and start them up + my @tents = $vmtab->getAttribs({host=>$noderange->[0],power=>'on'},['node']); + $noderange=[]; + foreach (@tents) { + push @$noderange,noderange($_->{node}); + } + print "I'm thinking about ".$noderange->[0]."\n"; + $command="rpower"; + @exargs=("on"); + } + + } if ($command eq 'revacuate') { my $newnoderange; if (grep { $_ eq '-f' } @exargs) { @@ -971,7 +999,7 @@ sub process_request { my $sitetab = xCAT::Table->new('site'); if ($sitetab) { - my $xhent = $sitetab->getAttribs({key=>usexhrm},['value']); + my $xhent = $sitetab->getAttribs({key=>'usexhrm'},['value']); if ($xhent and $xhent->{value} and $xhent->{value} !~ /no/i and $xhent->{value} !~ /disable/i) { $use_xhrm=1; }