[pve-devel] [PATCH 12/12] apply_pending_conf on vm_stop | vm_start

Alexandre Derumier aderumier at odiso.com
Thu Oct 30 13:40:33 CET 2014


fixme : need to be implemented (we can call vm_update_api with params)

we apply pending change on vm_stop,

but also on vm_start if the stop was unclean or done from the guest

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/QemuServer.pm |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 566adbb..c3b801b 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3486,6 +3486,8 @@ sub vm_start {
 	# set environment variable useful inside network script
 	$ENV{PVE_MIGRATED_FROM} = $migratedfrom if $migratedfrom;
 
+	apply_pending_conf($conf, $vmid, $storecfg) if !$migratedfrom;
+	
 	my ($cmd, $vollist, $spice_port) = config_to_command($storecfg, $vmid, $conf, $defaults, $forcemachine);
 
 	my $migrate_port = 0;
@@ -3679,7 +3681,7 @@ sub get_vm_volumes {
 }
 
 sub vm_stop_cleanup {
-    my ($storecfg, $vmid, $conf, $keepActive) = @_;
+    my ($storecfg, $vmid, $conf, $keepActive, $migratedfrom) = @_;
 
     eval {
 	fairsched_rmnod($vmid); # try to destroy group
@@ -3694,6 +3696,7 @@ sub vm_stop_cleanup {
 	}
     };
     warn $@ if $@; # avoid errors - just warn
+    apply_pending_conf($conf, $vmid, $storecfg) if !$migratedfrom;
 }
 
 # Note: use $nockeck to skip tests if VM configuration file exists.
@@ -3708,7 +3711,7 @@ sub vm_stop {
 	my $pid = check_running($vmid, $nocheck, $migratedfrom);
 	kill 15, $pid if $pid;
 	my $conf = load_config($vmid, $migratedfrom);
-	vm_stop_cleanup($storecfg, $vmid, $conf, $keepActive);
+	vm_stop_cleanup($storecfg, $vmid, $conf, $keepActive, $migratedfrom);
 	return;
     }
 
@@ -5423,4 +5426,11 @@ sub lspci {
     return $devices;
 }
 
+sub apply_pending_conf {
+    my ($conf, $vmid, $storecfg) = @_;
+
+     #Implement me
+     #PVE::API2::update_vm_api($param, 1);
+}
+
 1;
-- 
1.7.10.4




More information about the pve-devel mailing list