[pve-devel] [PATCH qemu-server] restore: use correct storage for format check for cloudinit drives

Dominik Csapak d.csapak at proxmox.com
Tue Apr 28 14:52:29 CEST 2020


when a backup includes a cloudinit disk on a non-existent storage,
the restore fails with 'storage' does not exist

this happens because we want to get the format of the disk, by
checking the source storage

we fix this by using the target storage first and only the source as
fallback

this will still fail if neither storage exists
(which is ok, since we cannot restore then anyway)

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/QemuServer.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 37c7320..e355810 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -5739,7 +5739,7 @@ my $parse_backup_hints = sub {
 	    my $drive = parse_drive($virtdev, $2);
 	    if (drive_is_cloudinit($drive)) {
 		my ($storeid, $volname) = PVE::Storage::parse_volume_id($drive->{file});
-		my $scfg = PVE::Storage::storage_config($storecfg, $storeid);
+		my $scfg = PVE::Storage::storage_config($storecfg, $options->{storage} // $storeid);
 		my $format = qemu_img_format($scfg, $volname); # has 'raw' fallback
 
 		$virtdev_hash->{$virtdev} = {
-- 
2.20.1





More information about the pve-devel mailing list