[pve-devel] applied: [PATCH qemu-server] fix #2473: use of unitialized value
Thomas Lamprecht
t.lamprecht at proxmox.com
Thu Nov 21 12:58:24 CET 2019
On 11/21/19 11:04 AM, Mira Limbeck wrote:
> With the noerr flag set in parse_volume_id we have to check if
> $volname is defined before comparing it to 'cloudinit'.
>
> Signed-off-by: Mira Limbeck <m.limbeck at proxmox.com>
> ---
> PVE/API2/Qemu.pm | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
> index 4dd329a..ed4e522 100644
> --- a/PVE/API2/Qemu.pm
> +++ b/PVE/API2/Qemu.pm
> @@ -70,7 +70,7 @@ my $check_storage_access = sub {
> my $volid = $drive->{file};
> my ($storeid, $volname) = PVE::Storage::parse_volume_id($volid, 1);
>
> - if (!$volid || ($volid eq 'none' || $volid eq 'cloudinit' || $volname eq 'cloudinit')) {
> + if (!$volid || ($volid eq 'none' || $volid eq 'cloudinit' || (defined($volname) && $volname eq 'cloudinit'))) {
> # nothing to check
> } elsif ($isCDROM && ($volid eq 'cdrom')) {
> $rpcenv->check($authuser, "/", ['Sys.Console']);
> @@ -148,7 +148,7 @@ my $create_disks = sub {
> if (!$volid || $volid eq 'none' || $volid eq 'cdrom') {
> delete $disk->{size};
> $res->{$ds} = PVE::QemuServer::print_drive($vmid, $disk);
> - } elsif ($volname eq 'cloudinit') {
> + } elsif (defined($volname) && $volname eq 'cloudinit') {
> $storeid = $storeid // $default_storage;
> die "no storage ID specified (and no default storage)\n" if !$storeid;
> my $scfg = PVE::Storage::storage_config($storecfg, $storeid);
>
applied, thanks!
As we had quite some issues, fixes, then regression with those fixes
for the cloudinit stuff, could you please add some tests?
My first idea was to add them to cfg2cmd, mocking the commit_cloudinit_disk
method which save it locally to the test dir as .cloudinit which can then
be compared to an expected file one.. So that we have at least some basic
coverage there..
More information about the pve-devel
mailing list