[PATCH] bhyve: relax emulator binary value check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently, requesting domain capabilities fails when the specified
emulator binary does not equal to "/usr/sbin/bhyve". Relax this check
to allow any path with basename "bhyve", as it's a common case when
binary is specified without an absolute path.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@xxxxxxxxx>
---
I'm not sure how useful is this check in general: at this point we don't
use the user specified emulator value anyway, just use BHYVE constant.
Probably it would be better to just drop the entire "else" block?

 src/bhyve/bhyve_driver.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index 78c3241293..277be8dbb0 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -1647,11 +1647,14 @@ bhyveConnectGetDomainCapabilities(virConnectPtr conn,
 
     if (emulatorbin == NULL) {
         emulatorbin = "/usr/sbin/bhyve";
-    } else if (STRNEQ(emulatorbin, "/usr/sbin/bhyve")) {
-        virReportError(VIR_ERR_INVALID_ARG,
-                       _("unknown emulator binary: %s"),
-                       emulatorbin);
-        goto cleanup;
+    } else {
+        g_autofree char *emulatorbasename = g_path_get_basename(emulatorbin);
+        if (STRNEQ(emulatorbasename, "bhyve")) {
+            virReportError(VIR_ERR_INVALID_ARG,
+                           _("unknown emulator binary: %s"),
+                           emulatorbin);
+            goto cleanup;
+        }
     }
 
     if (!(caps = virBhyveDomainCapsBuild(conn->privateData, emulatorbin,
-- 
2.30.0




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux