[pve-devel] [PATCH v2 qemu-server 2/2] fix clone_disk failing for nonexistent cloudinit disk
Thomas Lamprecht
t.lamprecht at proxmox.com
Mon Oct 5 17:35:04 CEST 2020
On 28.09.20 10:36, Mira Limbeck wrote:
> After migration or a rollback the cloudinit disk might not be allocated, so
> volume_size_info() fails. As we override the value anyway for cloudinit
> and efi disks simply move the volume_size_info() call into the 'else'
> branch.
>
> Signed-off-by: Mira Limbeck <m.limbeck at proxmox.com>
> ---
> v2: changed subject
>
> PVE/QemuServer.pm | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 2747c66..49765b7 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -6895,10 +6895,10 @@ sub clone_disk {
> $storeid = $storage if $storage;
>
> my $dst_format = resolve_dst_disk_format($storecfg, $storeid, $volname, $format);
> - my ($size) = PVE::Storage::volume_size_info($storecfg, $drive->{file}, 3);
>
> print "create full clone of drive $drivename ($drive->{file})\n";
> my $name = undef;
> + my $size = undef;
> if (drive_is_cloudinit($drive)) {
> $name = "vm-$newvmid-cloudinit";
> $name .= ".$dst_format" if $dst_format ne 'raw';
> @@ -6906,6 +6906,8 @@ sub clone_disk {
> $size = PVE::QemuServer::Cloudinit::CLOUDINIT_DISK_SIZE;
> } elsif ($drivename eq 'efidisk0') {
> $size = get_efivars_size($conf);
> + } else {
> + ($size) = PVE::Storage::volume_size_info($storecfg, $drive->{file}, 3);
> }
> $size /= 1024;
doesn't this logs a "use of undefined value in division" or something like that
somewhere in the non-else case?
> $newvolid = PVE::Storage::vdisk_alloc($storecfg, $storeid, $newvmid, $dst_format, $name, $size);
>
More information about the pve-devel
mailing list