[pve-devel] [PATCH container v2 2/2] add restart migration to lxc api

Dominik Csapak d.csapak at proxmox.com
Fri Dec 2 11:42:51 CET 2016


this simply adds the restart flag and the optional timeout to the
lxc api required for the restart mode migration

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
changes to v1:
* correct check so that we do not cancel if -online is set, so
that a ha enabled container still does the right thing
 src/PVE/API2/LXC.pm | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
index 38b1feb..0d05ecd 100644
--- a/src/PVE/API2/LXC.pm
+++ b/src/PVE/API2/LXC.pm
@@ -845,6 +845,17 @@ __PACKAGE__->register_method({
 		description => "Use online/live migration.",
 		optional => 1,
 	    },
+	    restart => {
+		type => 'boolean',
+		description => "Use restart migration",
+		optional => 1,
+	    },
+	    timeout => {
+		type => 'integer',
+		description => "Timeout in seconds for shutdown for restart migration",
+		optional => 1,
+		default => 60
+	    },
 	    force => {
 		type => 'boolean',
 		description => "Force migration despite local bind / device" .
@@ -882,8 +893,8 @@ __PACKAGE__->register_method({
 
 	# try to detect errors early
 	if (PVE::LXC::check_running($vmid)) {
-	    die "can't migrate running container without --online\n"
-		if !$param->{online};
+	    die "can't migrate running container without --online or --restart\n"
+		if !$param->{online} && !$param->{restart};
 	}
 
 	if (PVE::HA::Config::vm_is_ha_managed($vmid) && $rpcenv->{type} ne 'ha') {
-- 
2.1.4





More information about the pve-devel mailing list