mirror of
git://git.proxmox.com/git/qemu-server.git
synced 2025-03-09 08:58:25 +03:00
hotplug_pending: remove redundant write/load config calls
instead of writing the config after every change, we can do it once for all the changes in the end to avoid redundant i/o. we also don't need to load_config after writing fastplug changes. Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
This commit is contained in:
parent
9f4e1abf3b
commit
4df15a0377
@ -4779,7 +4779,6 @@ sub vmconfig_hotplug_pending {
|
||||
|
||||
if ($changes) {
|
||||
PVE::QemuConfig->write_config($vmid, $conf);
|
||||
$conf = PVE::QemuConfig->load_config($vmid); # update/reload
|
||||
}
|
||||
|
||||
my $hotplug_features = parse_hotplug_features(defined($conf->{hotplug}) ? $conf->{hotplug} : '1');
|
||||
@ -4839,11 +4838,8 @@ sub vmconfig_hotplug_pending {
|
||||
if (my $err = $@) {
|
||||
&$add_error($opt, $err) if $err ne "skip\n";
|
||||
} else {
|
||||
# save new config if hotplug was successful
|
||||
delete $conf->{$opt};
|
||||
PVE::QemuConfig->remove_from_pending_delete($conf, $opt);
|
||||
PVE::QemuConfig->write_config($vmid, $conf);
|
||||
$conf = PVE::QemuConfig->load_config($vmid); # update/reload
|
||||
}
|
||||
}
|
||||
|
||||
@ -4931,13 +4927,12 @@ sub vmconfig_hotplug_pending {
|
||||
if (my $err = $@) {
|
||||
&$add_error($opt, $err) if $err ne "skip\n";
|
||||
} else {
|
||||
# save new config if hotplug was successful
|
||||
$conf->{$opt} = $value;
|
||||
delete $conf->{pending}->{$opt};
|
||||
PVE::QemuConfig->write_config($vmid, $conf);
|
||||
$conf = PVE::QemuConfig->load_config($vmid); # update/reload
|
||||
}
|
||||
}
|
||||
|
||||
PVE::QemuConfig->write_config($vmid, $conf);
|
||||
}
|
||||
|
||||
sub try_deallocate_drive {
|
||||
|
Loading…
x
Reference in New Issue
Block a user