Revision: 1959
http://xcat.svn.sourceforge.net/xcat/?rev=1959&view=rev
Author: jbjohnso
Date: 2008-07-29 23:32:00 +0000 (Tue, 29 Jul 2008)
Log Message:
-----------
-Fixup domain description XML, and create the VM on power on after updating dhcp configuration
Modified Paths:
--------------
xcat-core/trunk/xCAT-server/lib/xcat/plugins/xen.pm
Modified: xcat-core/trunk/xCAT-server/lib/xcat/plugins/xen.pm
===================================================================
--- xcat-core/trunk/xCAT-server/lib/xcat/plugins/xen.pm 2008-07-29 18:11:52 UTC (rev 1958)
+++ xcat-core/trunk/xCAT-server/lib/xcat/plugins/xen.pm 2008-07-29 23:32:00 UTC (rev 1959)
@@ -31,6 +31,7 @@
my $vmmaxp;
my $mactab;
+my $nrtab;
my $machash;
sub handled_commands {
unless ($libvirtsupport) {
@@ -80,7 +81,11 @@
sub build_diskstruct {
my @returns;
- push @returns,"/cluster2/vm/$node";
+ my $diskhash;
+ $diskhash->{type}='file';
+ $diskhash->{source}->{file}="/cluster2/vm/$node";
+ $diskhash->{target}->{dev}='hda';
+ push @returns,$diskhash;
return \@returns;
}
sub getNodeUUID {
@@ -91,10 +96,11 @@
my $rethash;
my $node = shift;
my @macs=();
- if ($machash->{$node}->{mac}) {
- my $macdata=$machash->{$node}->{mac};
- foreach my $macaddr (split '|',$macdata) {
- $macaddr =~ s/!.*//;
+ print Dumper($machash);
+ if ($machash->{$node}->[0]->{mac}) {
+ my $macdata=$machash->{$node}->[0]->{mac};
+ foreach my $macaddr (split /\|/,$macdata) {
+ $macaddr =~ s/\!.*//;
push @macs,$macaddr;
}
}
@@ -114,6 +120,9 @@
}
my $macstr = sprintf("%04x%08x",$leading,$tail);
$macstr =~ s/(..)(..)(..)(..)(..)(..)/$1:$2:$3:$4:$5:$6/;
+ $mactab->setNodeAttribs($node,{mac=>$macstr});
+ $nrtab->setNodeAttribs($node,{netboot=>'pxe'});
+ $doreq->({command=>['makedhcp'],node=>[$node]});
push @macs,$macstr;
}
my @rethashes;
@@ -144,7 +153,7 @@
$xtree{devices}->{graphics}->{type}='vnc';
$xtree{devices}->{console}->{type}='pty';
$xtree{devices}->{console}->{target}->{port}='1';
- return XMLout(\%xtree);
+ return XMLout(\%xtree,RootName=>"domain");
}
sub power {
@@ -152,6 +161,7 @@
if ($subcommand eq 'on') {
my $xml=build_xmldesc($node);
print $xml;
+ $hypconn->create_domain($xml);
}
}
@@ -261,6 +271,7 @@
}
$vmhash = $vmtab->getNodesAttribs($noderange,['node','host','migrationdest','storage','memory','cpu','nics','bootorder','virtflags']);
$mactab = xCAT::Table->new("mac",-create=>1);
+ $nrtab= xCAT::Table->new("noderes",-create=>1);
$machash = $mactab->getNodesAttribs($noderange,['mac']);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|