[libvirt] [PATCH] bhyve: add vga configuration for video driver

Roman Bogorodskiy bogorodskiy at gmail.com
Mon Jun 19 12:48:13 UTC 2017


Add support for vgaconf driver configuration. In domain xml it looks like
this:

  <video>
    <driver vgaconf='io|on|off'>
    <model .../>
  </video>

It was added with bhyve gop video in mind to allow users control how the
video device is exposed to the guest, specifically, how VGA I/O is
handled.

One can refer to the bhyve manual page to get more detailed description
of the possible VGA configuration options:

https://www.freebsd.org/cgi/man.cgi?query=bhyve&manpath=FreeBSD+12-current

The relevant part could be found using the 'vgaconf' keyword.

Also, add some tests for this new feature.

Signed-off-by: Roman Bogorodskiy <bogorodskiy at gmail.com>
---
Changes from v1:

 * Rebased on top of current master. Specifically, the most important bit
   was merging with f5384fb4 which has added video/driver element
 * In conjunction with f5384fb4 use video/driver element instead of 
   video/model/driver
 * Squash in conf and bhyve patches to make it easier to understand how
   it's used
 * Rename *Vgaconf* to *VGAConf*
 * Add a little more tests
 

 docs/schemas/domaincommon.rng                      | 13 ++++-
 src/bhyve/bhyve_command.c                          |  4 ++
 src/conf/domain_conf.c                             | 57 ++++++++++++++++++++--
 src/conf/domain_conf.h                             | 17 +++++++
 src/libvirt_private.syms                           |  2 +
 .../bhyvexml2argv-vnc-vgaconf-io.args              | 12 +++++
 .../bhyvexml2argv-vnc-vgaconf-io.ldargs            |  1 +
 .../bhyvexml2argv-vnc-vgaconf-io.xml               | 30 ++++++++++++
 .../bhyvexml2argv-vnc-vgaconf-off.args             | 12 +++++
 .../bhyvexml2argv-vnc-vgaconf-off.ldargs           |  1 +
 .../bhyvexml2argv-vnc-vgaconf-off.xml              | 30 ++++++++++++
 .../bhyvexml2argv-vnc-vgaconf-on.args              | 12 +++++
 .../bhyvexml2argv-vnc-vgaconf-on.ldargs            |  1 +
 .../bhyvexml2argv-vnc-vgaconf-on.xml               | 30 ++++++++++++
 tests/bhyvexml2argvtest.c                          |  3 ++
 .../bhyvexml2xmlout-vnc-vgaconf-io.xml             | 41 ++++++++++++++++
 .../bhyvexml2xmlout-vnc-vgaconf-off.xml            | 42 ++++++++++++++++
 .../bhyvexml2xmlout-vnc-vgaconf-on.xml             | 42 ++++++++++++++++
 tests/bhyvexml2xmltest.c                           |  3 ++
 19 files changed, 348 insertions(+), 5 deletions(-)
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-io.args
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-io.ldargs
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-io.xml
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-off.args
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-off.ldargs
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-off.xml
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-on.args
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-on.ldargs
 create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-on.xml
 create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-io.xml
 create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-off.xml
 create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-on.xml

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 4950ddc10..51acac3ee 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3220,7 +3220,18 @@
     <element name="video">
       <optional>
         <element name="driver">
-          <ref name="virtioOptions"/>
+          <optional>
+            <ref name="virtioOptions"/>
+          </optional>
+          <optional>
+            <attribute name="vgaconf">
+              <choice>
+                <value>io</value>
+                <value>on</value>
+                <value>off</value>
+              </choice>
+            </attribute>
+          </optional>
         </element>
       </optional>
       <optional>
diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c
index eae5cb3ca..b3ae315bd 100644
--- a/src/bhyve/bhyve_command.c
+++ b/src/bhyve/bhyve_command.c
@@ -408,6 +408,10 @@ bhyveBuildGraphicsArgStr(const virDomainDef *def ATTRIBUTE_UNUSED,
                        _("Unsupported listen type"));
     }
 
