mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-06-27 21:51:54 +00:00
api: update: pass correct config when creating disks
While the new options should be written to the pending config, the decisions (currently only one) in create_disks needs to be made for the current config. Seems to fix EFI disk creation, but actually, it's only future-proofing, because, currently, the same OVMF_VARS file is used independently of $smm. The correct config is also needed to determine the correct size for the EFI disk for the upcoming import-from feature. Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
parent
fe19840a56
commit
367e6bf4b7
@ -237,12 +237,7 @@ my $create_disks = sub {
|
|||||||
die $err;
|
die $err;
|
||||||
}
|
}
|
||||||
|
|
||||||
# modify vm config if everything went well
|
return ($vollist, $res);
|
||||||
foreach my $ds (keys %$res) {
|
|
||||||
$conf->{$ds} = $res->{$ds};
|
|
||||||
}
|
|
||||||
|
|
||||||
return $vollist;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
my $check_cpu_model_access = sub {
|
my $check_cpu_model_access = sub {
|
||||||
@ -712,7 +707,18 @@ __PACKAGE__->register_method({
|
|||||||
|
|
||||||
my $vollist = [];
|
my $vollist = [];
|
||||||
eval {
|
eval {
|
||||||
$vollist = &$create_disks($rpcenv, $authuser, $conf, $arch, $storecfg, $vmid, $pool, $param, $storage);
|
($vollist, my $created_opts) = $create_disks->(
|
||||||
|
$rpcenv,
|
||||||
|
$authuser,
|
||||||
|
$conf,
|
||||||
|
$arch,
|
||||||
|
$storecfg,
|
||||||
|
$vmid,
|
||||||
|
$pool,
|
||||||
|
$param,
|
||||||
|
$storage,
|
||||||
|
);
|
||||||
|
$conf->{$_} = $created_opts->{$_} for keys $created_opts->%*;
|
||||||
|
|
||||||
if (!$conf->{boot}) {
|
if (!$conf->{boot}) {
|
||||||
my $devs = PVE::QemuServer::get_default_bootdevices($conf);
|
my $devs = PVE::QemuServer::get_default_bootdevices($conf);
|
||||||
@ -1364,7 +1370,17 @@ my $update_vm_api = sub {
|
|||||||
PVE::QemuServer::vmconfig_register_unused_drive($storecfg, $vmid, $conf, PVE::QemuServer::parse_drive($opt, $conf->{pending}->{$opt}))
|
PVE::QemuServer::vmconfig_register_unused_drive($storecfg, $vmid, $conf, PVE::QemuServer::parse_drive($opt, $conf->{pending}->{$opt}))
|
||||||
if defined($conf->{pending}->{$opt});
|
if defined($conf->{pending}->{$opt});
|
||||||
|
|
||||||
&$create_disks($rpcenv, $authuser, $conf->{pending}, $arch, $storecfg, $vmid, undef, {$opt => $param->{$opt}});
|
my (undef, $created_opts) = $create_disks->(
|
||||||
|
$rpcenv,
|
||||||
|
$authuser,
|
||||||
|
$conf,
|
||||||
|
$arch,
|
||||||
|
$storecfg,
|
||||||
|
$vmid,
|
||||||
|
undef,
|
||||||
|
{$opt => $param->{$opt}},
|
||||||
|
);
|
||||||
|
$conf->{pending}->{$_} = $created_opts->{$_} for keys $created_opts->%*;
|
||||||
|
|
||||||
# default legacy boot order implies all cdroms anyway
|
# default legacy boot order implies all cdroms anyway
|
||||||
if (@bootorder) {
|
if (@bootorder) {
|
||||||
|
Loading…
Reference in New Issue
Block a user