Skip to content

Commit

Permalink
qdevices: Adapt virtiofsd options
Browse files Browse the repository at this point in the history
Some options are deprecated since the dedicated virtiofsd package
since rhel9, while before virtiofsd belongs to qemu package.

Signed-off-by: Tingting Mao <[email protected]>
  • Loading branch information
hellohellenmao committed Sep 12, 2024
1 parent b7ca5fd commit 074c2e2
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions virttest/qemu_devices/qdevices.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import re
import shutil
import signal
import subprocess
import time
import traceback
from collections import OrderedDict
Expand Down Expand Up @@ -2259,11 +2260,31 @@ def _handle_log(self, line):

def start_daemon(self):
"""Start the virtiofs daemon in background."""
fsd_cmd = "%s --socket-path=%s" % (
self.get_param("binary"),
self.get_param("sock_path"),
)
fsd_cmd += " -o source=%s" % self.get_param("source")
virtiofs_binary = self.get_param("binary")
socket_path = self.get_param("sock_path")
source_dir = self.get_param("source")

fsd_cmd = f"{virtiofs_binary} --socket-path={socket_path}"

# Capture the capabilities of virtiofsd
try:
result = subprocess.check_output(
[virtiofs_binary, "--print-capabilities"], universal_newlines=True
)
except subprocess.CalledProcessError as e:
raise DeviceError("virtiofsd failed to report capabilities: %s" % e)

virtiofs_cpblt = json.loads(result)

# Append appropriate parameters based on the virtiofsd capabilities
if (
"features" in virtiofs_cpblt
and "separate-options" in virtiofs_cpblt["features"]
):
fsd_cmd += f" --shared-dir {source_dir}"
else:
fsd_cmd += f" -o source={source_dir}"

if self.get_param("enable_debug_mode") == "on":
fsd_cmd += " -d"
self.set_param("status_active", "Waiting for vhost-user socket connection")
Expand Down

0 comments on commit 074c2e2

Please sign in to comment.