-Make persistent UUIDs for KVM guests

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6141 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2010-05-16 23:03:33 +00:00
parent 64150e6b9a
commit 247849065d
3 changed files with 12 additions and 3 deletions

View File

@ -746,7 +746,7 @@ switch => {
},
},
vpd => {
cols => [qw(node serial mtm side asset comments disable)],
cols => [qw(node serial mtm side asset uuid comments disable)],
keys => [qw(node)],
table_desc => 'The Machine type, Model, and Serial numbers of each node.',
descriptions => {
@ -755,6 +755,7 @@ vpd => {
mtm => 'The machine type and model number of the node. E.g. 7984-6BU',
side => 'The side information for the BPA/FSP',
asset => 'A field for administators to use to correlate inventory numbers they may have to accomodate',
uuid => 'The UUID applicable to the node',
comments => 'Any user-written notes.',
disable => "Set to 'yes' or '1' to comment out this row.",
},

View File

@ -7,6 +7,7 @@ sub grab_table_data{ #grab table data relevent to VM guest nodes
my $cfghash = shift;
my $callback=shift;
my $vmtab = xCAT::Table->new("vm");
my $vpdtab = xCAT::Table->new("vpd");
my $hmtab = xCAT::Table->new("nodehm");
my $nttab = xCAT::Table->new("nodetype");
my $sitetab = xCAT::Table->new("site");
@ -21,6 +22,9 @@ sub grab_table_data{ #grab table data relevent to VM guest nodes
$callback->({data=>["Cannot open vm table"]});
return;
}
if ($vpdtab) {
$cfghash->{vpd} = $vpdtab->getNodesAttribs($noderange,['uuid']);
}
$cfghash->{vm} = $vmtab->getNodesAttribs($noderange,['node','host','migrationdest','cfgstore','storage','memory','cpus','nics','bootorder','virtflags']);
my $mactab = xCAT::Table->new("mac",-create=>1);
my $nrtab= xCAT::Table->new("noderes",-create=>1);

View File

@ -213,14 +213,18 @@ sub build_diskstruct {
}
sub getNodeUUID {
my $node = shift;
if ($confdata->{vpd}->{$node}->[0] and $confdata->{vpd}->{$node}->[0]->{uuid}) {
return $confdata->{vpd}->{$node}->[0]->{uuid};
}
if ($confdata->{mac}->{$node}->[0]) { #a uuidv1 is possible, generate that for absolute uniqueness guarantee
my $mac = ($confdata->{mac}->{$node}->[0];
$mac =~ s/\|.*//;
$mac =~ s/!.*//;
return xCAT::Utils::genUUID(mac=>$mac);
$updatetable->{vpd}->{$node}={uuid=>xCAT::Utils::genUUID(mac=>$mac)};
} else {
return xCAT::Utils::genUUID();
$updatetable->{vpd}->{$node}={uuid=>xCAT::Utils::genUUID()};
}
return $updatetable->{vpd}->{$node};
}
sub build_nicstruct {