[pve-devel] [PATCH V4 qemu-server 6/7] adapt behavior for detaching drives to deatching container mount points

Fiona Ebner f.ebner at proxmox.com
Tue Dec 13 14:08:49 CET 2022


The info from this commit title is good to have as part of the commit
message, but it would be nicer if the title would describe the change
rather than just referencing another repository.

Am 25.11.22 um 15:40 schrieb Stefan Hrdlicka:
> if a storage is not available a volume will be added to the container

s/container/VM/

> config as unused. before it would just disappear from the config
> 
> Signed-off-by: Stefan Hrdlicka <s.hrdlicka at proxmox.com>
> ---
>  PVE/QemuServer.pm | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 331677f..b57226b 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -2038,7 +2038,11 @@ sub vmconfig_register_unused_drive {
>  	delete $conf->{cloudinit};
>      } elsif (!drive_is_cdrom($drive)) {
>  	my $volid = $drive->{file};
> -	if (vm_is_volid_owner($storecfg, $vmid, $volid)) {
> +	my ($storeid, $volname) = PVE::Storage::parse_volume_id($volid);
> +	if (!PVE::Storage::storage_config($storecfg, $storeid, 1)) {
> +	    # if storage is not in config, skip owner check and add as unused
> +	    PVE::QemuConfig->add_unused_volume($conf, $volid, $vmid);
> +	} elsif (vm_is_volid_owner($storecfg, $vmid, $volid)) {
>  	    PVE::QemuConfig->add_unused_volume($conf, $volid, $vmid);
>  	}
>      }





More information about the pve-devel mailing list