2009-05-31 18:52:35 +00:00
|
|
|
package xCAT::VMCommon;
|
|
|
|
use strict;
|
|
|
|
#Functions common to virtualization management (KVM, Xen, VMware)
|
|
|
|
sub grab_table_data{ #grab table data relevent to VM guest nodes
|
|
|
|
my $noderange=shift;
|
|
|
|
my $cfghash = shift;
|
|
|
|
my $callback=shift;
|
|
|
|
my $vmtab = xCAT::Table->new("vm");
|
|
|
|
my $hmtab = xCAT::Table->new("nodehm");
|
|
|
|
my $nttab = xCAT::Table->new("nodetype");
|
|
|
|
if ($hmtab) {
|
|
|
|
$cfghash->{nodehm} = $hmtab->getNodesAttribs($noderange,['serialspeed']);
|
|
|
|
}
|
|
|
|
if ($nttab) {
|
2009-06-16 14:34:07 +00:00
|
|
|
$cfghash->{nodetype} = $nttab->getNodesAttribs($noderange,['os','arch']); #allow us to guess RTC config
|
2009-05-31 18:52:35 +00:00
|
|
|
}
|
|
|
|
unless ($vmtab) {
|
|
|
|
$callback->({data=>["Cannot open vm table"]});
|
|
|
|
return;
|
|
|
|
}
|
2009-07-10 19:08:06 +00:00
|
|
|
$cfghash->{vm} = $vmtab->getNodesAttribs($noderange,['node','host','migrationdest','cfgstore','storage','memory','cpus','nics','bootorder','virtflags']);
|
2009-05-31 18:52:35 +00:00
|
|
|
my $mactab = xCAT::Table->new("mac",-create=>1);
|
|
|
|
my $nrtab= xCAT::Table->new("noderes",-create=>1);
|
|
|
|
$cfghash->{mac} = $mactab->getAllNodeAttribs(['mac'],1);
|
|
|
|
my $macs;
|
|
|
|
my $mac;
|
|
|
|
foreach (keys %{$cfghash->{mac}}) {
|
|
|
|
$macs=$cfghash->{mac}->{$_}->[0]->{mac};
|
|
|
|
foreach $mac (split /\|/,$macs) {
|
|
|
|
$mac =~ s/\!.*//;
|
|
|
|
$cfghash->{usedmacs}->{lc($mac)}=1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
1;
|