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

Install phase to get all of the openvz bits into place.

parent 417ca840
# Install openvz support.
use strict;
use libinstall;
use installvars;
use NodeType;
use OSinfo;
use Image;
use EmulabConstants;
my $UTAHURL = "";
my $DESCRIPTORS = "$TOP_SRCDIR/install/descriptors-sh.xml";
sub Install($$$)
my ($server, $isupdate, $impotent) = @_;
# Replace if this script does an update for ip/domain.
return 0
if ($isupdate);
Phase "openvz", "Adding OPENVZ Support", sub {
# Load up the initial descriptors.
# Load up the images from boss.
Phase "descriptors", "Loading the Image and OS IDS", sub {
ExecQuietFatal("cd $TOP_OBJDIR/install; ".
" perl load-descriptors -a $DESCRIPTORS");
foreach my $imagename ($OPENVZIMAGE) {
my $localfile = "$PREFIX/images/${imagename}.ndz";
my $url = "$STDIMAGESURL/${imagename}.ndz";
Phase "$imagename", "Fetching $imagename. Patience!", sub {
FetchFileFatal($url, $localfile);
# Now that OPENVZ-STD is loaded, need to find the nodetype for
# PCVM and link them via the default_osid. We could avoid this by
# creating an xml file for the pcvm nodetype and loading it that
# way instead of as sql in database-fill-supplement.
my $pcvm = NodeType->Lookup("pcvm");
PhaseFail("Could not look up PCVM node type")
if (!defined($pcvm));
my $osinfo = OSinfo->LookupByName("OPENVZ-STD");
PhaseFail("Could not look up OPENVZ-STD osid")
if (!defined($osinfo));
my $nextosinfo = OSinfo->LookupByName($OPENVZIMAGE);
PhaseFail("Could not look up $OPENVZIMAGE osid")
if (!defined($nextosinfo));
Phase "pcvm", "Updating the PCVM node type", sub {
$pcvm->SetAttribute("default_osid", $osinfo->osid()) == 0
or PhaseFail("Could not update the pcvm node type");
Phase "openvz", "Updating the OPENVZ-STD osid", sub {
$osinfo->SetNextOS($nextosinfo) == 0
or PhaseFail("Could not set the nextosid for OPENVZ-STD");
return 0;
# Local Variables:
# mode:perl
# End:
Supports Markdown
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