[libvirt PATCH] util: acpi: include unistd.h
by Ján Tomko
For lseek.
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
Pushed as a build breaker fix.
src/util/viracpi.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/util/viracpi.c b/src/util/viracpi.c
index e66df99f03..c96b7c296b 100644
--- a/src/util/viracpi.c
+++ b/src/util/viracpi.c
@@ -22,6 +22,7 @@
#include <inttypes.h>
#include <fcntl.h>
+#include <unistd.h>
#define LIBVIRT_VIRACPIPRIV_H_ALLOW
#include "internal.h"
--
2.39.2
1 year, 6 months
[PATCH] qemu: snapshot: Allow inactive internal snapshots with uefi
by Peter Krempa
Historically the snapshot code attempted to forbid internal snapshots
with UEFI both in active and inactive case. Unfortunately due to the
intricacies of UEFI probing this didn't really work for inactive VMs
which made users rely on the feature.
Now with the changes to store detected UEFI environment also in the
inactive definition this broke the feature for those users.
Since the varstore doesn't really change that much in the lifecycle of a
VM it usually is okay to simply leave it as is.
Restore the functionality for inactive snapshots by disabling the check.
In the future when uefi snapshotting will be added the rest of the
condition will also be removed.
Resolves: https://gitlab.com/libvirt/libvirt/-/issues/460
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_snapshot.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index 12ddf19c48..91de8b0c31 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -749,11 +749,17 @@ qemuSnapshotPrepare(virDomainObj *vm,
* - if the variable store is raw, the snapshot fails
* - allowing a qcow2 image as the varstore would make it eligible to receive
* the vmstate dump, which would make it huge
- * - offline snapshot would not snapshot the varstore at all
*
- * Avoid the issues by forbidding internal snapshot with pflash completely.
+ * While offline snapshot would not snapshot the varstore at all, this used
+ * to work as auto-detected UEFI firmware was not present in the offline
+ * definition. Since in most cases the varstore doesn't change it's usually
+ * not an issue. Allow this as there are existing users of this case.
+ *
+ * Avoid the issues by forbidding internal snapshot with pflash if the
+ * VM is active.
*/
- if (found_internal &&
+ if (active &&
+ found_internal &&
virDomainDefHasOldStyleUEFI(vm->def)) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("internal snapshots of a VM with pflash based "
--
2.39.2
1 year, 6 months
[PATCH] viracpi: Fir error format string in virAcpiParseIORTNodeHeader()
by Michal Privoznik
Inside of virAcpiParseIORTNodeHeader() there's an
virReportError() which reports size of a structure using sizeof()
operator. Well, it's not well documented but the returned type of
sizeof() is apparently size_t but the format string uses %lu.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Pushed under build breaker rule. Also verified this builds successfully
on a 32bit ARM.
src/util/viracpi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/viracpi.c b/src/util/viracpi.c
index 74fff0f0ac..e66df99f03 100644
--- a/src/util/viracpi.c
+++ b/src/util/viracpi.c
@@ -102,7 +102,7 @@ virAcpiParseIORTNodeHeader(int fd,
* least size of header itself. */
if (nodeHeader->len < sizeof(*nodeHeader)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("IORT table node type %1$s has invalid length: got %2$u, expected at least %3$lu"),
+ _("IORT table node type %1$s has invalid length: got %2$u, expected at least %3$zu"),
NULLSTR(typeStr), (unsigned int)nodeHeader->len, sizeof(*nodeHeader));
return -1;
}
--
2.39.2
1 year, 6 months
[PATCH v2] Conf: Move validation of virDomainGraphicsListenDef out of Parser
by K Shiva
From: skran <shiva_kr(a)riseup.net>
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 v2 of:
https://listman.redhat.com/archives/libvir-list/2023-April/239205.html
diff to v1:
- Made virDomainGraphicsListenDefValidate() static, called by
virDomainGraphicsDefListensValidate()
- Removed unused Parameter (*graphics) out of Parse Function definition i.e
virDomainGraphicsListenParseXML()
- Corrected code format
src/conf/domain_conf.c | 9 ++---
src/conf/domain_validate.c | 68 ++++++++++++++++++++------------------
src/conf/domain_validate.h | 4 ---
3 files changed, 37 insertions(+), 44 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1e0ac737bb..746bb4efdf 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5836,7 +5836,7 @@ virDomainStorageNetworkParseHost(xmlNodePtr hostnode,
host->socket = virXMLPropString(hostnode, "socket");
- // Socket Validation
+ /* Socket Validation */
if (virDomainStorageNetHostSocketValidate(host, transport) < 0)
goto cleanup;
@@ -10975,7 +10975,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_*
@@ -10987,7 +10986,6 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node,
*/
static int
virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDef *def,
- virDomainGraphicsDef *graphics,
xmlNodePtr node,
xmlNodePtr parent,
unsigned int flags)
@@ -11009,9 +11007,6 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDef *def,
VIR_XML_PROP_REQUIRED, &def->type) < 0)
goto error;
- if (virDomainGraphicsListenDefValidate(def, graphics) == -1)
- goto error;
-
if (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS) {
if (address && addressCompat && STRNEQ(address, addressCompat)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -11114,7 +11109,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 10f8242c84..a84dbe8bc9 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;
@@ -2669,39 +2704,6 @@ virDomainGraphicsDefValidate(const virDomainDef *def,
return 0;
}
-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
virDomainIOMMUDefValidate(const virDomainIOMMUDef *iommu)
{
diff --git a/src/conf/domain_validate.h b/src/conf/domain_validate.h
index baeae4b2a3..7772a62e18 100644
--- a/src/conf/domain_validate.h
+++ b/src/conf/domain_validate.h
@@ -48,9 +48,5 @@ int virDomainDiskDefSourceLUNValidate(const virStorageSource *src);
int virDomainDefOSValidate(const virDomainDef *def,
virDomainXMLOption *xmlopt);
-int
-virDomainGraphicsListenDefValidate(const virDomainGraphicsListenDef *def,
- const virDomainGraphicsDef *graphics);
-
int virDomainStorageNetHostSocketValidate(const virStorageNetHostDef *host,
const char *transport);
--
2.40.0
1 year, 6 months
[PATCH v2 0/3] virt-host-validate: Detect SMMU presence on ARMs by parsing IORT table
by Michal Privoznik
v2 of:
https://listman.redhat.com/archives/libvir-list/2023-April/239251.html
diff to v1:
- Renamed couple of enum values,
- fixed their string translations,
- Other small nits pointed out by Andrea
Michal Prívozník (3):
util: Introduce virAcpi module
tests: Introduce viracpitest
virt-host-validate: Detect SMMU presence on ARMs by parsing IORT table
build-aux/syntax-check.mk | 2 +-
po/POTFILES | 1 +
src/libvirt_private.syms | 7 +
src/util/meson.build | 1 +
src/util/viracpi.c | 226 ++++++++++++++++++++++++++++
src/util/viracpi.h | 23 +++
src/util/viracpipriv.h | 58 +++++++
tests/meson.build | 1 +
tests/viracpidata/IORT_ampere | Bin 0 -> 2304 bytes
tests/viracpidata/IORT_empty | Bin 0 -> 65 bytes
tests/viracpidata/IORT_gigabyte | Bin 0 -> 10100 bytes
tests/viracpidata/IORT_qualcomm | Bin 0 -> 3560 bytes
tests/viracpidata/IORT_virt_aarch64 | Bin 0 -> 128 bytes
tests/viracpitest.c | 135 +++++++++++++++++
tools/virt-host-validate-common.c | 18 ++-
15 files changed, 468 insertions(+), 4 deletions(-)
create mode 100644 src/util/viracpi.c
create mode 100644 src/util/viracpi.h
create mode 100644 src/util/viracpipriv.h
create mode 100644 tests/viracpidata/IORT_ampere
create mode 100644 tests/viracpidata/IORT_empty
create mode 100644 tests/viracpidata/IORT_gigabyte
create mode 100644 tests/viracpidata/IORT_qualcomm
create mode 100644 tests/viracpidata/IORT_virt_aarch64
create mode 100644 tests/viracpitest.c
--
2.39.2
1 year, 6 months
[RFC PATCH] docs/about/deprecated: Deprecate 32-bit host systems
by Thomas Huth
Testing 32-bit host OS support takes a lot of precious time during the QEMU
contiguous integration tests, and considering that many OS vendors stopped
shipping 32-bit variants of their OS distributions and most hardware from
the past >10 years is capable of 64-bit, keeping the 32-bit support alive
is an inadequate burden for the QEMU project. Let's mark the 32-bit
support as deprecated so we can drop it after a while - this will help
us to cut down our limited CI minutes in the gitlab CI, for example.
Signed-off-by: Thomas Huth <thuth(a)redhat.com>
---
docs/about/deprecated.rst | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index 9f1bbc495d..ce6463e72b 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -181,9 +181,20 @@ As Debian 10 ("Buster") moved into LTS the big endian 32 bit version of
MIPS moved out of support making it hard to maintain our
cross-compilation CI tests of the architecture. As we no longer have
CI coverage support may bitrot away before the deprecation process
-completes. The little endian variants of MIPS (both 32 and 64 bit) are
+completes. The little endian variants of MIPS are
still a supported host architecture.
+32-bit host operating systems (since 8.0)
+'''''''''''''''''''''''''''''''''''''''''
+
+Testing 32-bit host OS support takes a lot of precious time during the QEMU
+contiguous integration tests, and considering that many OS vendors stopped
+shipping 32-bit variants of their OS distributions and most hardware from
+the past >10 years is capable of 64-bit, keeping the 32-bit support alive
+is an inadequate burden for the QEMU project. Thus QEMU will soon drop the
+support for 32-bit host systems.
+
+
QEMU API (QAPI) events
----------------------
--
2.31.1
1 year, 6 months
[PATCH] Conf: Move validation of Graphics Transport and StorageNetwork Socket out of parser
by skran
Thank you for the corrections. I understand it now.
[1] I have made the Graphics Transport validation function static and moved its call out of the parser, to virDomainGraphicsDefListensValidate() in domain_validate.h. Is this a correct implementation?, it does pass the tests.
I have removed the *graphics def parameter from ParseXML function as it became unused after moving the validation out of the Parser.
[2] I can't find a way to implement virDomainStorageNetHostSocketValidate() as static. Could you please point as to which function within domain_validate.h could be used to call this validation function? similar to virDomainGraphicsDefListensValidate() for [1].
[3] How do I obtain char *transport within the validation function without parameter passing?
It's used only to report this error in the below snippet
virReportError(VIR_ERR_XML_ERROR,
_("transport '%1$s' does not support socket attribute"),
transport);
Do I use virXMLPropString(hostnode, "transport") after passing xmlNodePtr hostnode as a parameter? How do I obtain these in domain_validate.h.
Thank you for your help!
Signed-off-by: K Shiva <shiva_kr(a)riseup.net>
---
src/conf/domain_conf.c | 9 ++---
src/conf/domain_validate.c | 68 ++++++++++++++++++++------------------
src/conf/domain_validate.h | 4 ---
3 files changed, 37 insertions(+), 44 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1e0ac737bb..746bb4efdf 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5836,7 +5836,7 @@ virDomainStorageNetworkParseHost(xmlNodePtr hostnode,
host->socket = virXMLPropString(hostnode, "socket");
- // Socket Validation
+ /* Socket Validation */
if (virDomainStorageNetHostSocketValidate(host, transport) < 0)
goto cleanup;
@@ -10975,7 +10975,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_*
@@ -10987,7 +10986,6 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node,
*/
static int
virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDef *def,
- virDomainGraphicsDef *graphics,
xmlNodePtr node,
xmlNodePtr parent,
unsigned int flags)
@@ -11009,9 +11007,6 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDef *def,
VIR_XML_PROP_REQUIRED, &def->type) < 0)
goto error;
- if (virDomainGraphicsListenDefValidate(def, graphics) == -1)
- goto error;
-
if (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS) {
if (address && addressCompat && STRNEQ(address, addressCompat)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -11114,7 +11109,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 10f8242c84..a84dbe8bc9 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;
@@ -2669,39 +2704,6 @@ virDomainGraphicsDefValidate(const virDomainDef *def,
return 0;
}
-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
virDomainIOMMUDefValidate(const virDomainIOMMUDef *iommu)
{
diff --git a/src/conf/domain_validate.h b/src/conf/domain_validate.h
index baeae4b2a3..7772a62e18 100644
--- a/src/conf/domain_validate.h
+++ b/src/conf/domain_validate.h
@@ -48,9 +48,5 @@ int virDomainDiskDefSourceLUNValidate(const virStorageSource *src);
int virDomainDefOSValidate(const virDomainDef *def,
virDomainXMLOption *xmlopt);
-int
-virDomainGraphicsListenDefValidate(const virDomainGraphicsListenDef *def,
- const virDomainGraphicsDef *graphics);
-
int virDomainStorageNetHostSocketValidate(const virStorageNetHostDef *host,
const char *transport);
--
2.40.0
1 year, 6 months
[PATCH 0/2] libxl: Support custom EFI firmware path
by Jim Fehlig
libxl added support for specifying custom firmware paths long ago. This series
adds support to the libxl driver and the XML to xl.cfg config converter.
Jim Fehlig (2):
libxl: Support specifying a custom firmware path
libxl: Add support for custom firmware path in config converter
src/libxl/libxl_conf.c | 14 ++--
src/libxl/xen_xl.c | 19 +++--
tests/libxlxml2domconfigdata/efi-hvm.json | 91 +++++++++++++++++++++++
tests/libxlxml2domconfigdata/efi-hvm.xml | 36 +++++++++
tests/libxlxml2domconfigtest.c | 1 +
tests/xlconfigdata/test-fullvirt-ovmf.cfg | 1 +
tests/xlconfigdata/test-fullvirt-ovmf.xml | 2 +-
7 files changed, 150 insertions(+), 14 deletions(-)
create mode 100644 tests/libxlxml2domconfigdata/efi-hvm.json
create mode 100644 tests/libxlxml2domconfigdata/efi-hvm.xml
--
2.39.1
1 year, 6 months
[libvirt PATCH 00/20] introduce external snapshot revert support
by Pavel Hrdina
This implements virDomainRevertToSnapshot to work with external
snapshots. In addition it modifies virDomainSnapshotDelete to work
correctly when we revert to non-leaf snapshot.
Gitlab repo with the patches:
https://gitlab.com/phrdina/libvirt/-/tree/snapshot-revert-external
Pavel Hrdina (20):
libvirt_private: list virDomainMomentDefPostParse
snapshot_conf: export virDomainSnapshotDiskDefClear
snapshot_conf: use alternate domain definition in
virDomainSnapshotDefAssignExternalNames
snapshot_conf: introduce <revertDisks> metadata element
qemu_snapshot: introduce qemuSnapshotDomainDefUpdateDisk
qemu_snapshot: use virDomainDiskByName while updating domain def
qemu_snapshot: introduce qemuSnapshotCreateQcow2Files
qemu_snapshot: allow using alternate domain definition when creating
qcow2 files
qemu_snapshot: introduce external snapshot revert support
qemu_snapshot: rename qemuSnapshotDeleteExternalPrepare
qemu_snapshot: extract external snapshot delete prepare to function
qemu_snapshot: add blockCommit to external snapshot delete prepare
data
qemu_snapshot: prepare data for non-active leaf external snapshot
deletion
qemu_snapshot: add support to delete external snapshot without block
commit
qemu_snapshot: delete: properly update parent snapshot with revert
data
qemu_snapshot: don't allow creating external snapshot after reverting
virdomainmomentobjlist: introduce virDomainMomentIsAncestor
qemu_snapshot: check only once if snapshot is external
qemu_snapshot: add checks for external snapshot deletion
qemu_snapshot: allow snapshot revert for external snapshots
src/conf/schemas/domainsnapshot.rng | 7 +
src/conf/snapshot_conf.c | 37 +-
src/conf/snapshot_conf.h | 8 +
src/conf/virdomainmomentobjlist.c | 21 +
src/conf/virdomainmomentobjlist.h | 4 +
src/libvirt_private.syms | 6 +
src/qemu/qemu_snapshot.c | 621 ++++++++++++++++++++--------
7 files changed, 538 insertions(+), 166 deletions(-)
--
2.39.2
1 year, 6 months
Re: [PATCH] Conf: Move validation of Graphics Transport and StorageNetwork Socket out of parser
by skran
Thank you for the corrections. I understand it now.
[1] I have made the Graphics Transport validation function static and moved its call out of the parser, to virDomainGraphicsDefListensValidate() in domain_validate.h. Is this a correct implementation?, it does pass the tests.
I have removed the *graphics def parameter from ParseXML function as it became unused after moving the validation out of the Parser.
[2] I can't find a way to implement virDomainStorageNetHostSocketValidate() as static. Could you please point as to which function within domain_validate.h could be used to call this validation function? similar to virDomainGraphicsDefListensValidate() for [1].
[3] How do I obtain char *transport within the validation function without parameter passing?
It's used only to report this error in the below snippet
virReportError(VIR_ERR_XML_ERROR,
_("transport '%1$s' does not support socket attribute"),
transport);
Do I use virXMLPropString(hostnode, "transport") after passing xmlNodePtr hostnode as a parameter? How do I obtain these in domain_validate.h.
Thank you for your help!
Signed-off-by: K Shiva <shiva_kr(a)riseup.net>
---
src/conf/domain_conf.c | 9 ++---
src/conf/domain_validate.c | 68 ++++++++++++++++++++------------------
src/conf/domain_validate.h | 4 ---
3 files changed, 37 insertions(+), 44 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1e0ac737bb..746bb4efdf 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5836,7 +5836,7 @@ virDomainStorageNetworkParseHost(xmlNodePtr hostnode,
host->socket = virXMLPropString(hostnode, "socket");
- // Socket Validation
+ /* Socket Validation */
if (virDomainStorageNetHostSocketValidate(host, transport) < 0)
goto cleanup;
@@ -10975,7 +10975,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_*
@@ -10987,7 +10986,6 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node,
*/
static int
virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDef *def,
- virDomainGraphicsDef *graphics,
xmlNodePtr node,
xmlNodePtr parent,
unsigned int flags)
@@ -11009,9 +11007,6 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDef *def,
VIR_XML_PROP_REQUIRED, &def->type) < 0)
goto error;
- if (virDomainGraphicsListenDefValidate(def, graphics) == -1)
- goto error;
-
if (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS) {
if (address && addressCompat && STRNEQ(address, addressCompat)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -11114,7 +11109,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 10f8242c84..a84dbe8bc9 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;
@@ -2669,39 +2704,6 @@ virDomainGraphicsDefValidate(const virDomainDef *def,
return 0;
}
-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
virDomainIOMMUDefValidate(const virDomainIOMMUDef *iommu)
{
diff --git a/src/conf/domain_validate.h b/src/conf/domain_validate.h
index baeae4b2a3..7772a62e18 100644
--- a/src/conf/domain_validate.h
+++ b/src/conf/domain_validate.h
@@ -48,9 +48,5 @@ int virDomainDiskDefSourceLUNValidate(const virStorageSource *src);
int virDomainDefOSValidate(const virDomainDef *def,
virDomainXMLOption *xmlopt);
-int
-virDomainGraphicsListenDefValidate(const virDomainGraphicsListenDef *def,
- const virDomainGraphicsDef *graphics);
-
int virDomainStorageNetHostSocketValidate(const virStorageNetHostDef *host,
const char *transport);
--
2.40.0
1 year, 7 months