+    if (video->driver)
+        virBufferAsprintf(&opt, ",vga=%s",
+                          virDomainVideoVGAConfTypeToString(video->driver->vgaconf));
+
     virCommandAddArg(cmd, "-s");
     virCommandAddArgBuffer(cmd, &opt);
     return 0;
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 4f79d3825..1e9f91ca8 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -560,6 +560,11 @@ VIR_ENUM_IMPL(virDomainVideo, VIR_DOMAIN_VIDEO_TYPE_LAST,
               "virtio",
               "gop")
 
+VIR_ENUM_IMPL(virDomainVideoVGAConf, VIR_DOMAIN_VIDEO_VGACONF_LAST,
+              "io",
+              "on",
+              "off")
+
 VIR_ENUM_IMPL(virDomainInput, VIR_DOMAIN_INPUT_TYPE_LAST,
               "mouse",
               "tablet",
@@ -2355,6 +2360,7 @@ void virDomainVideoDefFree(virDomainVideoDefPtr def)
 
     VIR_FREE(def->accel);
     VIR_FREE(def->virtio);
+    VIR_FREE(def->driver);
     VIR_FREE(def);
 }
 
@@ -13529,6 +13535,43 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node)
     return def;
 }
 
+static virDomainVideoDriverDefPtr
+virDomainVideoDriverDefParseXML(xmlNodePtr node)
+{
+    xmlNodePtr cur;
+    virDomainVideoDriverDefPtr def;
+    char *vgaconf = NULL;
+    int val;
+
+    cur = node->children;
+    while (cur != NULL) {
+        if (cur->type == XML_ELEMENT_NODE) {
+            if (!vgaconf &&
+                xmlStrEqual(cur->name, BAD_CAST "driver")) {
+                vgaconf = virXMLPropString(cur, "vgaconf");
+            }
+        }
+        cur = cur->next;
+    }
+
+    if (!vgaconf)
+        return NULL;
+
+    if (VIR_ALLOC(def) < 0)
+        goto cleanup;
+
+    if ((val = virDomainVideoVGAConfTypeFromString(vgaconf)) <= 0) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("unknown vgaconf value '%s'"), vgaconf);
+        goto cleanup;
+    }
+    def->vgaconf = val;
+
+ cleanup:
+    VIR_FREE(vgaconf);
+    return def;
+}
+
 static virDomainVideoDefPtr
 virDomainVideoDefParseXML(xmlNodePtr node,
                           xmlXPathContextPtr ctxt,
@@ -13652,6 +13695,8 @@ virDomainVideoDefParseXML(xmlNodePtr node,
     if (virDomainVirtioOptionsParseXML(ctxt, &def->virtio) < 0)
         goto error;
 
+    def->driver = virDomainVideoDriverDefParseXML(node);
+
  cleanup:
     ctxt->node = saved;
 
@@ -23386,7 +23431,6 @@ virDomainVideoAccelDefFormat(virBufferPtr buf,
     virBufferAddLit(buf, "/>\n");
 }
 
-
 static int
 virDomainVideoDefFormat(virBufferPtr buf,
                         virDomainVideoDefPtr def,
@@ -23406,9 +23450,13 @@ virDomainVideoDefFormat(virBufferPtr buf,
     virDomainVirtioOptionsFormat(&driverBuf, def->virtio);
     if (virBufferCheckError(&driverBuf) < 0)
         return -1;
-    if (virBufferUse(&driverBuf)) {
+    if (virBufferUse(&driverBuf) || (def->driver && def->driver->vgaconf)) {
         virBufferAddLit(buf, "<driver");
-        virBufferAddBuffer(buf, &driverBuf);
+        if (virBufferUse(&driverBuf))
+            virBufferAddBuffer(buf, &driverBuf);
+        if (def->driver && def->driver->vgaconf)
+            virBufferAsprintf(buf, " vgaconf='%s'",
+                              virDomainVideoVGAConfTypeToString(def->driver->vgaconf));
         virBufferAddLit(buf, "/>\n");
     }
     virBufferAsprintf(buf, "<model type='%s'",
@@ -23428,7 +23476,8 @@ virDomainVideoDefFormat(virBufferPtr buf,
     if (def->accel) {
         virBufferAddLit(buf, ">\n");
         virBufferAdjustIndent(buf, 2);
-        virDomainVideoAccelDefFormat(buf, def->accel);
+        if (def->accel)
+            virDomainVideoAccelDefFormat(buf, def->accel);
         virBufferAdjustIndent(buf, -2);
         virBufferAddLit(buf, "</model>\n");
     } else {
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 6d9ee9787..964bc02f9 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1359,6 +1359,16 @@ typedef enum {
 } virDomainVideoType;
 
 
+typedef enum {
+    VIR_DOMAIN_VIDEO_VGACONF_IO = 0,
+    VIR_DOMAIN_VIDEO_VGACONF_ON,
+    VIR_DOMAIN_VIDEO_VGACONF_OFF,
+
+    VIR_DOMAIN_VIDEO_VGACONF_LAST
+} virDomainVideoVGAConf;
+
+VIR_ENUM_DECL(virDomainVideoVGAConf)
+
 typedef struct _virDomainVideoAccelDef virDomainVideoAccelDef;
 typedef virDomainVideoAccelDef *virDomainVideoAccelDefPtr;
 struct _virDomainVideoAccelDef {
@@ -1367,6 +1377,12 @@ struct _virDomainVideoAccelDef {
 };
 
 
+typedef struct _virDomainVideoDriverDef virDomainVideoDriverDef;
+typedef virDomainVideoDriverDef *virDomainVideoDriverDefPtr;
+struct _virDomainVideoDriverDef {
+   virDomainVideoVGAConf vgaconf;
+};
+
 struct _virDomainVideoDef {
     int type;
     unsigned int ram;  /* kibibytes (multiples of 1024) */
@@ -1376,6 +1392,7 @@ struct _virDomainVideoDef {
     unsigned int heads;
     bool primary;
     virDomainVideoAccelDefPtr accel;
+    virDomainVideoDriverDefPtr driver;
     virDomainDeviceInfo info;
     virDomainVirtioOptionsPtr virtio;
 };
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 044510f09..41ca62631 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -530,6 +530,8 @@ virDomainVideoDefaultType;
 virDomainVideoDefFree;
 virDomainVideoTypeFromString;
 virDomainVideoTypeToString;
+virDomainVideoVGAConfTypeFromString;
+virDomainVideoVGAConfTypeToString;
 virDomainVirtTypeFromString;
 virDomainVirtTypeToString;
 virDomainWatchdogActionTypeFromString;
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-io.args b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-io.args
new file mode 100644
index 000000000..da3797100
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-io.args
@@ -0,0 +1,12 @@
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-u \
+-H \
+-P \
+-s 0:0,hostbridge \
+-l bootrom,/path/to/test.fd \
+-s 2:0,ahci,hd:/tmp/freebsd.img \
+-s 3:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 \
+-s 4:0,fbuf,tcp=127.0.0.1:5904,vga=io \
+-s 1,lpc bhyve
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-io.ldargs b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-io.ldargs
new file mode 100644
index 000000000..421376db9
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-io.ldargs
@@ -0,0 +1 @@
+dummy
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-io.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-io.xml
new file mode 100644
index 000000000..b1bb3793d
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-io.xml
@@ -0,0 +1,30 @@
+<domain type='bhyve'>
+  <name>bhyve</name>
+  <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
+  <memory>219136</memory>
+  <vcpu>1</vcpu>
+  <os>
+    <type>hvm</type>
+    <loader readonly="yes" type="pflash">/path/to/test.fd</loader>
+  </os>
+  <devices>
+    <disk type='file'>
+      <driver name='file' type='raw'/>
+      <source file='/tmp/freebsd.img'/>
+      <target dev='hda' bus='sata'/>
+      <address type='drive' controller='0' bus='0' target='2' unit='0'/>
+    </disk>
+    <interface type='bridge'>
+      <model type='virtio'/>
+      <source bridge="virbr0"/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </interface>
+    <graphics type='vnc' port='5904'>
+      <listen type='address' address='127.0.0.1'/>
+    </graphics>
+    <video>
+      <driver vgaconf="io"/>
+      <model type='gop' heads='1' primary='yes'/>
+    </video>
+  </devices>
+</domain>
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-off.args b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-off.args
new file mode 100644
index 000000000..70347ee0b
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-off.args
@@ -0,0 +1,12 @@
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-u \
+-H \
+-P \
+-s 0:0,hostbridge \
+-l bootrom,/path/to/test.fd \
+-s 2:0,ahci,hd:/tmp/freebsd.img \
+-s 3:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 \
+-s 4:0,fbuf,tcp=127.0.0.1:5904,vga=off \
+-s 1,lpc bhyve
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-off.ldargs b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-off.ldargs
new file mode 100644
index 000000000..421376db9
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-off.ldargs
@@ -0,0 +1 @@
+dummy
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-off.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-off.xml
new file mode 100644
index 000000000..6e9582840
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-off.xml
@@ -0,0 +1,30 @@
+<domain type='bhyve'>
+  <name>bhyve</name>
+  <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
+  <memory>219136</memory>
+  <vcpu>1</vcpu>
+  <os>
+    <type>hvm</type>
+    <loader readonly="yes" type="pflash">/path/to/test.fd</loader>
+  </os>
+  <devices>
+    <disk type='file'>
+      <driver name='file' type='raw'/>
+      <source file='/tmp/freebsd.img'/>
+      <target dev='hda' bus='sata'/>
+      <address type='drive' controller='0' bus='0' target='2' unit='0'/>
+    </disk>
+    <interface type='bridge'>
+      <model type='virtio'/>
+      <source bridge="virbr0"/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </interface>
+    <graphics type='vnc' port='5904'>
+      <listen type='address' address='127.0.0.1'/>
+    </graphics>
+    <video>
+      <driver vgaconf="off"/>
+      <model type='gop' heads='1' primary='yes'/>
+    </video>
+  </devices>
+</domain>
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-on.args b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-on.args
new file mode 100644
index 000000000..d0e1d81e2
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-on.args
@@ -0,0 +1,12 @@
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-u \
+-H \
+-P \
+-s 0:0,hostbridge \
+-l bootrom,/path/to/test.fd \
+-s 2:0,ahci,hd:/tmp/freebsd.img \
+-s 3:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 \
+-s 4:0,fbuf,tcp=127.0.0.1:5904,vga=on \
+-s 1,lpc bhyve
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-on.ldargs b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-on.ldargs
new file mode 100644
index 000000000..421376db9
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-on.ldargs
@@ -0,0 +1 @@
+dummy
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-on.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-on.xml
new file mode 100644
index 000000000..a270f6334
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-on.xml
@@ -0,0 +1,30 @@
+<domain type='bhyve'>
+  <name>bhyve</name>
+  <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
+  <memory>219136</memory>
+  <vcpu>1</vcpu>
+  <os>
+    <type>hvm</type>
+    <loader readonly="yes" type="pflash">/path/to/test.fd</loader>
+  </os>
+  <devices>
+    <disk type='file'>
+      <driver name='file' type='raw'/>
+      <source file='/tmp/freebsd.img'/>
+      <target dev='hda' bus='sata'/>
+      <address type='drive' controller='0' bus='0' target='2' unit='0'/>
+    </disk>
+    <interface type='bridge'>
+      <model type='virtio'/>
+      <source bridge="virbr0"/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </interface>
+    <graphics type='vnc' port='5904'>
+      <listen type='address' address='127.0.0.1'/>
+    </graphics>
+    <video>
+      <driver vgaconf="on"/>
+      <model type='gop' heads='1' primary='yes'/>
+    </video>
+  </devices>
+</domain>
diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c
index c8f8c685a..72f10ebc1 100644
--- a/tests/bhyvexml2argvtest.c
+++ b/tests/bhyvexml2argvtest.c
@@ -193,6 +193,9 @@ mymain(void)
     DO_TEST("net-e1000");
     DO_TEST("uefi");
     DO_TEST("vnc");
+    DO_TEST("vnc-vgaconf-on");
+    DO_TEST("vnc-vgaconf-off");
+    DO_TEST("vnc-vgaconf-io");
 
     /* Address allocation tests */
     DO_TEST("addr-single-sata-disk");
diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-io.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-io.xml
new file mode 100644
index 000000000..9e470e432
--- /dev/null
+++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-io.xml
@@ -0,0 +1,41 @@
+<domain type='bhyve'>
+  <name>bhyve</name>
+  <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64'>hvm</type>
+    <loader readonly='yes' type='pflash'>/path/to/test.fd</loader>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <disk type='file' device='disk'>
+      <driver name='file' type='raw'/>
+      <source file='/tmp/freebsd.img'/>
+      <target dev='hda' bus='sata'/>
+      <address type='drive' controller='0' bus='0' target='2' unit='0'/>
+    </disk>
+    <controller type='pci' index='0' model='pci-root'/>
+    <controller type='sata' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+    </controller>
+    <interface type='bridge'>
+      <mac address='52:54:00:00:00:00'/>
+      <source bridge='virbr0'/>
+      <model type='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </interface>
+    <graphics type='vnc' port='5904' autoport='no' listen='127.0.0.1'>
+      <listen type='address' address='127.0.0.1'/>
+    </graphics>
+    <video>
+      <model type='gop' heads='1' primary='yes'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </video>
+  </devices>
+</domain>
diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-off.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-off.xml
new file mode 100644
index 000000000..89c4ceac5
--- /dev/null
+++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-off.xml
@@ -0,0 +1,42 @@
+<domain type='bhyve'>
+  <name>bhyve</name>
+  <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64'>hvm</type>
+    <loader readonly='yes' type='pflash'>/path/to/test.fd</loader>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <disk type='file' device='disk'>
+      <driver name='file' type='raw'/>
+      <source file='/tmp/freebsd.img'/>
+      <target dev='hda' bus='sata'/>
+      <address type='drive' controller='0' bus='0' target='2' unit='0'/>
+    </disk>
+    <controller type='pci' index='0' model='pci-root'/>
+    <controller type='sata' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+    </controller>
+    <interface type='bridge'>
+      <mac address='52:54:00:00:00:00'/>
+      <source bridge='virbr0'/>
+      <model type='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </interface>
+    <graphics type='vnc' port='5904' autoport='no' listen='127.0.0.1'>
+      <listen type='address' address='127.0.0.1'/>
+    </graphics>
+    <video>
+      <driver vgaconf='off'/>
+      <model type='gop' heads='1' primary='yes'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </video>
+  </devices>
+</domain>
diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-on.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-on.xml
new file mode 100644
index 000000000..86d893936
--- /dev/null
+++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-on.xml
@@ -0,0 +1,42 @@
+<domain type='bhyve'>
+  <name>bhyve</name>
+  <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64'>hvm</type>
+    <loader readonly='yes' type='pflash'>/path/to/test.fd</loader>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <disk type='file' device='disk'>
+      <driver name='file' type='raw'/>
+      <source file='/tmp/freebsd.img'/>
+      <target dev='hda' bus='sata'/>
+      <address type='drive' controller='0' bus='0' target='2' unit='0'/>
+    </disk>
+    <controller type='pci' index='0' model='pci-root'/>
+    <controller type='sata' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+    </controller>
+    <interface type='bridge'>
+      <mac address='52:54:00:00:00:00'/>
+      <source bridge='virbr0'/>
+      <model type='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </interface>
+    <graphics type='vnc' port='5904' autoport='no' listen='127.0.0.1'>
+      <listen type='address' address='127.0.0.1'/>
+    </graphics>
+    <video>
+      <driver vgaconf='on'/>
+      <model type='gop' heads='1' primary='yes'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </video>
+  </devices>
+</domain>
diff --git a/tests/bhyvexml2xmltest.c b/tests/bhyvexml2xmltest.c
index b3759919e..8e41088a8 100644
--- a/tests/bhyvexml2xmltest.c
+++ b/tests/bhyvexml2xmltest.c
@@ -105,6 +105,9 @@ mymain(void)
     DO_TEST_DIFFERENT("serial-grub");
     DO_TEST_DIFFERENT("serial-grub-nocons");
     DO_TEST_DIFFERENT("vnc");
+    DO_TEST_DIFFERENT("vnc-vgaconf-on");
+    DO_TEST_DIFFERENT("vnc-vgaconf-off");
+    DO_TEST_DIFFERENT("vnc-vgaconf-io");
 
     /* Address allocation tests */
     DO_TEST_DIFFERENT("addr-single-sata-disk");
-- 
2.13.0




More information about the libvir-list mailing list