Commit a76fc359 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Add XEN knobs:

    <sliver_type name="emulab-xen">
      <emulab:xen cores="1" ram="512" disk="8"/>
    </sliver_type>

We currently ignore cores ... Ram in MB, disk in GB.
parent 1401c477
......@@ -917,6 +917,7 @@ sub GetTicketAuxAux($$$$$$$$$)
my $node;
my $isbridge = 0;
my $isfirewall = 0;
my $xensettings;
if (exists($nodeexistsmap{lc($node_nickname)})) {
$response =
......@@ -1056,6 +1057,12 @@ sub GetTicketAuxAux($$$$$$$$$)
# Allow for url above.
$osname = "XEN-STD";
}
#
# Look for the knobs
#
if (GeniXML::HasXenSettings($ref)) {
$xensettings = GeniXML::GetXenSettings($ref);
}
}
elsif ($virtualization_subtype eq "emulab-spp") {
$osname = "SPPVM-FAKE";
......@@ -1441,6 +1448,36 @@ sub GetTicketAuxAux($$$$$$$$$)
# Grab the type object for later.
"nodetype" => NodeType->Lookup($pctype),
};
if (defined($xensettings)) {
print STDERR "foo\n";
print STDERR Dumper($xensettings);
foreach my $setting (keys(%$xensettings)) {
my $attrvalue = $xensettings->{$setting};
my $attrkey;
if ($attrvalue !~ /^\d*$/) {
$response =
GeniResponse->Create(GENIRESPONSE_BADARGS, undef,
"Bad XEN setting; integers only");
goto bad;
}
if ($setting eq "ram") {
$attrkey = "XEN_MEMSIZE";
}
elsif ($setting eq "cores") {
$attrkey = "XEN_CORES";
}
elsif ($setting eq "disk") {
$attrkey = "XEN_EXTRAFS";
}
$virtexperiment->NewTableRow("virt_node_attributes",
{"vname" => $node_nickname,
"attrkey" => $attrkey,
"attrvalue" => $attrvalue });
}
}
#
# Look for interface forward declarations that will be used later
......
......@@ -46,6 +46,7 @@ GetDiskImage IsUntaggedLan IsTaggedLan GetHopLinkID GetCapabilitySection
GetSuggestedVlanFromHop SetVlanTagInHop);
use English;
use Data::Dumper;
use XML::LibXML;
use XML::LibXML::XPathContext;
use XML::LibXML::NodeList;
......@@ -706,6 +707,45 @@ sub GetDelayPipes($)
return @result;
}
sub HasXenSettings($)
{
my ($node) = @_;
my $type = FindFirst("n:sliver_type", $node);
if (defined($type)) {
my $settings = FindNodesNS("n:xen", $type, $EMULAB_NS)->pop();
return 1
if (defined($settings));
}
return 0;
}
sub GetXenSettings($)
{
my ($node) = @_;
my $result = {};
my $type = FindFirst("n:sliver_type", $node);
return undef
if (!defined($type));
my $settings = FindNodesNS("n:xen", $type, $EMULAB_NS)->pop();
return undef
if (!defined($settings));
my $tmp = GetText("cores", $settings);
$result->{"cores"} = $tmp
if (defined($tmp));
$tmp = GetText("ram", $settings);
$result->{"ram"} = $tmp
if (defined($tmp));
$tmp = GetText("disk", $settings);
$result->{"disk"} = $tmp
if (defined($tmp));
return $result;
}
sub HasTagSetting($)
{
my ($link) = @_;
......
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