summaryrefslogtreecommitdiff
path: root/subplot/qemumgr.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-10-07 07:23:42 +0300
committerLars Wirzenius <liw@liw.fi>2020-10-07 07:23:42 +0300
commitc1de4c4760367361c96081d96ae03293bc49bb18 (patch)
tree6d8615c175427e426aea8b279d00d0c891d6c87c /subplot/qemumgr.py
parent746ddbc6e17d9ab8238cc4a8e3a348ccb44878b5 (diff)
downloaddebian-ansible-c1de4c4760367361c96081d96ae03293bc49bb18.tar.gz
fix: use a random port for Qemu client
Diffstat (limited to 'subplot/qemumgr.py')
-rwxr-xr-xsubplot/qemumgr.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/subplot/qemumgr.py b/subplot/qemumgr.py
index 8951122..0550bdb 100755
--- a/subplot/qemumgr.py
+++ b/subplot/qemumgr.py
@@ -3,6 +3,7 @@
import logging
import os
+import random
import shlex
import shutil
import signal
@@ -51,6 +52,9 @@ class QemuSystem:
def set_username(self, username):
self._username = username
+ def get_port(self):
+ return self._port
+
def _copy_image(self, base_image, size):
image = self._join("qemu.img")
logging.debug(f"QemuSystem: actual disk image: {image}")
@@ -92,7 +96,7 @@ class QemuSystem:
def start(self):
iso = self._cloud_init_iso()
- self._port = 2222 # FIXME
+ self._port = random.randint(2000, 30000)
pid_file = self._join("qemu.pid")
out_file = self._join("qemu.out")
err_file = self._join("qemu.err")