Packer: parallel running packer with "qemu: Error connecting to VNC: dial 127.0.0.1:5913 getsockopt: connection refused"

Created on 9 Feb 2017  路  5Comments  路  Source: hashicorp/packer

I'm using packer behind a web server, the backend HTTP service to create QEMU image for various OS, when there are multiple packer running at the same time, there will throw such a error, I think the VNC port 5913 has beed occupied by some other packer worker, is it possible for packer to detect whether the VNC port is available or not?

buildeqemu question

All 5 comments

@vtolstov any comments?

this is expected, i have many times this. You must use network namespaces, for example docker and build image with packer inside docker container. So in this case port does not matter.
Also i can patch packer to create some lock file in /dev/shm, but i think that this ugly way....

How about to running a daemon packer? and then push json file to that daemon, this may fix the VNC or HTTP port competition.

I don't tinks that this needed. Sometimes ago i'm work on libvirt builder. It can solve this problems and bring ability to run build on remote hosts.
But i don't remember what stopped me. If you want, i can take a look at this builder and may be fix it ro run with current packer.

@vtolstov 馃憤 : Brilliant, I think it's also possible to export VNC port settings to json, this makes it possible to manage VNC port on the caller side. Or just configure the qemuargs, passing ["-vnc", "127.0.0.1:<some-port>"].

For example, you can pass 0.0.0.0:5999 as current VNC port, configure "vnc_bind_address" : "0.0.0.0", "vnc_bind_min": 5999, "vnc_bind_max": 5999, then within "qemuargs" : [ "-vnc": "0.0.0.0:99" ]. For HTTP, the same parameters http_port_min and http_port_max also available.

Was this page helpful?
0 / 5 - 0 ratings