Commit 4f391d6b authored by Leigh Stoller's avatar Leigh Stoller

Fix bitrot in time for GEC16.

parent c44a928e
#!/usr/bin/perl -w
#
# Copyright (c) 2000-2012 University of Utah and the Flux Group.
# Copyright (c) 2000-2013 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -59,6 +59,7 @@ $| = 1;
use libsetup;
use libutil;
use libtestbed;
use libvnode_openvz;
#
# Parse command arguments. Once we return from getopts, all that should be
......@@ -85,9 +86,9 @@ if (defined($options{"r"})) {
}
my $imagename = $ARGV[0];
# See libvnode_openvz ...
my $imagelockpath = "/var/emulab/db/openvz.image.$imagename.ready";
my $imagelockname = "vzimage.$imagename";
my $imagepath = "/vz/template/cache/${imagename}.tar.gz";
my $imagelvmname = "image+" . $imagename;
my $imagelvmpath = libvnode_openvz::lvmVolumePath($imagelvmname);
if ((my $locked = TBScriptLock($imagelockname,
TBSCRIPTLOCK_GLOBALWAIT(), 1800))
......@@ -124,10 +125,10 @@ my $lvsize;
if ($size) {
$lvsize = "$size" . "G";
}
elsif (-e "/dev/openvz/$imagename") {
$lvsize = `lvs /dev/openvz/$imagename --noheadings -o lv_size`;
elsif (-e $imagelvmpath) {
$lvsize = `lvs $imagelvmpath --noheadings -o lv_size`;
if ($?) {
die("Could not get lv size of /dev/openvz/imagename\n");
die("Could not get lv size of $imagelvmpath\n");
}
chomp($lvsize);
}
......@@ -151,15 +152,9 @@ while ($count > 0) {
if (! -e "/mnt/$cachename");
mysystem("mount /dev/openvz/$cachename /mnt/$cachename");
mysystem("mkdir -p /mnt/$cachename/root /mnt/$cachename/private");
if (! -e "/mnt/$imagename/private") {
# Backwards compat.
mysystem("tar -xzf $imagepath -C /mnt/$cachename/private");
}
else {
mysystem("cd /mnt/$imagename/private; ".
"tar -b 64 -cf - . | ".
"tar -b 64 -xf - -C /mnt/$cachename/private");
}
mysystem("cd /mnt/$imagename/private; ".
"tar -b 64 -cf - . | ".
"tar -b 64 -xf - -C /mnt/$cachename/private");
mysystem("umount /mnt/$cachename");
$idx++;
$count--;
......
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