Commit 5164a406 authored by Leigh B Stoller's avatar Leigh B Stoller

Bug fixes.

parent b6676b2f
......@@ -9,6 +9,7 @@ use Getopt::Std;
use English;
use Errno;
use Data::Dumper;
use File::Basename;
sub usage()
{
......@@ -92,6 +93,19 @@ close(XM);
# Filled in later.
$xminfo{"disksizes"} = "";
#
# Copy the kernel into the directory and change xminfo.
#
if (-e $xminfo{"kernel"}) {
Fatal($xminfo{"kernel"} . " does not exist");
}
my $kernel = $EXTRAFS;
$kernel .= "/$role" if (defined($role));
$kernel .= "/" . basename($xminfo{"kernel"});
system("cp " . $xminfo{"kernel"} . " $kernel") == 0
or Fatal("Could not copy kernel to $kernel");
$xminfo{"kernel"} = basename($xminfo{"kernel"});
#
# Parse the disk info.
#
......
......@@ -22,6 +22,8 @@ my $debug = 1;
my $infomode = 0;
my $VMPATH = "/var/xen/configs";
my $VGNAME = "xen-vg";
my $IMAGEUNZIP = "/usr/testbed/bin/imageunzip";
my $IMAGEDUMP = "/usr/testbed/bin/imagedump";
#
# Turn off line buffering on output
......@@ -94,9 +96,6 @@ my %diskinfo = ();
my %disksize = ();
foreach my $disk (@$disklist) {
if ($disk =~ /^phy:([^,]*)/) {
if (! -e $1) {
Fatal("$disk does not exist")
}
$diskinfo{$1} = $disk;
}
else {
......@@ -122,7 +121,7 @@ foreach my $physinfo (keys(%diskinfo)) {
$dev = $1;
}
else {
fatal("Could not parse $spec");
Fatal("Could not parse $spec");
}
#
# Figure out the size of the LVM.
......@@ -139,8 +138,8 @@ foreach my $physinfo (keys(%diskinfo)) {
if (! -e $device) {
if (!$infomode) {
system("/usr/sbin/lvcreate -n $lvmname -L $lvmsize $VGNAME") == 0
or fatal("Could not create lvm for $lvmname");
system("lvcreate -n $lvmname -L $lvmsize $VGNAME") == 0
or Fatal("Could not create lvm for $lvmname");
}
}
# Rewrite the diskinfo path for new xm.conf
......@@ -154,8 +153,9 @@ foreach my $physinfo (keys(%diskinfo)) {
#
# Mark it as a linux swap partition.
#
if (system("echo ',,S' | sfdisk $device -N0")) {
fatal("Could not mark $device as linux swap");
if (!$infomode &&
system("echo ',,S' | sfdisk $device -N0")) {
Fatal("Could not mark $device as linux swap");
}
next;
}
......@@ -172,10 +172,10 @@ foreach my $physinfo (keys(%diskinfo)) {
#
my $opts = "-W 256";
if ($infomode) {
system("imagedump $filename");
system("$IMAGEDUMP $filename");
}
else {
system("imageunzip -o $opts $filename $device");
system("$IMAGEUNZIP -o $opts $filename $device");
}
}
......
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