-Have chvm properly update tables if set
-Skip check for reconfig if no table values for cpus/memory exist git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7498 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
38538fc07c
commit
e58a2df6a7
@ -713,9 +713,9 @@ sub chvm {
|
||||
#xCAT::SvrUtils::sendmsg("reconfigspec = ".Dumper($reconfigspec));
|
||||
my $task = $vmview->ReconfigVM_Task(spec=>$reconfigspec);
|
||||
$running_tasks{$task}->{task} = $task;
|
||||
$running_tasks{$task}->{callback} = \&generic_task_callback;
|
||||
$running_tasks{$task}->{callback} = \&chvm_task_callback;
|
||||
$running_tasks{$task}->{hyp} = $hyp;
|
||||
$running_tasks{$task}->{data} = { node => $node, successtext => "node successfully changed" };
|
||||
$running_tasks{$task}->{data} = { node => $node, successtext => "node successfully changed",cpus=>$cpuCount,mem=>$memory };
|
||||
|
||||
}
|
||||
|
||||
@ -1076,6 +1076,29 @@ sub poweron_task_callback {
|
||||
}
|
||||
|
||||
}
|
||||
sub chvm_task_callback {
|
||||
my $task = shift;
|
||||
my $parms = shift;
|
||||
my $state = $task->info->state->val;
|
||||
my $node = $parms->{node};
|
||||
my $intent = $parms->{successtext};
|
||||
if ($state eq 'success') {
|
||||
my $updatehash;
|
||||
if ($parms->{cpus} and $tablecfg{vm}->{$node}->[0]->{cpus}) { #need to update
|
||||
$updatehash->{cpus}=$parms->{cpus};
|
||||
}
|
||||
if ($parms->{mem} and $tablecfg{vm}->{$node}->[0]->{memory}) { #need to update
|
||||
$updatehash->{memory}=$parms->{mem};
|
||||
}
|
||||
if ($updatehash) {
|
||||
my $vmtab = xCAT::Table->new('vm',-create=>1);
|
||||
$vmtab->setNodeAttribs($node,$updatehash);
|
||||
}
|
||||
xCAT::SvrUtils::sendmsg($intent, $output_handler,$node);
|
||||
} elsif ($state eq 'error') {
|
||||
relay_vmware_err($task,"",$node);
|
||||
}
|
||||
}
|
||||
sub generic_task_callback {
|
||||
my $task = shift;
|
||||
my $parms = shift;
|
||||
@ -1271,7 +1294,7 @@ sub getreconfigspec {
|
||||
$conargs{guestId}=$rightid;
|
||||
}
|
||||
my $newmem;
|
||||
if ($newmem = getUnits($tablecfg{vm}->{$node}->[0]->{memory},"M",1048576)) {
|
||||
if ($tablecfg{vm}->{$node}->[0]->{memory} and $newmem = getUnits($tablecfg{vm}->{$node}->[0]->{memory},"M",1048576)) {
|
||||
my $currmem = $vmview->{'config.hardware.memoryMB'};
|
||||
if ($newmem ne $currmem) {
|
||||
$conargs{memoryMB} = $newmem;
|
||||
@ -1279,7 +1302,7 @@ sub getreconfigspec {
|
||||
}
|
||||
}
|
||||
my $newcpus;
|
||||
if ($newcpus = $tablecfg{vm}->{$node}->[0]->{cpus}) {
|
||||
if ($tablecfg{vm}->{$node}->[0]->{cpus} and $newcpus = $tablecfg{vm}->{$node}->[0]->{cpus}) {
|
||||
my $currncpu = $vmview->{'config.hardware.numCPU'};
|
||||
if ($newcpus ne $currncpu) {
|
||||
$conargs{numCPUs} = $newcpus;
|
||||
|
Loading…
Reference in New Issue
Block a user