X-Git-Url: https://git.proxmox.com/?p=qemu-server.git;a=blobdiff_plain;f=PVE%2FQemuServer.pm;h=76146ca22f43d5ae31e60d9aa77d02d53f8625cd;hp=5cf04e6ae6be9cdb6934c5982cc5b97efa5a58b5;hb=bdd1feef5bf74176fc4591a0fee4a530abb1e666;hpb=b85666cf7f02561785711956b3d9385c6cc60ccf diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 5cf04e6..76146ca 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -5506,11 +5506,13 @@ sub vm_start { property => "guest-stats-polling-interval", value => 2) if (!defined($conf->{balloon}) || $conf->{balloon}); - if ($is_suspended && (my $vmstate = $conf->{vmstate})) { + if ($is_suspended) { print "Resumed VM, removing state\n"; + if (my $vmstate = $conf->{vmstate}) { + PVE::Storage::deactivate_volumes($storecfg, [$vmstate]); + PVE::Storage::vdisk_free($storecfg, $vmstate); + } delete $conf->@{qw(lock vmstate runningmachine)}; - PVE::Storage::deactivate_volumes($storecfg, [$vmstate]); - PVE::Storage::vdisk_free($storecfg, $vmstate); PVE::QemuConfig->write_config($vmid, $conf); } @@ -6720,7 +6722,7 @@ sub qemu_img_convert { my $cachemode; my $src_path; my $src_is_iscsi = 0; - my $src_format = 'raw'; + my $src_format; if ($src_storeid) { PVE::Storage::activate_volumes($storecfg, [$src_volid], $snapname); @@ -6745,14 +6747,15 @@ sub qemu_img_convert { my $cmd = []; push @$cmd, '/usr/bin/qemu-img', 'convert', '-p', '-n'; - push @$cmd, '-l', "snapshot.name=$snapname" if($snapname && $src_format eq "qcow2"); + push @$cmd, '-l', "snapshot.name=$snapname" + if $snapname && $src_format && $src_format eq "qcow2"; push @$cmd, '-t', 'none' if $dst_scfg->{type} eq 'zfspool'; push @$cmd, '-T', $cachemode if defined($cachemode); if ($src_is_iscsi) { push @$cmd, '--image-opts'; $src_path = convert_iscsi_path($src_path); - } else { + } elsif ($src_format) { push @$cmd, '-f', $src_format; } @@ -7076,8 +7079,9 @@ sub create_efidisk($$$$$) { PVE::Storage::activate_volumes($storecfg, [$volid]); qemu_img_convert($ovmf_vars, $volid, $vars_size_b, undef, 0); + my ($size) = PVE::Storage::volume_size_info($storecfg, $volid, 3); - return ($volid, $vars_size); + return ($volid, $size/1024); } sub vm_iothreads_list {