[PATCH 0/2] bhyve: support VNC 'wait' attribute
Roman Bogorodskiy (2): conf: introduce 'wait' attribute for VNC bhyve: support VNC 'wait' attribute src/bhyve/bhyve_command.c | 3 ++ src/conf/domain_conf.c | 11 +++++ src/conf/domain_conf.h | 1 + src/conf/schemas/domaincommon.rng | 5 +++ .../bhyvexml2argv-vnc-wait-no.args | 13 ++++++ .../bhyvexml2argv-vnc-wait-no.ldargs | 1 + .../bhyvexml2argv-vnc-wait-no.xml | 26 +++++++++++ .../bhyvexml2argv-vnc-wait.args | 13 ++++++ .../bhyvexml2argv-vnc-wait.ldargs | 1 + .../bhyvexml2argv-vnc-wait.xml | 26 +++++++++++ tests/bhyvexml2argvtest.c | 2 + .../bhyvexml2xmlout-vnc-wait-no.xml | 44 +++++++++++++++++++ .../bhyvexml2xmlout-vnc-wait.xml | 44 +++++++++++++++++++ tests/bhyvexml2xmltest.c | 2 + 14 files changed, 192 insertions(+) create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait-no.args create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait-no.ldargs create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait-no.xml create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait.args create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait.ldargs create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait.xml create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-wait-no.xml create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-wait.xml -- 2.51.2
Introduce an optional 'wait' attribute for 'VNC'. When set to 'yes', VM should only boot upon the initiation of a VNC connection. Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com> --- src/conf/domain_conf.c | 11 +++++++++++ src/conf/domain_conf.h | 1 + src/conf/schemas/domaincommon.rng | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d2dea6952e..36cc1916d0 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -11891,6 +11891,7 @@ virDomainGraphicsDefParseXMLVNC(virDomainGraphicsDef *def, xmlNodePtr audioNode; virTristateBool autoport; virTristateBool websocketGenerated; + virTristateBool wait; VIR_XPATH_NODE_AUTORESTORE(ctxt) if (virDomainGraphicsListensParseXML(def, node, ctxt, flags) < 0) @@ -11940,6 +11941,12 @@ virDomainGraphicsDefParseXMLVNC(virDomainGraphicsDef *def, def->data.vnc.keymap = virXMLPropString(node, "keymap"); + if (virXMLPropTristateBool(node, "wait", VIR_XML_PROP_NONE, + &wait) < 0) + return -1; + + virTristateBoolToBool(wait, &def->data.vnc.wait); + ctxt->node = node; audioNode = virXPathNode("./audio", ctxt); if (audioNode) { @@ -27213,6 +27220,10 @@ virDomainGraphicsDefFormatVNC(virBuffer *attrBuf, virBufferAsprintf(attrBuf, " websocketGenerated='%s'", def->data.vnc.websocketGenerated ? "yes" : "no"); + if (def->data.vnc.wait != VIR_TRISTATE_BOOL_ABSENT) + virBufferAsprintf(attrBuf, " wait='%s'", + virTristateBoolTypeToString(def->data.vnc.wait)); + virDomainGraphicsListenDefFormatAddr(attrBuf, glisten, flags); break; case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 11eb46ae53..e47e10c90c 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2048,6 +2048,7 @@ struct _virDomainGraphicsDef { virDomainGraphicsVNCSharePolicy sharePolicy; virTristateBool powerControl; unsigned int audioId; + bool wait; } vnc; struct { char *display; diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng index 75b5124c33..67bbcbeb0b 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -4358,6 +4358,11 @@ <ref name="virYesNo"/> </attribute> </optional> + <optional> + <attribute name="wait"> + <ref name="virYesNo"/> + </attribute> + </optional> </group> <group> <optional> -- 2.51.2
On Wed, Nov 19, 2025 at 06:54:25PM +0100, Roman Bogorodskiy wrote:
Introduce an optional 'wait' attribute for 'VNC'. When set to 'yes', VM should only boot upon the initiation of a VNC connection.
Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com> --- src/conf/domain_conf.c | 11 +++++++++++ src/conf/domain_conf.h | 1 + src/conf/schemas/domaincommon.rng | 5 +++++ 3 files changed, 17 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d2dea6952e..36cc1916d0 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -11891,6 +11891,7 @@ virDomainGraphicsDefParseXMLVNC(virDomainGraphicsDef *def, xmlNodePtr audioNode; virTristateBool autoport; virTristateBool websocketGenerated; + virTristateBool wait; VIR_XPATH_NODE_AUTORESTORE(ctxt)
if (virDomainGraphicsListensParseXML(def, node, ctxt, flags) < 0) @@ -11940,6 +11941,12 @@ virDomainGraphicsDefParseXMLVNC(virDomainGraphicsDef *def,
def->data.vnc.keymap = virXMLPropString(node, "keymap");
+ if (virXMLPropTristateBool(node, "wait", VIR_XML_PROP_NONE, + &wait) < 0) + return -1; + + virTristateBoolToBool(wait, &def->data.vnc.wait); +
def->data.vnc.wait is a bool, yes
ctxt->node = node; audioNode = virXPathNode("./audio", ctxt); if (audioNode) { @@ -27213,6 +27220,10 @@ virDomainGraphicsDefFormatVNC(virBuffer *attrBuf, virBufferAsprintf(attrBuf, " websocketGenerated='%s'", def->data.vnc.websocketGenerated ? "yes" : "no");
+ if (def->data.vnc.wait != VIR_TRISTATE_BOOL_ABSENT) + virBufferAsprintf(attrBuf, " wait='%s'", + virTristateBoolTypeToString(def->data.vnc.wait));
But then you are treating it here as virTristateBool again.
+ virDomainGraphicsListenDefFormatAddr(attrBuf, glisten, flags); break; case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 11eb46ae53..e47e10c90c 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2048,6 +2048,7 @@ struct _virDomainGraphicsDef { virDomainGraphicsVNCSharePolicy sharePolicy; virTristateBool powerControl; unsigned int audioId; + bool wait;
I would suggest changing this to `virTristateBool wait;`, dropping the temporary @wait variable in the first hunk and just stick the value directly here when parsing. The current behaviour means you will lose any `wait="no"` in the parsed XML output (see PATCH 2/2, file tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-wait-no.xml where it disappears), and my suggestion keeps it around. With that one change (and tests adjusted): Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Bhyve supports the 'wait' option for the VNC device configuration. When enabled, VM boots only upon a VNC connection. Sample device configuration looks like this: -s 29,fbuf,tcp=0.0.0.0:5900,w=800,h=600,wait Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com> --- src/bhyve/bhyve_command.c | 3 ++ .../bhyvexml2argv-vnc-wait-no.args | 13 ++++++ .../bhyvexml2argv-vnc-wait-no.ldargs | 1 + .../bhyvexml2argv-vnc-wait-no.xml | 26 +++++++++++ .../bhyvexml2argv-vnc-wait.args | 13 ++++++ .../bhyvexml2argv-vnc-wait.ldargs | 1 + .../bhyvexml2argv-vnc-wait.xml | 26 +++++++++++ tests/bhyvexml2argvtest.c | 2 + .../bhyvexml2xmlout-vnc-wait-no.xml | 44 +++++++++++++++++++ .../bhyvexml2xmlout-vnc-wait.xml | 44 +++++++++++++++++++ tests/bhyvexml2xmltest.c | 2 + 11 files changed, 175 insertions(+) create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait-no.args create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait-no.ldargs create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait-no.xml create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait.args create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait.ldargs create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait.xml create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-wait-no.xml create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-wait.xml diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index 8bfd5a6f93..057715102e 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -651,6 +651,9 @@ bhyveBuildGraphicsArgStr(const virDomainDef *def, virBufferAsprintf(&opt, ",vga=%s", virDomainVideoVGAConfTypeToString(video->driver->vgaconf)); + if (graphics->data.vnc.wait) + virBufferAddLit(&opt, ",wait"); + virCommandAddArg(cmd, "-s"); virCommandAddArgBuffer(cmd, &opt); return 0; diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait-no.args b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait-no.args new file mode 100644 index 0000000000..049e65227d --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait-no.args @@ -0,0 +1,13 @@ +bhyve \ +-c 1 \ +-m 214 \ +-u \ +-H \ +-P \ +-s 0:0,hostbridge \ +-l bootrom,/path/to/test.fd \ +-s 1:0,lpc \ +-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 \ +bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait-no.ldargs b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait-no.ldargs new file mode 100644 index 0000000000..421376db9e --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait-no.ldargs @@ -0,0 +1 @@ +dummy diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait-no.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait-no.xml new file mode 100644 index 0000000000..61c028bfc7 --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait-no.xml @@ -0,0 +1,26 @@ +<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' wait='no'> + <listen type='address' address='127.0.0.1'/> + </graphics> + </devices> +</domain> diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait.args b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait.args new file mode 100644 index 0000000000..4394bdfb4b --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait.args @@ -0,0 +1,13 @@ +bhyve \ +-c 1 \ +-m 214 \ +-u \ +-H \ +-P \ +-s 0:0,hostbridge \ +-l bootrom,/path/to/test.fd \ +-s 1:0,lpc \ +-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,wait \ +bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait.ldargs b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait.ldargs new file mode 100644 index 0000000000..421376db9e --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait.ldargs @@ -0,0 +1 @@ +dummy diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait.xml new file mode 100644 index 0000000000..8cfd40ad7d --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait.xml @@ -0,0 +1,26 @@ +<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' wait='yes'> + <listen type='address' address='127.0.0.1'/> + </graphics> + </devices> +</domain> diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c index 2a785ef8aa..650313c2da 100644 --- a/tests/bhyvexml2argvtest.c +++ b/tests/bhyvexml2argvtest.c @@ -235,6 +235,8 @@ mymain(void) DO_TEST("vnc-autoport"); DO_TEST("vnc-resolution"); DO_TEST("vnc-password"); + DO_TEST("vnc-wait"); + DO_TEST("vnc-wait-no"); DO_TEST_FAILURE("vnc-password-comma"); DO_TEST("cputopology"); DO_TEST_FAILURE("cputopology-nvcpu-mismatch"); diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-wait-no.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-wait-no.xml new file mode 100644 index 0000000000..58e71282e7 --- /dev/null +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-wait-no.xml @@ -0,0 +1,44 @@ +<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='isa' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> + <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-wait.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-wait.xml new file mode 100644 index 0000000000..d5ff19bd41 --- /dev/null +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-wait.xml @@ -0,0 +1,44 @@ +<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='isa' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> + </controller> + <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' wait='yes' 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/bhyvexml2xmltest.c b/tests/bhyvexml2xmltest.c index 97c8647192..c2458b9fc4 100644 --- a/tests/bhyvexml2xmltest.c +++ b/tests/bhyvexml2xmltest.c @@ -109,6 +109,8 @@ mymain(void) DO_TEST_DIFFERENT("vnc-autoport"); DO_TEST_DIFFERENT("vnc-resolution"); DO_TEST_DIFFERENT("vnc-password"); + DO_TEST_DIFFERENT("vnc-wait"); + DO_TEST_DIFFERENT("vnc-wait-no"); DO_TEST_DIFFERENT("commandline"); DO_TEST_DIFFERENT("msrs"); DO_TEST_DIFFERENT("sound"); -- 2.51.2
On Wed, Nov 19, 2025 at 06:54:26PM +0100, Roman Bogorodskiy wrote:
Bhyve supports the 'wait' option for the VNC device configuration. When enabled, VM boots only upon a VNC connection.
Sample device configuration looks like this:
-s 29,fbuf,tcp=0.0.0.0:5900,w=800,h=600,wait
Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com> --- src/bhyve/bhyve_command.c | 3 ++ .../bhyvexml2argv-vnc-wait-no.args | 13 ++++++ .../bhyvexml2argv-vnc-wait-no.ldargs | 1 + .../bhyvexml2argv-vnc-wait-no.xml | 26 +++++++++++ .../bhyvexml2argv-vnc-wait.args | 13 ++++++ .../bhyvexml2argv-vnc-wait.ldargs | 1 + .../bhyvexml2argv-vnc-wait.xml | 26 +++++++++++ tests/bhyvexml2argvtest.c | 2 + .../bhyvexml2xmlout-vnc-wait-no.xml | 44 +++++++++++++++++++ .../bhyvexml2xmlout-vnc-wait.xml | 44 +++++++++++++++++++ tests/bhyvexml2xmltest.c | 2 + 11 files changed, 175 insertions(+) create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait-no.args create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait-no.ldargs create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait-no.xml create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait.args create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait.ldargs create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait.xml create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-wait-no.xml create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-wait.xml
diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index 8bfd5a6f93..057715102e 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -651,6 +651,9 @@ bhyveBuildGraphicsArgStr(const virDomainDef *def, virBufferAsprintf(&opt, ",vga=%s", virDomainVideoVGAConfTypeToString(video->driver->vgaconf));
+ if (graphics->data.vnc.wait)
If you agree with my suggestion from PATCH 1/2, this should be changed to: `if (graphics->data.vnc.wait != VIR_TRISTATE_BOOL_YES)` But if you don't (which also makes sense since bhyve only has a way to enable the wait and not explicitly disable it) then PATCH 1/2 needs an adjustment. To elaborate on this a bit, using any tristate gives us the ability to keep some setting around even when it is the default, just in case it changes in the future or the default is different in some other driver. Since both of the scenarios are highly unlikely with respect to VNC server's `wait` parameter, I guess I am fine with both. Either way, if adjusted along with tests: Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-wait-no.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-wait-no.xml new file mode 100644 index 0000000000..58e71282e7 --- /dev/null +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-wait-no.xml @@ -0,0 +1,44 @@
[...]
+ <graphics type='vnc' port='5904' autoport='no' listen='127.0.0.1'>
See ^^ =)
Martin Kletzander wrote:
On Wed, Nov 19, 2025 at 06:54:26PM +0100, Roman Bogorodskiy wrote:
Bhyve supports the 'wait' option for the VNC device configuration. When enabled, VM boots only upon a VNC connection.
Sample device configuration looks like this:
-s 29,fbuf,tcp=0.0.0.0:5900,w=800,h=600,wait
Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com> --- src/bhyve/bhyve_command.c | 3 ++ .../bhyvexml2argv-vnc-wait-no.args | 13 ++++++ .../bhyvexml2argv-vnc-wait-no.ldargs | 1 + .../bhyvexml2argv-vnc-wait-no.xml | 26 +++++++++++ .../bhyvexml2argv-vnc-wait.args | 13 ++++++ .../bhyvexml2argv-vnc-wait.ldargs | 1 + .../bhyvexml2argv-vnc-wait.xml | 26 +++++++++++ tests/bhyvexml2argvtest.c | 2 + .../bhyvexml2xmlout-vnc-wait-no.xml | 44 +++++++++++++++++++ .../bhyvexml2xmlout-vnc-wait.xml | 44 +++++++++++++++++++ tests/bhyvexml2xmltest.c | 2 + 11 files changed, 175 insertions(+) create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait-no.args create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait-no.ldargs create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait-no.xml create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait.args create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait.ldargs create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-vnc-wait.xml create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-wait-no.xml create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-wait.xml
diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index 8bfd5a6f93..057715102e 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -651,6 +651,9 @@ bhyveBuildGraphicsArgStr(const virDomainDef *def, virBufferAsprintf(&opt, ",vga=%s", virDomainVideoVGAConfTypeToString(video->driver->vgaconf));
+ if (graphics->data.vnc.wait)
If you agree with my suggestion from PATCH 1/2, this should be changed to:
`if (graphics->data.vnc.wait != VIR_TRISTATE_BOOL_YES)`
I've pushed with your suggestions incorporated and ^ this changed to " == VIR_TRISTATE_BOOL_YES". Thanks for review!
But if you don't (which also makes sense since bhyve only has a way to enable the wait and not explicitly disable it) then PATCH 1/2 needs an adjustment.
To elaborate on this a bit, using any tristate gives us the ability to keep some setting around even when it is the default, just in case it changes in the future or the default is different in some other driver.
Since both of the scenarios are highly unlikely with respect to VNC server's `wait` parameter, I guess I am fine with both.
Either way, if adjusted along with tests:
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-wait-no.xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-wait-no.xml new file mode 100644 index 0000000000..58e71282e7 --- /dev/null +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-vnc-wait-no.xml @@ -0,0 +1,44 @@
[...]
+ <graphics type='vnc' port='5904' autoport='no' listen='127.0.0.1'>
See ^^ =)
On Wed, Nov 19, 2025 at 06:54:24PM +0100, Roman Bogorodskiy wrote:
Roman Bogorodskiy (2): conf: introduce 'wait' attribute for VNC bhyve: support VNC 'wait' attribute
Please add this new attribute to docs/formatdomain.rst, including the fact that it's currently bhyve-only. I think mentioning it in the release notes would be appropriate too. -- Andrea Bolognani / Red Hat / Virtualization
Andrea Bolognani wrote:
On Wed, Nov 19, 2025 at 06:54:24PM +0100, Roman Bogorodskiy wrote:
Roman Bogorodskiy (2): conf: introduce 'wait' attribute for VNC bhyve: support VNC 'wait' attribute
Please add this new attribute to docs/formatdomain.rst, including the fact that it's currently bhyve-only. I think mentioning it in the release notes would be appropriate too.
Yes, I plan updating formatdomain.rst, drvbhyve.rst, and NEWS.rst either later this week or early next week.
-- Andrea Bolognani / Red Hat / Virtualization
On Fri, Nov 21, 2025 at 01:16:50PM +0100, Roman Bogorodskiy wrote:
On Wed, Nov 19, 2025 at 06:54:24PM +0100, Roman Bogorodskiy wrote:
Roman Bogorodskiy (2): conf: introduce 'wait' attribute for VNC bhyve: support VNC 'wait' attribute
Please add this new attribute to docs/formatdomain.rst, including the fact that it's currently bhyve-only. I think mentioning it in the release notes would be appropriate too.
Yes, I plan updating formatdomain.rst, drvbhyve.rst, and NEWS.rst either later this week or early next week.
No rush, as long as it makes it into the next release :) Next time please include all that as part of the series itself though. It just makes things easier for everyone. Thanks! -- Andrea Bolognani / Red Hat / Virtualization
participants (3)
-
Andrea Bolognani -
Martin Kletzander -
Roman Bogorodskiy