[pve-devel] [PATCH container v4] Fix pct skiplock

Dietmar Maurer dietmar at proxmox.com
Wed Mar 14 13:41:22 CET 2018


another comment inline
> diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
> index 7adbcd1..4398cfd 100644
> --- a/src/PVE/LXC.pm
> +++ b/src/PVE/LXC.pm
> @@ -1545,11 +1545,20 @@ sub vm_start {
> 
>      update_lxc_config($vmid, $conf);
> 
> -    local $ENV{PVE_SKIPLOCK}=1 if $skiplock;
> +    my $skiplock_flag_fn = "/run/lxc/skiplock-$vmid";
> +
> +    if ($skiplock) {
> +	open(my $fh, '>', $skiplock_flag_fn) || die "failed to open
> $skiplock_flag_fn for writing: $!\n";
> +	close($fh);
> +    }
> 
>      my $cmd = ['systemctl', 'start', "pve-container\@$vmid"];
> 
> -    PVE::Tools::run_command($cmd);
> +    eval { PVE::Tools::run_command($cmd); };
> +    if (my $err = $@) {
> +	unlink $skiplock_flag_fn if -e $skiplock_flag_fn;

there is no need to test with -e, simply use

unlink $skiplock_flag_fn;


> +	die $err if $err;
> +    }
> 
>      return;




More information about the pve-devel mailing list