On Tue, Feb 16, 2021 at 14:08:52 +0000, Daniel Berrange wrote: > This allows the VNC client user to perform a shutdown, reboot and reset > of the VM from the host side. > > Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx> > --- > src/qemu/qemu_command.c | 9 +++++++++ > tests/qemuxml2argvdata/graphics-vnc-policy.args | 2 +- > tests/qemuxml2argvdata/graphics-vnc-policy.xml | 2 +- > tests/qemuxml2argvtest.c | 2 +- > 4 files changed, 12 insertions(+), 3 deletions(-) > > diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c > index d801018aa2..266cf7332e 100644 > --- a/src/qemu/qemu_command.c > +++ b/src/qemu/qemu_command.c > @@ -7700,6 +7700,15 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg, > /* TODO: Support ACLs later */ > } > > + if (graphics->data.vnc.powerControl) { > + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VNC_POWER_CONTROL)) { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", > + _("VNC power control is not available")); > + return -1; > + } Invoking this check from qemuValidateDomainDeviceDefGraphics will give you define-time check whether the VM supports this rather than startup-time. > + virBufferAddLit(&opt, ",power-control=on"); > + } So we don't want to be able to explicitly turn this off? > + > virCommandAddArg(cmd, "-vnc"); > virCommandAddArgBuffer(cmd, &opt); > if (graphics->data.vnc.keymap) [...] > diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c > index db438c5466..b4df042fea 100644 > --- a/tests/qemuxml2argvtest.c > +++ b/tests/qemuxml2argvtest.c > @@ -1364,7 +1364,7 @@ mymain(void) > QEMU_CAPS_VNC, > QEMU_CAPS_DEVICE_CIRRUS_VGA); > DO_TEST("graphics-vnc-policy", QEMU_CAPS_VNC, > - QEMU_CAPS_DEVICE_CIRRUS_VGA); > + QEMU_CAPS_DEVICE_CIRRUS_VGA, QEMU_CAPS_VNC_POWER_CONTROL); Rather than adding the capability, either convert the test case to DO_TEST_CAPS_LATEST or add a separate _LATEST() case for it. > DO_TEST("graphics-vnc-no-listen-attr", QEMU_CAPS_VNC, > QEMU_CAPS_DEVICE_CIRRUS_VGA); > DO_TEST("graphics-vnc-remove-generated-socket", QEMU_CAPS_VNC, > -- > 2.29.2 >