]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu-conf: add configurable slirp-helper location
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Thu, 8 Aug 2019 14:55:03 +0000 (18:55 +0400)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 6 Sep 2019 10:47:47 +0000 (12:47 +0200)
A slirp helper is a process that provides user-mode networking through
a unix domain socket. It is expected to follow the following
specification:
https://gitlab.freedesktop.org/slirp/libslirp-rs/blob/master/src/bin/README.rst

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
m4/virt-driver-qemu.m4
src/qemu/libvirtd_qemu.aug
src/qemu/qemu.conf
src/qemu/qemu_conf.c
src/qemu/qemu_conf.h
src/qemu/test_libvirtd_qemu.aug.in

index a1d05bbd7f2766c6a8fdaaf1c5c9213ad91f3638..a1d2c66bba51f368143d805bcb0f4f123d2f69e1 100644 (file)
@@ -105,6 +105,11 @@ AC_DEFUN([LIBVIRT_DRIVER_CHECK_QEMU], [
                [/usr/bin:/usr/libexec])
   AC_DEFINE_UNQUOTED([QEMU_PR_HELPER], ["$QEMU_PR_HELPER"],
                      [QEMU PR helper])
+  AC_PATH_PROG([QEMU_SLIRP_HELPER], [slirp-helper],
+               [/usr/bin/slirp-helper],
+               [/usr/bin:/usr/libexec])
+  AC_DEFINE_UNQUOTED([QEMU_SLIRP_HELPER], ["$QEMU_SLIRP_HELPER"],
+                     [QEMU slirp helper])
 ])
 
 AC_DEFUN([LIBVIRT_DRIVER_RESULT_QEMU], [
index 2a99a0c55fe7a116f6c1f6f955e3f14e9b10ba14..7d7844dc09a23d0e08ad582827f2743c30339e78 100644 (file)
@@ -89,6 +89,7 @@ module Libvirtd_qemu =
                  | bool_entry "clear_emulator_capabilities"
                  | str_entry "bridge_helper"
                  | str_entry "pr_helper"
+                 | str_entry "slirp_helper"
                  | bool_entry "set_process_name"
                  | int_entry "max_processes"
                  | int_entry "max_files"
index 8cabeccacbe49223bac4ffc2b81c23fde6b49f06..b3a3428e4c8912716fa2d374819f0095c8bbf7a2 100644 (file)
 # used whenever <reservations/> are enabled for SCSI LUN devices.
 #pr_helper = "/usr/bin/qemu-pr-helper"
 
+# Path to the SLIRP networking helper.
+#slirp_helper = "/usr/bin/slirp-helper"
+
 # User for the swtpm TPM Emulator
 #
 # Default is 'tss'; this is the same user that tcsd (TrouSerS) installs
index d771bb69161f662f6eb71b53d537159bb4a6b63b..4f96b0aaa56292ca245a2177fbdd184fc3cdf5c7 100644 (file)
@@ -282,7 +282,8 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged)
     }
 
     if (VIR_STRDUP(cfg->bridgeHelperName, QEMU_BRIDGE_HELPER) < 0 ||
-        VIR_STRDUP(cfg->prHelperName, QEMU_PR_HELPER) < 0)
+        VIR_STRDUP(cfg->prHelperName, QEMU_PR_HELPER) < 0 ||
+        VIR_STRDUP(cfg->slirpHelperName, QEMU_SLIRP_HELPER) < 0)
         goto error;
 
     cfg->clearEmulatorCapabilities = true;
@@ -373,6 +374,7 @@ static void virQEMUDriverConfigDispose(void *obj)
     VIR_FREE(cfg->hugetlbfs);
     VIR_FREE(cfg->bridgeHelperName);
     VIR_FREE(cfg->prHelperName);
+    VIR_FREE(cfg->slirpHelperName);
 
     VIR_FREE(cfg->saveImageFormat);
     VIR_FREE(cfg->dumpImageFormat);
@@ -669,6 +671,9 @@ virQEMUDriverConfigLoadProcessEntry(virQEMUDriverConfigPtr cfg,
     if (virConfGetValueString(conf, "pr_helper", &cfg->prHelperName) < 0)
         return -1;
 
+    if (virConfGetValueString(conf, "slirp_helper", &cfg->slirpHelperName) < 0)
+        return -1;
+
     if (virConfGetValueBool(conf, "set_process_name", &cfg->setProcessName) < 0)
         return -1;
     if (virConfGetValueUInt(conf, "max_processes", &cfg->maxProcesses) < 0)
index 0cbddd7a9c5fa2ad8c2f9ed84398314ef33c3535..a85ae50e14db7326c5bb06a8fa8f2bd6c868a5ad 100644 (file)
@@ -153,6 +153,7 @@ struct _virQEMUDriverConfig {
 
     char *bridgeHelperName;
     char *prHelperName;
+    char *slirpHelperName;
 
     bool macFilter;
 
index 9f81759cb50903250574106640ca6ba810985280..b9cf8d66881b3cfc12011915eaf5034587bf3763 100644 (file)
@@ -104,6 +104,7 @@ module Test_libvirtd_qemu =
 }
 { "memory_backing_dir" = "/var/lib/libvirt/qemu/ram" }
 { "pr_helper" = "/usr/bin/qemu-pr-helper" }
+{ "slirp_helper" = "/usr/bin/slirp-helper" }
 { "swtpm_user" = "tss" }
 { "swtpm_group" = "tss" }
 { "capability_filters"