mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-04-29 03:11:39 +00:00
backup: prepare: fix format detection for disks without storage ID
which is the case for passed-through disks. The qemu_img_format() function cannot correctly handle those, and it's not safe to assume they are raw (it's most likely, but not guaranteed), so just use the storage method for the format like it was done before commitefa3aa24
("avoid list context for volume_size_info calls"). This will use 'qemu-img info' to get the actual format. Reported in the community forum: https://forum.proxmox.com/threads/124794/ https://forum.proxmox.com/threads/124823/ https://forum.proxmox.com/threads/124818/ Fixes:efa3aa24
("avoid list context for volume_size_info calls") Signed-off-by: Fiona Ebner <f.ebner@proxmox.com> Tested-by: Friedrich Weber <f.weber@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
021e9cdf7d
commit
670f947ee8
@ -119,11 +119,20 @@ sub prepare {
|
||||
}
|
||||
next if !$path;
|
||||
|
||||
my $size = eval { PVE::Storage::volume_size_info($self->{storecfg}, $volid, 5) };
|
||||
die "no such volume '$volid'\n" if $@;
|
||||
my ($size, $format);
|
||||
if ($storeid) {
|
||||
# The call in list context can be expensive for certain plugins like RBD, just get size
|
||||
$size = eval { PVE::Storage::volume_size_info($self->{storecfg}, $volid, 5) };
|
||||
die "no such volume '$volid'\n" if $@;
|
||||
|
||||
my $scfg = PVE::Storage::storage_config($self->{storecfg}, $storeid);
|
||||
my $format = PVE::QemuServer::qemu_img_format($scfg, $volname);
|
||||
my $scfg = PVE::Storage::storage_config($self->{storecfg}, $storeid);
|
||||
$format = PVE::QemuServer::qemu_img_format($scfg, $volname);
|
||||
} else {
|
||||
($size, $format) = eval {
|
||||
PVE::Storage::volume_size_info($self->{storecfg}, $volid, 5);
|
||||
};
|
||||
die "no such volume '$volid'\n" if $@;
|
||||
}
|
||||
|
||||
my $diskinfo = {
|
||||
path => $path,
|
||||
|
Loading…
Reference in New Issue
Block a user