[PATCH 3/4] bhyve: probe for VNC password capability

Fabian Freyer fabian.freyer at physik.tu-berlin.de
Wed May 6 13:35:54 UTC 2020


Introduces the BHYVE_CAP_VNC_PASSWORD capability, which is probed by
parsing the error message from the bhyve command. When it is not
supported, bhyve -s 0,fbuf,password= will return an error message.

Signed-off-by: Fabian Freyer <fabian.freyer at physik.tu-berlin.de>
---
 src/bhyve/bhyve_capabilities.c | 16 +++++++++++++++-
 src/bhyve/bhyve_capabilities.h |  1 +
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/bhyve/bhyve_capabilities.c b/src/bhyve/bhyve_capabilities.c
index fb8829d571..59783f8576 100644
--- a/src/bhyve/bhyve_capabilities.c
+++ b/src/bhyve/bhyve_capabilities.c
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2014 Roman Bogorodskiy
  * Copyright (C) 2014 Semihalf
- * Copyright (C) 2016 Fabian Freyer
+ * Copyright (C) 2020 Fabian Freyer
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -323,6 +323,17 @@ bhyveProbeCapsXHCIController(unsigned int *caps, char *binary)
 }
 
 
+static int
+bhyveProbeCapsVNCPassword(unsigned int *caps, char *binary)
+{
+    return bhyveProbeCapsDeviceHelper(caps, binary,
+                                      "-s",
+                                      "0,fbuf,password=",
+                                      "Invalid fbuf emulation \"password\"",
+                                      BHYVE_CAP_VNC_PASSWORD);
+}
+
+
 int
 virBhyveProbeCaps(unsigned int *caps)
 {
@@ -351,6 +362,9 @@ virBhyveProbeCaps(unsigned int *caps)
     if ((ret = bhyveProbeCapsXHCIController(caps, binary)))
         goto out;
 
+    if ((ret = bhyveProbeCapsVNCPassword(caps, binary)))
+        goto out;
+
  out:
     VIR_FREE(binary);
     return ret;
diff --git a/src/bhyve/bhyve_capabilities.h b/src/bhyve/bhyve_capabilities.h
index 12926cf423..89f4b0308e 100644
--- a/src/bhyve/bhyve_capabilities.h
+++ b/src/bhyve/bhyve_capabilities.h
@@ -49,6 +49,7 @@ typedef enum {
     BHYVE_CAP_FBUF = 1 << 4,
     BHYVE_CAP_XHCI = 1 << 5,
     BHYVE_CAP_CPUTOPOLOGY = 1 << 6,
+    BHYVE_CAP_VNC_PASSWORD = 1 << 7,
 } virBhyveCapsFlags;
 
 int virBhyveProbeGrubCaps(virBhyveGrubCapsFlags *caps);
-- 
2.19.2





More information about the libvir-list mailing list