import: rework plugin api to not need a blessed object

does not really make sense, and if the plugin wants that, it can still
be done, like we do here for the ESXiPlugin

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak
2024-03-12 12:51:26 +01:00
committed by Thomas Lamprecht
parent c92d810053
commit 4f50a578f4
2 changed files with 4 additions and 4 deletions

View File

@ -782,8 +782,7 @@ __PACKAGE__->register_method({
PVE::Storage::check_volume_access($rpcenv, $authuser, $cfg, undef, $volid);
return PVE::Tools::run_with_timeout(30, sub {
my $import = PVE::Storage::get_import_metadata($cfg, $volid);
return $import->get_create_args();
return PVE::Storage::get_import_metadata($cfg, $volid);
});
}});

View File

@ -242,7 +242,7 @@ sub split_path : prototype($) {
return;
}
sub get_import_metadata : prototype($$$$) {
sub get_import_metadata : prototype($$$$$) {
my ($class, $scfg, $volname, $storeid) = @_;
if ($volname !~ m!^([^/]+)/.*\.vmx$!) {
@ -256,13 +256,14 @@ sub get_import_metadata : prototype($$$$) {
my $manifest = $class->get_manifest($storeid, $scfg, 0);
my $contents = file_get_contents($vmx_path);
return PVE::Storage::ESXiPlugin::VMX->parse(
my $vmx = PVE::Storage::ESXiPlugin::VMX->parse(
$storeid,
$scfg,
$volname,
$contents,
$manifest,
);
return $vmx->get_create_args();
}
# Returns a size in bytes, this is a helper for already-mounted files.