-Accept -/+ incremental values for cpu/memory/disk size change requests
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6400 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
95aa4d0a60
commit
79fe5c73ec
@ -506,7 +506,7 @@ sub chvm {
|
||||
"p=s" => \@purge,
|
||||
"a=s" => \@add,
|
||||
"resize=s%" => \%resize,
|
||||
"cpus=i" => \$cpuCount,
|
||||
"cpus=s" => \$cpuCount,
|
||||
"mem=s" => \$memory
|
||||
);
|
||||
$SIG{__WARN__} = 'DEFAULT';
|
||||
@ -531,11 +531,22 @@ sub chvm {
|
||||
|
||||
my %conargs;
|
||||
if($cpuCount) {
|
||||
if ($cpuCount =~ /^\+(\d+)/) {
|
||||
$cpuCount = $vmview->config->hardware->numCPU+$1;
|
||||
} elsif ($cpuCount =~ /^-(\d+)/) {
|
||||
$cpuCount = $vmview->config->hardware->numCPU-$1;
|
||||
}
|
||||
$conargs{numCPUs} = $cpuCount;
|
||||
}
|
||||
|
||||
if($memory) {
|
||||
$conargs{memoryMB} = getUnits($memory, "M", 1048576);
|
||||
if ($memory =~ /^\+(.+)/) {
|
||||
$conargs{memoryMB} = $vmview->config->hardware->memoryMB + getUnits($1,"M",1048576);
|
||||
} elsif ($memory =~ /^-(\d+)/) {
|
||||
$conargs{memoryMB} = $vmview->config->hardware->memoryMB - getUnits($1,"M",1048576);
|
||||
} else {
|
||||
$conargs{memoryMB} = getUnits($memory, "M", 1048576);
|
||||
}
|
||||
}
|
||||
|
||||
my $disk;
|
||||
@ -614,7 +625,11 @@ sub chvm {
|
||||
sendmsg([1,"Disk: $disk does not exist"],$node);
|
||||
return;
|
||||
}
|
||||
$value = getUnits($value, "G", 1024);
|
||||
if ($value =~ /^\+(.+)/) {
|
||||
$value = $device->capacityInKB + getUnits($1,"G",1024);
|
||||
} else {
|
||||
$value = getUnits($value, "G", 1024);
|
||||
}
|
||||
my $newDevice = VirtualDisk->new(deviceInfo => $device->deviceInfo,
|
||||
key => $device->key,
|
||||
controllerKey => $device->controllerKey,
|
||||
|
Loading…
Reference in New Issue
Block a user