[libvirt PATCH v4] Conf: Move validation of virDomainGraphicsListenDef out of Parser
by K Shiva
From: K Shiva Kiran <shiva_kr(a)riseup.net>
In an effort to separate the validation steps from the Parse stage,
a few validation checks of virDomainGraphicsListenDef have been moved from
virDomainGraphicsListenDefParseXML() in domain_conf.c to
virDomainGraphicsDefListensValidate() in domain_validate.c
Signed-off-by: K Shiva <shiva_kr(a)riseup.net>
---
This is a v4 of:
https://listman.redhat.com/archives/libvir-list/2023-April/239286.html
This commit has been squashed with v3.
diff to v3:
- Dropped virDomainGraphicsListenDefValidate() as per suggestion
- Moved the above's code to virDomainGraphicsDefListensValidate()
- Moved an existing if() condition in virDomainGraphicsDefListensValidate()
into the switch() statement of the freshly moved code
src/conf/domain_conf.c | 30 +-----------------------------
src/conf/domain_validate.c | 37 +++++++++++++++++++++++++++++++------
2 files changed, 32 insertions(+), 35 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 70e4d52ee6..8df751cc46 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10986,7 +10986,6 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node,
/**
* virDomainGraphicsListenDefParseXML:
* @def: listen def pointer to be filled
- * @graphics: graphics def pointer
* @node: xml node of <listen/> element
* @parent: xml node of <graphics/> element
* @flags: bit-wise or of VIR_DOMAIN_DEF_PARSE_*
@@ -10998,13 +10997,11 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node,
*/
static int
virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDef *def,
- virDomainGraphicsDef *graphics,
xmlNodePtr node,
xmlNodePtr parent,
unsigned int flags)
{
int ret = -1;
- const char *graphicsType = virDomainGraphicsTypeToString(graphics->type);
g_autofree char *address = virXMLPropString(node, "address");
g_autofree char *network = virXMLPropString(node, "network");
g_autofree char *socketPath = virXMLPropString(node, "socket");
@@ -11021,31 +11018,6 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDef *def,
VIR_XML_PROP_REQUIRED, &def->type) < 0)
goto error;
- switch (def->type) {
- case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET:
- if (graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
- graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("listen type 'socket' is not available for graphics type '%1$s'"),
- graphicsType);
- goto error;
- }
- break;
- case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE:
- if (graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE &&
- graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("listen type 'none' is not available for graphics type '%1$s'"),
- graphicsType);
- goto error;
- }
- break;
- case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS:
- case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK:
- case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST:
- break;
- }
-
if (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS) {
if (address && addressCompat && STRNEQ(address, addressCompat)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -11148,7 +11120,7 @@ virDomainGraphicsListensParseXML(virDomainGraphicsDef *def,
def->listens = g_new0(virDomainGraphicsListenDef, nListens);
for (i = 0; i < nListens; i++) {
- if (virDomainGraphicsListenDefParseXML(&def->listens[i], def,
+ if (virDomainGraphicsListenDefParseXML(&def->listens[i],
listenNodes[i],
i == 0 ? node : NULL,
flags) < 0)
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index 9265fef4f9..988f0854a5 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -2631,14 +2631,39 @@ static int
virDomainGraphicsDefListensValidate(const virDomainGraphicsDef *def)
{
size_t i;
+ const char *graphicsType = virDomainGraphicsTypeToString(def->type);
for (i = 0; i < def->nListens; i++) {
- if (def->listens[i].type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK &&
- !def->listens[i].network) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("'network' attribute is required for "
- "listen type 'network'"));
- return -1;
+ switch (def->listens[i].type) {
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK:
+ if (!def->listens[i].network) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("'network' attribute is required for "
+ "listen type 'network'"));
+ return -1;
+ }
+ break;
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET:
+ if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
+ def->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("listen type 'socket' is not available for graphics type '%1$s'"),
+ graphicsType);
+ return -1;
+ }
+ break;
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE:
+ if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE &&
+ def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("listen type 'none' is not available for graphics type '%1$s'"),
+ graphicsType);
+ return -1;
+ }
+ break;
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS:
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST:
+ break;
}
}
--
2.40.0
1 year, 8 months
[libvirt PATCH 0/2] conf: Fix migration in some firmware autoselection scenarios
by Andrea Bolognani
See commit 2/2 for details.
Andrea Bolognani (2):
tests: Tweak input file
conf: Fix migration in some firmware autoselection scenarios
src/conf/domain_conf.c | 39 ++++++++++++++++++-
...are-manual-efi-features.x86_64-latest.args | 35 +++++++++++++++++
.../firmware-manual-efi-features.xml | 2 +-
tests/qemuxml2argvtest.c | 6 ++-
...ware-manual-efi-features.x86_64-latest.xml | 36 +++++++++++++++++
tests/qemuxml2xmltest.c | 1 +
6 files changed, 115 insertions(+), 4 deletions(-)
create mode 100644 tests/qemuxml2argvdata/firmware-manual-efi-features.x86_64-latest.args
create mode 100644 tests/qemuxml2xmloutdata/firmware-manual-efi-features.x86_64-latest.xml
--
2.39.2
1 year, 8 months
[PATCH] qemu: Fix potential crash during driver cleanup
by Jim Fehlig
During qemu driver shutdown, objects are freed in qemuStateCleanup that
could still be used by active worker threads, resulting in crashes. E.g.
a worker thread could be processing a monitor EOF event after the
security manager is already disposed
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007fd9a9a1e1fe in virSecurityManagerMoveImageMetadata (mgr=0x7fd948012160, pid=-1, src=src@entry=0x7fd98c072c90, dst=dst@entry=0x0)
at ../../src/security/security_manager.c:468
#1 0x00007fd9646ff0f0 in qemuSecurityMoveImageMetadata (driver=driver@entry=0x7fd948043830, vm=vm@entry=0x7fd98c066db0, src=src@entry=0x7fd98c072c90,
dst=dst@entry=0x0) at ../../src/qemu/qemu_security.c:182
#2 0x00007fd96462c7b0 in qemuBlockRemoveImageMetadata (driver=driver@entry=0x7fd948043830, vm=vm@entry=0x7fd98c066db0, diskTarget=0x7fd98c072530 "vda",
src=<optimized out>) at ../../src/qemu/qemu_block.c:2628
#3 0x00007fd9646929d6 in qemuProcessStop (driver=driver@entry=0x7fd948043830, vm=vm@entry=0x7fd98c066db0, reason=reason@entry=VIR_DOMAIN_SHUTOFF_SHUTDOWN,
asyncJob=asyncJob@entry=QEMU_ASYNC_JOB_NONE, flags=<optimized out>) at ../../src/qemu/qemu_process.c:7585
#4 0x00007fd9646fc842 in processMonitorEOFEvent (vm=0x7fd98c066db0, driver=0x7fd948043830) at ../../src/qemu/qemu_driver.c:4794
#5 qemuProcessEventHandler (data=0x561a93febb60, opaque=0x7fd948043830) at ../../src/qemu/qemu_driver.c:4900
#6 0x00007fd9a9971a31 in virThreadPoolWorker (opaque=opaque@entry=0x561a93fb58e0) at ../../src/util/virthreadpool.c:163
(gdb) p mgr->drv
$2 = (virSecurityDriverPtr) 0x0
Prior to commit 7cf76d4e3ab, the worker thread pool was freed before
disposing any driver objects. Let's return to that pattern, but leave
the other changes made by 7cf76d4e3ab.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
src/qemu/qemu_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b4fb7ec1df..28e470e4a2 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1062,6 +1062,7 @@ qemuStateCleanup(void)
if (!qemu_driver)
return -1;
+ virThreadPoolFree(qemu_driver->workerPool);
virObjectUnref(qemu_driver->migrationErrors);
virLockManagerPluginUnref(qemu_driver->lockManager);
virSysinfoDefFree(qemu_driver->hostsysinfo);
@@ -1078,7 +1079,6 @@ qemuStateCleanup(void)
ebtablesContextFree(qemu_driver->ebtables);
VIR_FREE(qemu_driver->qemuImgBinary);
virObjectUnref(qemu_driver->domains);
- virThreadPoolFree(qemu_driver->workerPool);
if (qemu_driver->lockFD != -1)
virPidFileRelease(qemu_driver->config->stateDir, "driver", qemu_driver->lockFD);
--
2.40.0
1 year, 8 months
Re: [PATCH] qemu-options.hx: Update descriptions of memory options for NUMA node
by Yohei Kojima
ping
This patch updates an outdated description in qemu-options.hx .
The patch reflects the changes in qemu behavior already described in
another documentation, and it also changes paragraph structure for
further readability.
The original patch is:
https://patchew.org/QEMU/TYZPR06MB5418D6B0175A49E8E76988439D8E9@TYZPR06MB...
On 2023/03/30 19:09, Yohei Kojima wrote:
> This commit adds the following description:
> 1. `memdev` option is recommended over `mem` option (see [1,2])
> 2. users must specify memory for all NUMA nodes (see [2])
>
> This commit also separates descriptions for `mem` and `memdev` into two
> paragraphs. The old doc describes legacy `mem` option first, and it was
> a bit confusing.
>
> Related documantations:
> [1] https://wiki.qemu.org/ChangeLog/5.1#Incompatible_changes
> [2] https://www.qemu.org/docs/master/about/removed-features.html
>
> Signed-off-by: Yohei Kojima <y-koj(a)outlook.jp>
> ---
> qemu-options.hx | 25 ++++++++++++++++---------
> 1 file changed, 16 insertions(+), 9 deletions(-)
>
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 59bdf67a2c..174f0d0c2d 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -405,15 +405,22 @@ SRST
> -numa node,nodeid=0 -numa node,nodeid=1 \
> -numa cpu,node-id=0,socket-id=0 -numa cpu,node-id=1,socket-id=1
>
> - Legacy '\ ``mem``\ ' assigns a given RAM amount to a node (not supported
> - for 5.1 and newer machine types). '\ ``memdev``\ ' assigns RAM from
> - a given memory backend device to a node. If '\ ``mem``\ ' and
> - '\ ``memdev``\ ' are omitted in all nodes, RAM is split equally between them.
> -
> -
> - '\ ``mem``\ ' and '\ ``memdev``\ ' are mutually exclusive.
> - Furthermore, if one node uses '\ ``memdev``\ ', all of them have to
> - use it.
> + '\ ``memdev``\ ' option assigns RAM from a given memory backend
> + device to a node. It is recommended to use '\ ``memdev``\ ' option
> + over legacy '\ ``mem``\ ' option. This is because '\ ``memdev``\ '
> + option provides better performance and more control over the
> + backend's RAM (e.g. '\ ``prealloc``\ ' parameter of
> + '\ ``-memory-backend-ram``\ ' allows memory preallocation).
> +
> + For compatibility reasons, legacy '\ ``mem``\ ' option is
> + supported in 5.0 and older machine types. Note that '\ ``mem``\ '
> + and '\ ``memdev``\ ' are mutually exclusive. If one node uses
> + '\ ``memdev``\ ', the rest nodes have to use '\ ``memdev``\ '
> + option, and vice versa.
> +
> + Users must specify memory for all NUMA nodes by '\ ``memdev``\ '
> + (or legacy '\ ``mem``\ ' if available). In QEMU 5.2, the support
> + for '\ ``-numa node``\ ' without memory specified was removed.
>
> '\ ``initiator``\ ' is an additional option that points to an
> initiator NUMA node that has best performance (the lowest latency or
1 year, 8 months
[libvirt PATCH 0/3] RFC: fix compilation on msys2
by marcandre.lureau@redhat.com
From: Marc-André Lureau <marcandre.lureau(a)redhat.com>
Hi,
libvirt fails to compile on msys2/win32. Here is a few patches that solve it,
but the way python scripts are being handled in general is a bit odd, so this is
RFC. (fwiw, a lot of tests fail though, I can send the log if anyone is
interested - or attach it to a gitlab issue)
Fixes:
https://gitlab.com/libvirt/libvirt/-/issues/453
Marc-André Lureau (3):
meson: don't look for unix paths on win32
meson: drop explicit python interpreter
rpc/ssh: ssh_userauth_agent() is not supported on win32
docs/manpages/meson.build | 4 ++--
docs/meson.build | 6 ++----
meson.build | 14 +++++++++-----
src/admin/meson.build | 4 ++--
src/esx/meson.build | 4 ++--
src/hyperv/meson.build | 2 +-
src/meson.build | 8 ++++----
src/rpc/virnetlibsshsession.c | 14 ++++++++++++--
src/util/meson.build | 4 ++--
9 files changed, 36 insertions(+), 24 deletions(-)
--
2.39.2
1 year, 8 months
[PATCH 00/21] qemu capability testing cleanups and improvements (part 5)
by Peter Krempa
This series applies on top of 'part 4' fetch everything from my repo:
git fetch https://gitlab.com/pipo.sk/libvirt.git aarch-send
In this part tests for the 'aarch64' platform are converted to use real
capabilities.
Peter Krempa (21):
virDomainPCIAddressSetExtensionAlloc: Remove return value
qemuxml2argvdata: Do not symlink output files for aarch64 gic tests
qemuxml2argvtest: Use real capabilities in tests for picking the
aarch64 GIC version
qemuxml2argvtest: Convert DO_TEST_GIC to use real latest capabilities
qemuxml2argvtest: Convert the rest of GIC tests to latest capabilities
qemuxml2argvtest: Add real-caps versions of 'aarch64-virt-virtio'
qemuxml2argvtest: Drop "aarch64-virt-2.6-virtio-pci-default" case
qemuxml2argv: Test default aarch64 cofig without PCIe support
qemuxml2argvtest: Modernize 'balloon-mmio-deflate'
qemuxml2argvtest: Don't symlink output files for 'mach-virt-' cases
qemuxml2argvtest: Modernize all 'mach-virt-' aarch64 test cases
qemuxml2argvtest: Update 'aarch64-virtio-pci-manual-addresses' case
qemuxml2*test: Drop fake-caps invocation of
'aarch64-virtio-pci-manual-addresses'
qemuxml2(argv|xml)test: Modernize testing of USB controllers on
aarch64
qemuxml2argvtest: Modernize the rest of 'aarch64' cases
qemuxml2xmlout: Do not symlink output files for 'aarch64-gic' cases
qemuxml2xmltest: Modernize 'aarch64-gic*' test cases
qemuxml2xmloutdata: Don't symlink output data for 'mach-virt*' cases
qemuxml2xmltest: Modernize 'mach-virt*' cases
qemuxml2xmltest: Convert rest of 'aarch64' cases to real capabilities
testutilsqemu: Drop fake capability testing infrastructure for
'aarch64'
src/conf/domain_addr.c | 13 +-
...h64-aavmf-virtio-mmio.aarch64-latest.args} | 20 +-
...rch64-cpu-passthrough.aarch64-latest.args} | 26 +--
.../aarch64-gic-default-both.args | 33 ++-
.../aarch64-gic-default-v2.args | 33 ++-
.../aarch64-gic-default-v3.args | 33 ++-
...=> aarch64-gic-default.aarch64-4.2.0.args} | 14 +-
...> aarch64-gic-default.aarch64-latest.args} | 17 +-
.../qemuxml2argvdata/aarch64-gic-default.args | 1 -
tests/qemuxml2argvdata/aarch64-gic-host.args | 6 +-
...=> aarch64-gic-invalid.aarch64-latest.err} | 0
.../aarch64-gic-none-both.args | 33 ++-
.../aarch64-gic-none-tcg.args | 6 +-
.../qemuxml2argvdata/aarch64-gic-none-v2.args | 33 ++-
.../qemuxml2argvdata/aarch64-gic-none-v3.args | 33 ++-
...gs => aarch64-gic-none.aarch64-4.2.0.args} | 8 +-
.../aarch64-gic-none.aarch64-latest.args | 32 +++
tests/qemuxml2argvdata/aarch64-gic-none.args | 1 -
...> aarch64-gic-not-virt.aarch64-latest.err} | 0
tests/qemuxml2argvdata/aarch64-gic-v2.args | 6 +-
tests/qemuxml2argvdata/aarch64-gic-v3.args | 6 +-
.../aarch64-pci-serial.aarch64-latest.args | 38 +++
...arch64-tpm-wrong-model.aarch64-latest.err} | 0
...arch64-traditional-pci.aarch64-latest.args | 37 +++
.../aarch64-traditional-pci.args | 34 ---
.../aarch64-usb-controller-qemu-xhci.args | 30 ---
.../aarch64-usb-controller-qemu-xhci.xml | 16 --
...arch64-usb-controller.aarch64-latest.args} | 11 +-
...ec-xhci.xml => aarch64-usb-controller.xml} | 6 +
...aarch64-video-default.aarch64-latest.args} | 13 +-
...4-video-virtio-gpu-pci.aarch64-latest.args | 37 +++
.../aarch64-video-virtio-gpu-pci.args | 35 ---
.../aarch64-virt-2.6-virtio-pci-default.xml | 46 ----
...ch64-virt-default-nic.aarch64-latest.args} | 10 +-
...ch64-virt-virtio-MMIO.aarch64.latest.args} | 20 +-
...=> aarch64-virt-virtio.aarch64-4.2.0.args} | 22 +-
.../aarch64-virt-virtio.aarch64-latest.args | 55 +++++
...o-pci-manual-addresses.aarch64-latest.args | 49 ++++
.../aarch64-virtio-pci-manual-addresses.xml | 4 +-
.../balloon-mmio-deflate.aarch64-latest.args | 37 +++
...h-virt-console-native.aarch64-latest.args} | 7 +-
.../mach-virt-console-native.args | 1 -
...ch-virt-console-virtio.aarch64-latest.args | 37 +++
...serial+console-native.aarch64-latest.args} | 12 +-
.../mach-virt-serial+console-native.args | 1 -
...ch-virt-serial-compat.aarch64-latest.args} | 12 +-
.../mach-virt-serial-compat.args | 1 -
...-serial-invalid-machine.x86_64-latest.err} | 0
...ch-virt-serial-native.aarch64-latest.args} | 12 +-
.../mach-virt-serial-pci.aarch64-latest.args | 37 +++
.../mach-virt-serial-usb.aarch64-latest.args | 37 +++
tests/qemuxml2argvtest.c | 217 +++++++-----------
...ch64-aavmf-virtio-mmio.aarch64-latest.xml} | 1 +
...arch64-gic-default-both.aarch64-latest.xml | 26 +++
.../aarch64-gic-default-both.xml | 1 -
.../aarch64-gic-default-v2.aarch64-latest.xml | 26 +++
.../aarch64-gic-default-v2.xml | 1 -
.../aarch64-gic-default-v3.aarch64-latest.xml | 26 +++
.../aarch64-gic-default-v3.xml | 1 -
.../aarch64-gic-default.aarch64-latest.xml | 26 +++
.../aarch64-gic-default.xml | 1 -
.../aarch64-gic-host.aarch64-latest.xml | 26 +++
tests/qemuxml2xmloutdata/aarch64-gic-host.xml | 1 -
.../aarch64-gic-none-both.aarch64-latest.xml | 26 +++
.../aarch64-gic-none-both.xml | 1 -
...> aarch64-gic-none-tcg.aarch64-latest.xml} | 1 +
.../aarch64-gic-none-v2.aarch64-latest.xml | 26 +++
.../aarch64-gic-none-v2.xml | 1 -
.../aarch64-gic-none-v3.aarch64-latest.xml | 26 +++
.../aarch64-gic-none-v3.xml | 1 -
.../aarch64-gic-none.aarch64-latest.xml | 26 +++
tests/qemuxml2xmloutdata/aarch64-gic-none.xml | 1 -
.../aarch64-gic-v2.aarch64-latest.xml | 26 +++
tests/qemuxml2xmloutdata/aarch64-gic-v2.xml | 1 -
.../aarch64-gic-v3.aarch64-latest.xml | 26 +++
tests/qemuxml2xmloutdata/aarch64-gic-v3.xml | 1 -
... => aarch64-pci-serial.aarch64-latest.xml} | 19 +-
...arch64-traditional-pci.aarch64-latest.xml} | 3 +
.../aarch64-usb-controller.aarch64-latest.xml | 36 +++
... aarch64-video-default.aarch64-latest.xml} | 22 +-
...4-video-virtio-gpu-pci.aarch64-latest.xml} | 4 +-
...o-pci-manual-addresses.aarch64-latest.xml} | 24 +-
...ch-virt-console-native.aarch64-latest.xml} | 4 +
.../mach-virt-console-native.xml | 1 -
...ach-virt-console-virtio.aarch64-latest.xml | 44 ++++
...-serial+console-native.aarch64-latest.xml} | 14 +-
.../mach-virt-serial+console-native.xml | 1 -
...mach-virt-serial-compat.aarch64-latest.xml | 36 +++
...mach-virt-serial-native.aarch64-latest.xml | 36 +++
.../mach-virt-serial-native.xml | 1 -
...> mach-virt-serial-pci.aarch64-latest.xml} | 19 +-
...> mach-virt-serial-usb.aarch64-latest.xml} | 3 +
tests/qemuxml2xmltest.c | 153 ++++++------
tests/testutilsqemu.c | 6 -
94 files changed, 1396 insertions(+), 557 deletions(-)
rename tests/qemuxml2argvdata/{aarch64-aavmf-virtio-mmio.args => aarch64-aavmf-virtio-mmio.aarch64-latest.args} (57%)
rename tests/qemuxml2argvdata/{aarch64-virtio-pci-manual-addresses.args => aarch64-cpu-passthrough.aarch64-latest.args} (52%)
mode change 120000 => 100644 tests/qemuxml2argvdata/aarch64-gic-default-both.args
mode change 120000 => 100644 tests/qemuxml2argvdata/aarch64-gic-default-v2.args
mode change 120000 => 100644 tests/qemuxml2argvdata/aarch64-gic-default-v3.args
rename tests/qemuxml2argvdata/{balloon-mmio-deflate.args => aarch64-gic-default.aarch64-4.2.0.args} (71%)
rename tests/qemuxml2argvdata/{aarch64-pci-serial.args => aarch64-gic-default.aarch64-latest.args} (55%)
delete mode 120000 tests/qemuxml2argvdata/aarch64-gic-default.args
rename tests/qemuxml2argvdata/{aarch64-gic-invalid.err => aarch64-gic-invalid.aarch64-latest.err} (100%)
mode change 120000 => 100644 tests/qemuxml2argvdata/aarch64-gic-none-both.args
mode change 120000 => 100644 tests/qemuxml2argvdata/aarch64-gic-none-v2.args
mode change 120000 => 100644 tests/qemuxml2argvdata/aarch64-gic-none-v3.args
rename tests/qemuxml2argvdata/{aarch64-cpu-passthrough.args => aarch64-gic-none.aarch64-4.2.0.args} (67%)
create mode 100644 tests/qemuxml2argvdata/aarch64-gic-none.aarch64-latest.args
delete mode 120000 tests/qemuxml2argvdata/aarch64-gic-none.args
rename tests/qemuxml2argvdata/{aarch64-gic-not-virt.err => aarch64-gic-not-virt.aarch64-latest.err} (100%)
create mode 100644 tests/qemuxml2argvdata/aarch64-pci-serial.aarch64-latest.args
rename tests/qemuxml2argvdata/{aarch64-tpm-wrong-model.err => aarch64-tpm-wrong-model.aarch64-latest.err} (100%)
create mode 100644 tests/qemuxml2argvdata/aarch64-traditional-pci.aarch64-latest.args
delete mode 100644 tests/qemuxml2argvdata/aarch64-traditional-pci.args
delete mode 100644 tests/qemuxml2argvdata/aarch64-usb-controller-qemu-xhci.args
delete mode 100644 tests/qemuxml2argvdata/aarch64-usb-controller-qemu-xhci.xml
rename tests/qemuxml2argvdata/{aarch64-usb-controller-nec-xhci.args => aarch64-usb-controller.aarch64-latest.args} (55%)
rename tests/qemuxml2argvdata/{aarch64-usb-controller-nec-xhci.xml => aarch64-usb-controller.xml} (61%)
rename tests/qemuxml2argvdata/{aarch64-video-default.args => aarch64-video-default.aarch64-latest.args} (54%)
create mode 100644 tests/qemuxml2argvdata/aarch64-video-virtio-gpu-pci.aarch64-latest.args
delete mode 100644 tests/qemuxml2argvdata/aarch64-video-virtio-gpu-pci.args
delete mode 100644 tests/qemuxml2argvdata/aarch64-virt-2.6-virtio-pci-default.xml
rename tests/qemuxml2argvdata/{aarch64-virt-default-nic.args => aarch64-virt-default-nic.aarch64-latest.args} (56%)
rename tests/qemuxml2argvdata/{aarch64-virt-virtio.args => aarch64-virt-virtio-MMIO.aarch64.latest.args} (58%)
rename tests/qemuxml2argvdata/{aarch64-virt-2.6-virtio-pci-default.args => aarch64-virt-virtio.aarch64-4.2.0.args} (63%)
create mode 100644 tests/qemuxml2argvdata/aarch64-virt-virtio.aarch64-latest.args
create mode 100644 tests/qemuxml2argvdata/aarch64-virtio-pci-manual-addresses.aarch64-latest.args
create mode 100644 tests/qemuxml2argvdata/balloon-mmio-deflate.aarch64-latest.args
rename tests/qemuxml2argvdata/{mach-virt-serial-native.args => mach-virt-console-native.aarch64-latest.args} (67%)
delete mode 120000 tests/qemuxml2argvdata/mach-virt-console-native.args
create mode 100644 tests/qemuxml2argvdata/mach-virt-console-virtio.aarch64-latest.args
rename tests/qemuxml2argvdata/{mach-virt-serial-pci.args => mach-virt-serial+console-native.aarch64-latest.args} (65%)
delete mode 120000 tests/qemuxml2argvdata/mach-virt-serial+console-native.args
rename tests/qemuxml2argvdata/{mach-virt-serial-usb.args => mach-virt-serial-compat.aarch64-latest.args} (64%)
delete mode 120000 tests/qemuxml2argvdata/mach-virt-serial-compat.args
rename tests/qemuxml2argvdata/{mach-virt-serial-invalid-machine.err => mach-virt-serial-invalid-machine.x86_64-latest.err} (100%)
rename tests/qemuxml2argvdata/{mach-virt-console-virtio.args => mach-virt-serial-native.aarch64-latest.args} (62%)
create mode 100644 tests/qemuxml2argvdata/mach-virt-serial-pci.aarch64-latest.args
create mode 100644 tests/qemuxml2argvdata/mach-virt-serial-usb.aarch64-latest.args
rename tests/qemuxml2xmloutdata/{aarch64-aavmf-virtio-mmio.xml => aarch64-aavmf-virtio-mmio.aarch64-latest.xml} (96%)
create mode 100644 tests/qemuxml2xmloutdata/aarch64-gic-default-both.aarch64-latest.xml
delete mode 120000 tests/qemuxml2xmloutdata/aarch64-gic-default-both.xml
create mode 100644 tests/qemuxml2xmloutdata/aarch64-gic-default-v2.aarch64-latest.xml
delete mode 120000 tests/qemuxml2xmloutdata/aarch64-gic-default-v2.xml
create mode 100644 tests/qemuxml2xmloutdata/aarch64-gic-default-v3.aarch64-latest.xml
delete mode 120000 tests/qemuxml2xmloutdata/aarch64-gic-default-v3.xml
create mode 100644 tests/qemuxml2xmloutdata/aarch64-gic-default.aarch64-latest.xml
delete mode 120000 tests/qemuxml2xmloutdata/aarch64-gic-default.xml
create mode 100644 tests/qemuxml2xmloutdata/aarch64-gic-host.aarch64-latest.xml
delete mode 120000 tests/qemuxml2xmloutdata/aarch64-gic-host.xml
create mode 100644 tests/qemuxml2xmloutdata/aarch64-gic-none-both.aarch64-latest.xml
delete mode 120000 tests/qemuxml2xmloutdata/aarch64-gic-none-both.xml
rename tests/qemuxml2xmloutdata/{aarch64-gic-none-tcg.xml => aarch64-gic-none-tcg.aarch64-latest.xml} (93%)
create mode 100644 tests/qemuxml2xmloutdata/aarch64-gic-none-v2.aarch64-latest.xml
delete mode 120000 tests/qemuxml2xmloutdata/aarch64-gic-none-v2.xml
create mode 100644 tests/qemuxml2xmloutdata/aarch64-gic-none-v3.aarch64-latest.xml
delete mode 120000 tests/qemuxml2xmloutdata/aarch64-gic-none-v3.xml
create mode 100644 tests/qemuxml2xmloutdata/aarch64-gic-none.aarch64-latest.xml
delete mode 120000 tests/qemuxml2xmloutdata/aarch64-gic-none.xml
create mode 100644 tests/qemuxml2xmloutdata/aarch64-gic-v2.aarch64-latest.xml
delete mode 120000 tests/qemuxml2xmloutdata/aarch64-gic-v2.xml
create mode 100644 tests/qemuxml2xmloutdata/aarch64-gic-v3.aarch64-latest.xml
delete mode 120000 tests/qemuxml2xmloutdata/aarch64-gic-v3.xml
rename tests/qemuxml2xmloutdata/{aarch64-pci-serial.xml => aarch64-pci-serial.aarch64-latest.xml} (70%)
rename tests/qemuxml2xmloutdata/{aarch64-traditional-pci.xml => aarch64-traditional-pci.aarch64-latest.xml} (93%)
create mode 100644 tests/qemuxml2xmloutdata/aarch64-usb-controller.aarch64-latest.xml
rename tests/qemuxml2xmloutdata/{aarch64-video-default.xml => aarch64-video-default.aarch64-latest.xml} (67%)
rename tests/qemuxml2xmloutdata/{aarch64-video-virtio-gpu-pci.xml => aarch64-video-virtio-gpu-pci.aarch64-latest.xml} (95%)
rename tests/qemuxml2xmloutdata/{aarch64-virtio-pci-manual-addresses.xml => aarch64-virtio-pci-manual-addresses.aarch64-latest.xml} (68%)
rename tests/qemuxml2xmloutdata/{mach-virt-serial-compat.xml => mach-virt-console-native.aarch64-latest.xml} (84%)
delete mode 120000 tests/qemuxml2xmloutdata/mach-virt-console-native.xml
create mode 100644 tests/qemuxml2xmloutdata/mach-virt-console-virtio.aarch64-latest.xml
rename tests/qemuxml2xmloutdata/{mach-virt-console-virtio.xml => mach-virt-serial+console-native.aarch64-latest.xml} (68%)
delete mode 120000 tests/qemuxml2xmloutdata/mach-virt-serial+console-native.xml
create mode 100644 tests/qemuxml2xmloutdata/mach-virt-serial-compat.aarch64-latest.xml
create mode 100644 tests/qemuxml2xmloutdata/mach-virt-serial-native.aarch64-latest.xml
delete mode 120000 tests/qemuxml2xmloutdata/mach-virt-serial-native.xml
rename tests/qemuxml2xmloutdata/{mach-virt-serial-pci.xml => mach-virt-serial-pci.aarch64-latest.xml} (71%)
rename tests/qemuxml2xmloutdata/{mach-virt-serial-usb.xml => mach-virt-serial-usb.aarch64-latest.xml} (93%)
--
2.39.2
1 year, 8 months
[PATCHv2] storage_file_probe: change maximum len value in vmdk4GetBackingStore
by Anastasia Belova
desc length should be always less than VIR_STORAGE_MAX_HEADER.
If len = VIR_STORAGE_MAX_HEADER, desc may be out of bounds.
Fixes: 348b4e254b ("storage: always probe type with buffer")
Signed-off-by: Anastasia Belova <abelova(a)astralinux.ru>
---
v2: change Fixes: line
src/storage_file/storage_file_probe.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/storage_file/storage_file_probe.c b/src/storage_file/storage_file_probe.c
index 9465af5d96..0dcc9c2c54 100644
--- a/src/storage_file/storage_file_probe.c
+++ b/src/storage_file/storage_file_probe.c
@@ -586,8 +586,8 @@ vmdk4GetBackingStore(char **res,
return BACKING_STORE_INVALID;
len = buf_size - 0x200;
- if (len > VIR_STORAGE_MAX_HEADER)
- len = VIR_STORAGE_MAX_HEADER;
+ if (len >= VIR_STORAGE_MAX_HEADER)
+ len = VIR_STORAGE_MAX_HEADER - 1;
memcpy(desc, buf + 0x200, len);
desc[len] = '\0';
start = strstr(desc, prefix);
--
2.30.2
1 year, 8 months
[libvirt PATCH v3] Conf: Move validation of virDomainGraphicsListenDef out of Parser
by K Shiva
In an effort to separate the validation steps from the Parse stage, a
part of the validation of virDomainGraphicsListenDef has been moved to
domain_validate.h.
Signed-off-by: K Shiva <shiva_kr(a)riseup.net>
---
This is a v3 of:
https://listman.redhat.com/archives/libvir-list/2023-April/239265.html
diff to v2:
- Cleaned patch as to be directly applied onto master branch
src/conf/domain_conf.c | 30 +-----------------------------
src/conf/domain_validate.c | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+), 29 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 70e4d52ee6..8df751cc46 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10986,7 +10986,6 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node,
/**
* virDomainGraphicsListenDefParseXML:
* @def: listen def pointer to be filled
- * @graphics: graphics def pointer
* @node: xml node of <listen/> element
* @parent: xml node of <graphics/> element
* @flags: bit-wise or of VIR_DOMAIN_DEF_PARSE_*
@@ -10998,13 +10997,11 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node,
*/
static int
virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDef *def,
- virDomainGraphicsDef *graphics,
xmlNodePtr node,
xmlNodePtr parent,
unsigned int flags)
{
int ret = -1;
- const char *graphicsType = virDomainGraphicsTypeToString(graphics->type);
g_autofree char *address = virXMLPropString(node, "address");
g_autofree char *network = virXMLPropString(node, "network");
g_autofree char *socketPath = virXMLPropString(node, "socket");
@@ -11021,31 +11018,6 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDef *def,
VIR_XML_PROP_REQUIRED, &def->type) < 0)
goto error;
- switch (def->type) {
- case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET:
- if (graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
- graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("listen type 'socket' is not available for graphics type '%1$s'"),
- graphicsType);
- goto error;
- }
- break;
- case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE:
- if (graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE &&
- graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("listen type 'none' is not available for graphics type '%1$s'"),
- graphicsType);
- goto error;
- }
- break;
- case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS:
- case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK:
- case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST:
- break;
- }
-
if (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS) {
if (address && addressCompat && STRNEQ(address, addressCompat)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -11148,7 +11120,7 @@ virDomainGraphicsListensParseXML(virDomainGraphicsDef *def,
def->listens = g_new0(virDomainGraphicsListenDef, nListens);
for (i = 0; i < nListens; i++) {
- if (virDomainGraphicsListenDefParseXML(&def->listens[i], def,
+ if (virDomainGraphicsListenDefParseXML(&def->listens[i],
listenNodes[i],
i == 0 ? node : NULL,
flags) < 0)
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index 9265fef4f9..9a1a8ee156 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -2627,6 +2627,39 @@ virDomainAudioDefValidate(const virDomainDef *def,
return 0;
}
+static int
+virDomainGraphicsListenDefValidate(const virDomainGraphicsListenDef *def,
+ const virDomainGraphicsDef *graphics)
+{
+ const char *graphicsType = virDomainGraphicsTypeToString(graphics->type);
+
+ switch (def->type) {
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET:
+ if (graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
+ graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("listen type 'socket' is not available for graphics type '%1$s'"),
+ graphicsType);
+ return -1;
+ }
+ break;
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE:
+ if (graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE &&
+ graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("listen type 'none' is not available for graphics type '%1$s'"),
+ graphicsType);
+ return -1;
+ }
+ break;
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS:
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK:
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST:
+ break;
+ }
+ return 0;
+}
+
static int
virDomainGraphicsDefListensValidate(const virDomainGraphicsDef *def)
{
@@ -2640,6 +2673,8 @@ virDomainGraphicsDefListensValidate(const virDomainGraphicsDef *def)
"listen type 'network'"));
return -1;
}
+ if (virDomainGraphicsListenDefValidate(&def->listens[i], def) < 0)
+ return -1;
}
return 0;
--
2.40.0
1 year, 8 months
Re: [libvirt PATCH v4] Conf: Move validation of virDomainGraphicsListenDef out of Parser
by K Shiva
In an effort to separate the validation steps from the Parse stage,
a few validation checks of virDomainGraphicsListenDef have been moved from
virDomainGraphicsListenDefParseXML() in domain_conf.c to
virDomainGraphicsDefListensValidate() in domain_validate.c
Signed-off-by: Koninty Shiva Kiran <shiva_kr(a)riseup.net>
---
src/conf/domain_conf.c | 30 +-----------------------------
src/conf/domain_validate.c | 37 +++++++++++++++++++++++++++++++------
2 files changed, 32 insertions(+), 35 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 70e4d52ee6..8df751cc46 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10986,7 +10986,6 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node,
/**
* virDomainGraphicsListenDefParseXML:
* @def: listen def pointer to be filled
- * @graphics: graphics def pointer
* @node: xml node of <listen/> element
* @parent: xml node of <graphics/> element
* @flags: bit-wise or of VIR_DOMAIN_DEF_PARSE_*
@@ -10998,13 +10997,11 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node,
*/
static int
virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDef *def,
- virDomainGraphicsDef *graphics,
xmlNodePtr node,
xmlNodePtr parent,
unsigned int flags)
{
int ret = -1;
- const char *graphicsType = virDomainGraphicsTypeToString(graphics->type);
g_autofree char *address = virXMLPropString(node, "address");
g_autofree char *network = virXMLPropString(node, "network");
g_autofree char *socketPath = virXMLPropString(node, "socket");
@@ -11021,31 +11018,6 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDef *def,
VIR_XML_PROP_REQUIRED, &def->type) < 0)
goto error;
- switch (def->type) {
- case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET:
- if (graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
- graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("listen type 'socket' is not available for graphics type '%1$s'"),
- graphicsType);
- goto error;
- }
- break;
- case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE:
- if (graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE &&
- graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("listen type 'none' is not available for graphics type '%1$s'"),
- graphicsType);
- goto error;
- }
- break;
- case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS:
- case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK:
- case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST:
- break;
- }
-
if (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS) {
if (address && addressCompat && STRNEQ(address, addressCompat)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -11148,7 +11120,7 @@ virDomainGraphicsListensParseXML(virDomainGraphicsDef *def,
def->listens = g_new0(virDomainGraphicsListenDef, nListens);
for (i = 0; i < nListens; i++) {
- if (virDomainGraphicsListenDefParseXML(&def->listens[i], def,
+ if (virDomainGraphicsListenDefParseXML(&def->listens[i],
listenNodes[i],
i == 0 ? node : NULL,
flags) < 0)
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index 9265fef4f9..988f0854a5 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -2631,14 +2631,39 @@ static int
virDomainGraphicsDefListensValidate(const virDomainGraphicsDef *def)
{
size_t i;
+ const char *graphicsType = virDomainGraphicsTypeToString(def->type);
for (i = 0; i < def->nListens; i++) {
- if (def->listens[i].type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK &&
- !def->listens[i].network) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("'network' attribute is required for "
- "listen type 'network'"));
- return -1;
+ switch (def->listens[i].type) {
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK:
+ if (!def->listens[i].network) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("'network' attribute is required for "
+ "listen type 'network'"));
+ return -1;
+ }
+ break;
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET:
+ if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
+ def->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("listen type 'socket' is not available for graphics type '%1$s'"),
+ graphicsType);
+ return -1;
+ }
+ break;
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE:
+ if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE &&
+ def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("listen type 'none' is not available for graphics type '%1$s'"),
+ graphicsType);
+ return -1;
+ }
+ break;
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS:
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST:
+ break;
}
}
--
2.40.0
1 year, 8 months
Re: [libvirt PATCH v3] Conf: Move validation of virDomainGraphicsListenDef out of Parser virDomainGraphicsListenDef out of Parser
by K Shiva
In an effort to separate the validation steps from the Parse stage,
a few validation checks of virDomainGraphicsListenDef have been moved from
virDomainGraphicsListenDefParseXML() in domain_conf.c to
virDomainGraphicsDefListensValidate() in domain_validate.c
Signed-off-by: Koninty Shiva Kiran <shiva_kr(a)riseup.net>
---
Change to previous mail:
https://listman.redhat.com/archives/libvir-list/2023-April/239286.html
- Previously forgot to add full name under signoff, added it here
src/conf/domain_conf.c | 30 +-----------------------------
src/conf/domain_validate.c | 37 +++++++++++++++++++++++++++++++------
2 files changed, 32 insertions(+), 35 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 70e4d52ee6..8df751cc46 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10986,7 +10986,6 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node,
/**
* virDomainGraphicsListenDefParseXML:
* @def: listen def pointer to be filled
- * @graphics: graphics def pointer
* @node: xml node of <listen/> element
* @parent: xml node of <graphics/> element
* @flags: bit-wise or of VIR_DOMAIN_DEF_PARSE_*
@@ -10998,13 +10997,11 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node,
*/
static int
virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDef *def,
- virDomainGraphicsDef *graphics,
xmlNodePtr node,
xmlNodePtr parent,
unsigned int flags)
{
int ret = -1;
- const char *graphicsType = virDomainGraphicsTypeToString(graphics->type);
g_autofree char *address = virXMLPropString(node, "address");
g_autofree char *network = virXMLPropString(node, "network");
g_autofree char *socketPath = virXMLPropString(node, "socket");
@@ -11021,31 +11018,6 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDef *def,
VIR_XML_PROP_REQUIRED, &def->type) < 0)
goto error;
- switch (def->type) {
- case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET:
- if (graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
- graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("listen type 'socket' is not available for graphics type '%1$s'"),
- graphicsType);
- goto error;
- }
- break;
- case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE:
- if (graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE &&
- graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("listen type 'none' is not available for graphics type '%1$s'"),
- graphicsType);
- goto error;
- }
- break;
- case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS:
- case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK:
- case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST:
- break;
- }
-
if (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS) {
if (address && addressCompat && STRNEQ(address, addressCompat)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -11148,7 +11120,7 @@ virDomainGraphicsListensParseXML(virDomainGraphicsDef *def,
def->listens = g_new0(virDomainGraphicsListenDef, nListens);
for (i = 0; i < nListens; i++) {
- if (virDomainGraphicsListenDefParseXML(&def->listens[i], def,
+ if (virDomainGraphicsListenDefParseXML(&def->listens[i],
listenNodes[i],
i == 0 ? node : NULL,
flags) < 0)
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index 9265fef4f9..988f0854a5 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -2631,14 +2631,39 @@ static int
virDomainGraphicsDefListensValidate(const virDomainGraphicsDef *def)
{
size_t i;
+ const char *graphicsType = virDomainGraphicsTypeToString(def->type);
for (i = 0; i < def->nListens; i++) {
- if (def->listens[i].type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK &&
- !def->listens[i].network) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("'network' attribute is required for "
- "listen type 'network'"));
- return -1;
+ switch (def->listens[i].type) {
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK:
+ if (!def->listens[i].network) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("'network' attribute is required for "
+ "listen type 'network'"));
+ return -1;
+ }
+ break;
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET:
+ if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
+ def->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("listen type 'socket' is not available for graphics type '%1$s'"),
+ graphicsType);
+ return -1;
+ }
+ break;
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE:
+ if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE &&
+ def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("listen type 'none' is not available for graphics type '%1$s'"),
+ graphicsType);
+ return -1;
+ }
+ break;
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS:
+ case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST:
+ break;
}
}
--
2.40.0
1 year, 8 months