import: return skipped/ignored volumes in get_create_args

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller
2024-03-06 15:14:05 +01:00
committed by Thomas Lamprecht
parent e72845efbf
commit 763a2292f3
2 changed files with 15 additions and 8 deletions

View File

@ -736,15 +736,10 @@ __PACKAGE__->register_method({
PVE::Storage::check_volume_access($rpcenv, $authuser, $cfg, undef, $volid);
my $create_args = PVE::Tools::run_with_timeout(30, sub {
return PVE::Tools::run_with_timeout(30, sub {
my $import = PVE::Storage::get_import_metadata($cfg, $volid);
return $import->get_create_args($target);
});
return {
type => 'vm', # currently we only have this
'create-args' => $create_args,
};
}});
1;

View File

@ -898,6 +898,7 @@ sub get_create_args {
my $manifest = $self->manifest;
my $create_args = {};
my $ignored_volumes = {};
my ($cores, $sockets) = $self->cpu_info();
$create_args->{cores} = $cores if $cores != 1;
@ -973,7 +974,14 @@ sub get_create_args {
}
my $count = $counts{$bus}++;
$create_args->{"${bus}${count}"} = "$default_storage:0,import-from=$storeid:$path";
if ($kind eq 'cdrom') {
# We currently do not pass cdroms through via the esxi storage.
# Users should adapt import these from the storages directly/manually.
$create_args->{"${bus}${count}"} = "none,media=cdrom";
$ignored_volumes->{"${bus}${count}"} = "$storeid:$path";
} else {
$create_args->{"${bus}${count}"} = "$default_storage:0,import-from=$storeid:$path";
}
$boot_order .= ';' if length($boot_order);
$boot_order .= $bus.$count;
@ -1009,7 +1017,11 @@ sub get_create_args {
$create_args->{name} = $name if length($name);
}
return $create_args;
return {
type => 'vm',
'create-args' => $create_args,
'ignored-volumes' => $ignored_volumes,
};
}
1;