Commit 145fb4c5 authored by Mike Hibler's avatar Mike Hibler
Browse files

Add an argument to downloadImage to say it is loading a disk rather than

writing into a file.
parent d60b9acd
......@@ -372,23 +372,28 @@ sub findBridgeIfaces($) {
# mechanism. Caller provides an imagepath for frisbee, and a hash of args that
# comes directly from loadinfo.
#
sub downloadImage($$) {
my ($imagepath,$reload_args_ref) = @_;
sub downloadImage($$$) {
my ($imagepath,$todisk,$reload_args_ref) = @_;
return -1
if (!defined($imagepath) || !defined($reload_args_ref));
my $addr = $reload_args_ref->{"ADDR"};
my $FRISBEE = "/usr/local/etc/emulab/frisbee";
my $IMAGEUNZIP = "/usr/local/bin/imageunzip";
if ($addr =~/^(\d+\.\d+\.\d+\.\d+):(\d+)$/) {
my $mcastaddr = $1;
my $mcastport = $2;
mysystem("$FRISBEE -m $mcastaddr -p $mcastport $imagepath");
mysystem("$FRISBEE -m $mcastaddr -p $mcastport $imagepath");
}
elsif ($addr =~ /^http/) {
mysystem("wget -nv -N -P -O $imagepath '$addr'");
if ($todisk) {
mysystem("wget -nv -N -P -O - '$addr' | $IMAGEUNZIP - $imagepath");
} else {
mysystem("wget -nv -N -P -O $imagepath '$addr'");
}
}
return 0;
......
......@@ -549,7 +549,7 @@ sub vz_vnodeCreate {
if (!$incache) {
# Now we just download the file, then let create do its normal thing
my $dret = libvnode::downloadImage($imagepath,$reload_args_ref);
my $dret = libvnode::downloadImage($imagepath,0,$reload_args_ref);
# reload has finished, file is written... so let's set its mtime
utime(time(),$reload_args{"IMAGEMTIME"},$imagepath);
......
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