Connect domain XML <driver vgaconf=""> configuration (introduced in a previous patch) to bhyve command generation. Unfortunately, this option was documented just recently and at the time of writing official online manpages didn't have it updated, so for now one can refer to: https://github.com/freebsd/freebsd/blob/master/usr.sbin/bhyve/bhyve.8#L327 for the detailed description of the possible vga configuration options. Also, add some tests for this new feature. Signed-off-by: Roman Bogorodskiy <bogorodskiy@xxxxxxxxx> --- src/bhyve/bhyve_command.c | 4 ++ .../bhyvexml2argv-vnc-vgaconf.args | 12 ++++++ .../bhyvexml2argv-vnc-vgaconf.ldargs | 1 + .../bhyvexml2argv-vnc-vgaconf.xml | 31 ++++++++++++++++ tests/bhyvexml2argvtest.c | 1 + .../bhyvexml2xmlout-vnc-vgaconf.xml | 43 ++++++++++++++++++++++ tests/bhyvexml2xmltest.c | 1 + 7 files changed, 93 insertions(+) create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf.args create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf.ldargs create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf.xml create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf.xml diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index eae5cb3ca..f70e3bc60 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/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf.args b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf.args new file mode 100644 index 000000000..70347ee0b --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf.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.ldargs b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf.ldargs new file mode 100644 index 000000000..421376db9 --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf.ldargs @@ -0,0 +1 @@ +dummy diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf.xml new file mode 100644 index 000000000..f1bcd1bde --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-vgaconf.xml @@ -0,0 +1,31 @@ +<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> + <model type='gop' heads='1' primary='yes'> + <driver vgaconf='off'/> + </model> + </video> + </devices> +</domain> diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c index c8f8c685a..a369a447a 100644 --- a/tests/bhyvexml2argvtest.c +++ b/tests/bhyvexml2argvtest.c @@ -193,6 +193,7 @@ mymain(void) DO_TEST("net-e1000"); DO_TEST("uefi"); DO_TEST("vnc"); + DO_TEST("vnc-vgaconf"); /* Address allocation tests */ DO_TEST("addr-single-sata-disk"); diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf.xml new file mode 100644 index 000000000..6cc1aa088 --- /dev/null +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-vgaconf.xml @@ -0,0 +1,43 @@ +<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'> + <driver vgaconf='off'/> + </model> + <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..70e4caeb3 100644 --- a/tests/bhyvexml2xmltest.c +++ b/tests/bhyvexml2xmltest.c @@ -105,6 +105,7 @@ mymain(void) DO_TEST_DIFFERENT("serial-grub"); DO_TEST_DIFFERENT("serial-grub-nocons"); DO_TEST_DIFFERENT("vnc"); + DO_TEST_DIFFERENT("vnc-vgaconf"); /* Address allocation tests */ DO_TEST_DIFFERENT("addr-single-sata-disk"); -- 2.12.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list