Skip to content

Commit d3eebf6

Browse files
committed
vmtest: move qmp socket out of the image dir into /tmp
The images test tooling gets quite unhappy if files are created in the image directory so lets move things to /tmp.
1 parent 2f48dac commit d3eebf6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

vmtest/vm.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
import pathlib
44
import platform
55
import logging
6+
import shutil
67
import subprocess
78
import sys
9+
import tempfile
810
import time
911
import uuid
1012
from io import StringIO
@@ -120,7 +122,8 @@ class QEMU(VM):
120122
def __init__(self, img, arch="", snapshot=True, cdrom=None):
121123
super().__init__()
122124
self._img = pathlib.Path(img)
123-
self._qmp_socket = self._img.with_suffix(".qemp-socket")
125+
self._tmpdir = tempfile.mkdtemp(prefix="vmtest-", suffix=f"-{self._img.name}")
126+
self._qmp_socket = os.path.join(self._tmpdir, "qmp.socket")
124127
self._qemu_p = None
125128
self._snapshot = snapshot
126129
self._cdrom = cdrom
@@ -131,6 +134,7 @@ def __init__(self, img, arch="", snapshot=True, cdrom=None):
131134

132135
def __del__(self):
133136
self.force_stop()
137+
shutil.rmtree(self._tmpdir)
134138

135139
def _gen_qemu_cmdline(self, snapshot, use_ovmf):
136140
if self._arch in ("arm64", "aarch64"):

0 commit comments

Comments
 (0)