[pve-devel] [PATCH v2 qemu-server 2/2] fix clone_disk failing for nonexistent cloudinit disk
Thomas Lamprecht
t.lamprecht at proxmox.com
Fri Oct 16 15:45:46 CEST 2020
On 06.10.20 13:10, Mira Limbeck wrote:
> On 10/6/20 10:56 AM, Mira Limbeck wrote:
>> On 10/5/20 5:35 PM, Thomas Lamprecht wrote:
>>> On 28.09.20 10:36, Mira Limbeck wrote:
>>>> @@ -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?
>> No, in the cloudinit case we set it to a constant. In the efidisk case we call get_efivars_size() which dies if efivars is not a file, otherwise we get a size (-s). And in the else case we also die if we can't get the size. So size is set in every case before the first use.
> To clarify, the returned size in volume_size_info can be undefined, but not the other 2 cases. Would a die be a good idea in case the volume_size_info call returns 'undef'?
could be, could be possible to assert that in vdisk_alloc, as there
it rather seems that it's assumed to never be undef; but I just checked
the base and ZFS Plugin, so..
More information about the pve-devel
mailing list