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

Dietmar Maurer dietmar at proxmox.com
Fri Dec 2 07:34:43 CET 2016


> @@ -880,10 +891,13 @@ __PACKAGE__->register_method({
>  	# test if VM exists
>  	PVE::LXC::Config->load_config($vmid);
>  
> +	my $isrunning = PVE::LXC::check_running($vmid);
>  	# try to detect errors early
> -	if (PVE::LXC::check_running($vmid)) {
> -	    die "can't migrate running container without --online\n"
> -		if !$param->{online};
> +	if ($isrunning) {
> +	    die "lxc live migration not implemented\n"
> +		if $param->{online};
> +	    die "running container needs restart mode for migration\n"
> +		if !$param->{restart};

Maybe it is worth to factor out this check into a separate function,
because you use the same check in a previous patch.




More information about the pve-devel mailing list