Commit 3bc1caa8 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Do not put per-type pcvm entries (pcvm850,) into the node_auxtypes

table. Just put the pcvm:count entry in, and have ptopgen generate
the other names. This made it easier to fix ptopgen to subtract the
number of existing VMs on shared nodes.
parent 96518d62
#
# Remove extraneous pcvm types; now added by ptopgen
#
use strict;
use libdb;
sub DoUpdate($$$)
{
DBQueryFatal("delete node_auxtypes.* from node_auxtypes ".
"left join node_types_auxtypes on ".
" node_auxtypes.type=node_types_auxtypes.auxtype ".
"where node_types_auxtypes.type='pcvm'");
return 0;
}
1;
...@@ -846,14 +846,30 @@ foreach $node (keys(%nodes)) { ...@@ -846,14 +846,30 @@ foreach $node (keys(%nodes)) {
if ($typemap{$realtype}->{'ISVIRT'} && $count > 0) { if ($typemap{$realtype}->{'ISVIRT'} && $count > 0) {
next next
if (! $virtstuff); if (! $virtstuff);
if (defined($mfactor) && $mfactor <= $count) { #
$auxinfo = "$auxtype:$mfactor"; # If the node is shared, must subtract the current global count
# from the max first, to see if there is any room left.
#
if ($sharing_mode{$node} && exists($globalcounts{$node})) {
$count -= $globalcounts{$node};
} }
else { if (defined($mfactor) && $mfactor <= $count) {
$auxinfo = "$auxtype:$count"; $count = $mfactor;
} }
$auxinfo = "$auxtype:$count";
$needvirtgoo = 1; $needvirtgoo = 1;
#
# Add in machine specific auxtypes that use the same count.
#
push(@types, "${type}-vm:$count");
# And a legacy type.
my $legacy_type = $type;
if (($legacy_type =~ s/pc/pcvm/)) {
push(@types, "${legacy_type}:$count");
}
} }
push(@types, $auxinfo); push(@types, $auxinfo);
} }
......
...@@ -427,14 +427,8 @@ NODE: foreach my $node_id (@node_ids) { ...@@ -427,14 +427,8 @@ NODE: foreach my $node_id (@node_ids) {
# Add some vnodes # Add some vnodes
# #
if (defined $nodenum && ($role eq "testnode")) { if (defined $nodenum && ($role eq "testnode")) {
my $vtype = $type;
if (!($vtype =~ s/pc/pcvm/)) {
$vtype = "$vtype-vm";
}
DBQueryFatal("INSERT INTO node_auxtypes set node_id='$node_id', " . DBQueryFatal("INSERT INTO node_auxtypes set node_id='$node_id', " .
"type='pcvm', count=$virtnode_capacity"); "type='pcvm', count=$virtnode_capacity");
DBQueryFatal("INSERT INTO node_auxtypes set node_id='$node_id', " .
"type='$vtype', count=$virtnode_capacity");
} }
while (my ($card, $aref) = each %interfaces) { while (my ($card, $aref) = each %interfaces) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment