VMM: make use of socket_dir

This commit is contained in:
fnux 2020-01-28 12:24:26 +01:00
parent 4c6a126d8b
commit a759b8aa39
1 changed files with 5 additions and 5 deletions

View File

@ -125,7 +125,7 @@ class VMM:
os.makedirs(self.socket_dir, exist_ok=True)
def is_running(self, uuid):
sock_path = os.path.join(self.vmm_backend, uuid)
sock_path = os.path.join(self.socket_dir, uuid)
try:
sock = socket.socket(socket.AF_UNIX)
sock.connect(sock_path)
@ -163,7 +163,7 @@ class VMM:
qmp_arg = (
"-qmp",
"unix:{},server,nowait".format(
join_path(self.vmm_backend, uuid)
join_path(self.socket_dir, uuid)
),
)
vnc_arg = (
@ -212,7 +212,7 @@ class VMM:
def execute_command(self, uuid, command, **kwargs):
# execute_command -> sucess?, output
try:
with VMQMPHandles(os.path.join(self.vmm_backend, uuid)) as (
with VMQMPHandles(os.path.join(self.socket_dir, uuid)) as (
sock_handle,
file_handle,
):
@ -255,8 +255,8 @@ class VMM:
def discover(self):
vms = [
uuid
for uuid in os.listdir(self.vmm_backend)
if not isdir(join_path(self.vmm_backend, uuid))
for uuid in os.listdir(self.socket_dir)
if not isdir(join_path(self.socket_dir, uuid))
]
return vms