[pve-devel] [PATCH qemu-server] fix #2382: delete cloudinit disk before restoring

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Sep 25 15:09:17 CEST 2019


On 9/24/19 3:40 PM, Mira Limbeck wrote:
> The fix introduced in commit bf4a933 did not work as intended. We're
> iterating over the $oldconf, not over $virtdev_hash. This means
> $drive->{is_cloudinit} is always undefined. Instead use the more costly
> call to drive_is_cloudinit.

would not call this costly, as this suggest some sort of IO is done, but
effectively it's just a regex match, while it may need a little bit more
than a hash check, that difference is not really worth mentioning, IMO.

> 
> Signed-off-by: Mira Limbeck <m.limbeck at proxmox.com>
> ---
> Tested on PVE 6 and 5.
> 
>  PVE/QemuServer.pm | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index ad6902f..69ccf95 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -6509,7 +6509,7 @@ sub restore_vma_archive {
>  	    foreach_drive($oldconf, sub {
>  		my ($ds, $drive) = @_;
>  
> -		return if !$drive->{is_cloudinit} && drive_is_cdrom($drive);
> +		return if !drive_is_cloudinit($drive) && drive_is_cdrom($drive);

why don't we just pass the "$exclude_cloudinit" argument of the
drive_is_cdrom method?

>  
>  		my $volid = $drive->{file};
>  		return if !$volid || $volid =~ m|^/|;
> 





More information about the pve-devel mailing list