file size info: allow specifying file format
Allow callers to opt-out of 'qemu-img' autodetecting the format. Currently not supported to be done together with untrusted, because it can lead to less checks being done. Could be further refined (e.g. disallow only untrusted together with format being 'raw') should the need arise. For 'subvol' format, the checking is handled outside of 'qemu-img' of course, based on whether it is a directory or not. Currently, there is a fallback to 'raw' should the format not be among the ones allowed for the 'pve-qm-image-format' standard option. This is to reduce potential for fallout, in particular for the plan to change the base plugin's volume_size_info() to pass in the expected format when calling file_size_info() too. While not explicitly part of the storage plugin API, the 'untrusted' parameter is now in a different place, so a compat check is added for external plugins that might've still used it. Breaks for qemu-server needed (if we don't want to just rely on the compat check). Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
committed by
Fabian Grünbichler
parent
10d338baa8
commit
83648951d7
@ -242,9 +242,9 @@ sub storage_ids {
|
||||
}
|
||||
|
||||
sub file_size_info {
|
||||
my ($filename, $timeout, $untrusted) = @_;
|
||||
my ($filename, $timeout, $file_format, $untrusted) = @_;
|
||||
|
||||
return PVE::Storage::Plugin::file_size_info($filename, $timeout, $untrusted);
|
||||
return PVE::Storage::Plugin::file_size_info($filename, $timeout, $file_format, $untrusted);
|
||||
}
|
||||
|
||||
sub get_volume_attribute {
|
||||
@ -2223,7 +2223,7 @@ sub assert_iso_content {
|
||||
my ($path) = @_;
|
||||
|
||||
# check for things like backing image
|
||||
file_size_info($path, undef, 1);
|
||||
file_size_info($path, undef, undef, 1);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user