| |
@@ -8,6 +8,7 @@
|
| |
import shlex
|
| |
import signal
|
| |
import multiprocessing
|
| |
+ import random
|
| |
import socket
|
| |
import subprocess
|
| |
import sys
|
| |
@@ -105,7 +106,8 @@
|
| |
|
| |
|
| |
def start_qemu(image, cloudinit, log, portrange=(2222, 5555)):
|
| |
- for port in range(*portrange):
|
| |
+ for tries in range(10):
|
| |
+ port = random.randint(*portrange)
|
| |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
| |
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
| |
try:
|
| |
I'm working changing rpm-ostree to spawn VMs in parallel, and
currently this races because we release the socket, then start
qemu.
I have a plan for a reliable fix, but even with that let's use a random port
since it makes collissions a lot less likely.