[pve-devel] applied: [PATCH qemu-server] update_vm: check whether opt is set before deleting
Wolfgang Bumiller
w.bumiller at proxmox.com
Thu Mar 23 11:49:14 CET 2017
applied to master & stable-4
On Fri, Mar 17, 2017 at 11:01:32AM +0100, Fabian Grünbichler wrote:
> otherwise we get lots uninitialized warnings:
>
> update VM 600: -delete unused7
> Use of uninitialized value $data in split at /usr/share/perl5/PVE/JSONSchema.pm line 533.
> Use of uninitialized value in concatenation (.) or string at /usr/share/perl5/PVE/API2/Qemu.pm line 1012.
> Use of uninitialized value $volid in pattern match (m//) at /usr/share/perl5/PVE/QemuServer.pm line 1824.
> Use of uninitialized value $volid in pattern match (m//) at /usr/share/perl5/PVE/Storage/Plugin.pm line 201.
> Use of uninitialized value $volid in concatenation (.) or string at /usr/share/perl5/PVE/Storage/Plugin.pm line 205.
>
> vs:
>
> update VM 600: -delete unused7
> cannot delete 'unused7' - not set in current configuration!
>
> Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
> ---
> should apply for both stable-4 and master
>
> PVE/API2/Qemu.pm | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
> index c0a72c0..c6df951 100644
> --- a/PVE/API2/Qemu.pm
> +++ b/PVE/API2/Qemu.pm
> @@ -967,6 +967,12 @@ my $update_vm_api = sub {
> foreach my $opt (@delete) {
> $modified->{$opt} = 1;
> $conf = PVE::QemuConfig->load_config($vmid); # update/reload
> + if (!defined($conf->{$opt})) {
> + warn "cannot delete '$opt' - not set in current configuration!\n";
> + $modified->{$opt} = 0;
> + next;
> + }
> +
> if ($opt =~ m/^unused/) {
> my $drive = PVE::QemuServer::parse_drive($opt, $conf->{$opt});
> PVE::QemuConfig->check_protection($conf, "can't remove unused disk '$drive->{file}'");
> --
> 2.1.4
More information about the pve-devel
mailing list