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

Roman Bogorodskiy posted 4 patches 5 years, 4 months ago
[PATCH v2 3/4] bhyve: probe for VNC password capability
Posted by Roman Bogorodskiy 5 years, 4 months ago
From: Fabian Freyer <fabian.freyer@physik.tu-berlin.de>

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@physik.tu-berlin.de>
Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
---
 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 36f3985335..523a31e287 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
@@ -334,6 +334,17 @@ bhyveProbeCapsSoundHda(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)
 {
@@ -365,6 +376,9 @@ virBhyveProbeCaps(unsigned int *caps)
     if ((ret = bhyveProbeCapsSoundHda(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 1ac9ff4283..b2a16b0189 100644
--- a/src/bhyve/bhyve_capabilities.h
+++ b/src/bhyve/bhyve_capabilities.h
@@ -50,6 +50,7 @@ typedef enum {
     BHYVE_CAP_XHCI = 1 << 5,
     BHYVE_CAP_CPUTOPOLOGY = 1 << 6,
     BHYVE_CAP_SOUND_HDA = 1 << 7,
+    BHYVE_CAP_VNC_PASSWORD = 1 << 8,
 } virBhyveCapsFlags;
 
 int virBhyveProbeGrubCaps(virBhyveGrubCapsFlags *caps);
-- 
2.27.0

Re: [PATCH v2 3/4] bhyve: probe for VNC password capability
Posted by Daniel P. Berrangé 5 years, 4 months ago
On Tue, Sep 22, 2020 at 04:28:50PM +0400, Roman Bogorodskiy wrote:
> From: Fabian Freyer <fabian.freyer@physik.tu-berlin.de>
> 
> 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@physik.tu-berlin.de>
> Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
> ---
>  src/bhyve/bhyve_capabilities.c | 16 +++++++++++++++-
>  src/bhyve/bhyve_capabilities.h |  1 +
>  2 files changed, 16 insertions(+), 1 deletion(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|