[pve-devel] [PATCH] vncproxy: wait max 10s for the socket if it does not exist

Stefan Priebe s.priebe at profihost.ag
Mon Feb 25 22:02:25 CET 2013


ignore my last patch - it just had a stupid side effect to work more 
often. This one fixes a race betweem starting a vm and autoconnecting to 
the socket.

Am 25.02.2013 21:57, schrieb Stefan Priebe:
> Signed-off-by: Stefan Priebe <s.priebe at profihost.ag>
> ---
>   PVE/API2/Qemu.pm |    3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
> index bed2f4c..32bacaf 100644
> --- a/PVE/API2/Qemu.pm
> +++ b/PVE/API2/Qemu.pm
> @@ -1123,6 +1123,9 @@ __PACKAGE__->register_method({
>   	my $realcmd = sub {
>   	    my $upid = shift;
>
> +	    my $c = 0;
> +	    while ( ++$c < 10 && !-e "/var/run/qemu-server/$vmid.vnc" ) { sleep(1); }
> +
>   	    syslog('info', "starting vnc proxy $upid\n");
>
>   	    my $qmcmd = [@$remcmd, "/usr/sbin/qm", 'vncproxy', $vmid];
>



More information about the pve-devel mailing list