[pve-devel] [PATCH v2 qemu-server 2/3] add error handling to vmconfig_apply_pending
Oguz Bektas
o.bektas at proxmox.com
Fri Dec 13 12:41:52 CET 2019
---
PVE/API2/Qemu.pm | 6 +++---
PVE/QemuServer.pm | 9 ++++++++-
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 3c7ef30..baa96f2 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -1241,13 +1241,13 @@ my $update_vm_api = sub {
$conf = PVE::QemuConfig->load_config($vmid); # update/reload
+ my $errors = {};
if ($running) {
- my $errors = {};
PVE::QemuServer::vmconfig_hotplug_pending($vmid, $conf, $storecfg, $modified, $errors);
- raise_param_exc($errors) if scalar(keys %$errors);
} else {
- PVE::QemuServer::vmconfig_apply_pending($vmid, $conf, $storecfg, $running);
+ PVE::QemuServer::vmconfig_apply_pending($vmid, $conf, $storecfg, $running, $errors);
}
+ raise_param_exc($errors) if scalar(keys %$errors);
return;
};
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 9c89be5..ed6b557 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -4977,7 +4977,14 @@ sub vmconfig_delete_or_detach_drive {
sub vmconfig_apply_pending {
- my ($vmid, $conf, $storecfg) = @_;
+ my ($vmid, $conf, $storecfg, $errors) = @_;
+
+ my $add_apply_error = sub {
+ my ($opt, $msg) = @_;
+ my $err_msg = "unable to apply pending change $opt : $msg";
+ $errors->{$opt} = $err_msg;
+ warn $err_msg;
+ };
# cold plug
--
2.20.1
More information about the pve-devel
mailing list