diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index a55a9e1392..36bea67c38 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -6156,7 +6156,14 @@ qemu-kvm -net nic,model=? /dev/null
virtio options
Virtio-specific options can also be - set. (Since 3.5.0) + set (Since 3.5.0) +
+
VGA configuration
+
+ Control how the video devices exposed to the guest using the + vgaconf attribute which takes the value "io", "on" or "off". + At present, it's only applicable to the bhyve's "gop" video model type + (Since 3.5.0)
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index e259e3ee25..bdf7103d76 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3220,7 +3220,18 @@ - + + + + + + + io + on + off + + + diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index eae5cb3caf..b3ae315bde 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 ce00dfa78d..c3149f9769 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); } @@ -13598,6 +13604,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, @@ -13721,6 +13764,8 @@ virDomainVideoDefParseXML(xmlNodePtr node, if (virDomainVirtioOptionsParseXML(ctxt, &def->virtio) < 0) goto error; + def->driver = virDomainVideoDriverDefParseXML(node); + cleanup: ctxt->node = saved; @@ -23455,7 +23500,6 @@ virDomainVideoAccelDefFormat(virBufferPtr buf, virBufferAddLit(buf, "/>\n"); } - static int virDomainVideoDefFormat(virBufferPtr buf, virDomainVideoDefPtr def, @@ -23475,9 +23519,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 && def->driver->vgaconf) + virBufferAsprintf(buf, " vgaconf='%s'", + virDomainVideoVGAConfTypeToString(def->driver->vgaconf)); virBufferAddLit(buf, "/>\n"); } virBufferAsprintf(buf, "accel) { virBufferAddLit(buf, ">\n"); virBufferAdjustIndent(buf, 2); - virDomainVideoAccelDefFormat(buf, def->accel); + if (def->accel) + virDomainVideoAccelDefFormat(buf, def->accel); virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); } else { diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 6d9ee9787f..964bc02f9f 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 c1e9471c58..888412ac78 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 0000000000..da37971009 --- /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 0000000000..421376db9e --- /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 0000000000..b1bb3793d5 --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-io.xml @@ -0,0 +1,30 @@ + + bhyve + df3be7e7-a104-11e3-aeb0-50e5492bd3dc + 219136 + 1 + + hvm + /path/to/test.fd + + + + + + +
+ + + + +
+ + + + + + + diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-off.args b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-off.args new file mode 100644 index 0000000000..70347ee0b6 --- /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 0000000000..421376db9e --- /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 0000000000..6e95828401 --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-off.xml @@ -0,0 +1,30 @@ + + bhyve + df3be7e7-a104-11e3-aeb0-50e5492bd3dc + 219136 + 1 + + hvm + /path/to/test.fd + + + + + + +
+ + + + +
+ + + + + + + diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-on.args b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-on.args new file mode 100644 index 0000000000..d0e1d81e2a --- /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 0000000000..421376db9e --- /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 0000000000..a270f63340 --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf-on.xml @@ -0,0 +1,30 @@ + + bhyve + df3be7e7-a104-11e3-aeb0-50e5492bd3dc + 219136 + 1 + + hvm + /path/to/test.fd + + + + + + +
+ + + + +
+ + + + + + + diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c index c8f8c685a9..72f10ebc1c 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 0000000000..9e470e432e --- /dev/null +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf-io.xml @@ -0,0 +1,41 @@ + + bhyve + df3be7e7-a104-11e3-aeb0-50e5492bd3dc + 219136 + 219136 + 1 + + hvm + /path/to/test.fd + + + + destroy + restart + destroy + + + + + +
+ + + +
+ + + + + +
+ + + + +