[pve-devel] [PATCH storage v2 02/10] plugin: dir: implement import content type

Fiona Ebner f.ebner at proxmox.com
Mon Apr 22 13:00:30 CEST 2024


Am 19.04.24 um 11:45 schrieb Dominik Csapak:
> diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
> index 22a9729..39a8354 100644
> --- a/src/PVE/Storage/Plugin.pm
> +++ b/src/PVE/Storage/Plugin.pm
> @@ -654,6 +654,10 @@ sub parse_volname {
>  	return ('backup', $fn);
>      } elsif ($volname =~ m!^snippets/([^/]+)$!) {
>  	return ('snippets', $1);
> +    } elsif ($volname =~ m!^import/(${PVE::Storage::SAFE_CHAR_CLASS_RE}+$PVE::Storage::IMPORT_EXT_RE_1)$!) {
> +	return ('import', $1);

Wouldn't it be nicer to return 'ovf' and 'ova' as the $file_format here
and check for that at the call sites? Currently you rely on the presence
or absence of $file_format in copy_needs_extraction() and
get_import_metadata() and then re-match on the ova extension. Having the
format right away would be a bit cleaner and more future-proof or is
there a specific reason against doing it?

> +    } elsif ($volname =~ m!^import/(${PVE::Storage::SAFE_CHAR_CLASS_RE}+\.(raw|vmdk|qcow2))$!) {
> +	return ('import', $1, undef, undef, undef, undef, $2);
>      }
>  
>      die "unable to parse directory volume name '$volname'\n";




More information about the pve-devel mailing list