[libvirt] [PATCH v3 0/2] snapshot: Store both config and live XML in the snapshot domain
by Maxiwell S. Garcia
This patchset store both config and live XML in the snapshot XML.
To avoid nest 'config' XML one level deeper ('inactive/domain'),
it was necessary change the virDomainDefFormatInternal() to use
'domain' or 'inactiveDomain' in the root node.
Maxiwell S. Garcia (2):
qemu: formatting XML from domain def choosing the root name
snapshot: Store both config and live XML in the snapshot domain
src/conf/domain_conf.c | 13 ++++++++++---
src/conf/domain_conf.h | 1 +
src/conf/moment_conf.c | 1 +
src/conf/moment_conf.h | 11 +++++++++++
src/conf/snapshot_conf.c | 23 +++++++++++++++++++++--
src/qemu/qemu_driver.c | 37 ++++++++++++++++++++++++++++---------
6 files changed, 72 insertions(+), 14 deletions(-)
--
2.20.1
5 years, 4 months
[libvirt] [PATCH] virDomainGetAutostart takes a pointer that it writes the output value to
by Sage Imel
The current version of get_autostart seg faults. This patch
correctly passes a pointer to an int to virDomainGetAutostart
and returns a result based on the value of that int
Signed-off-by: sage Imel <sage(a)cat.pdx.edu>
---
src/domain.rs | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/domain.rs b/src/domain.rs
index 11ecb3c..acb9e6e 100644
--- a/src/domain.rs
+++ b/src/domain.rs
@@ -136,7 +136,7 @@ extern "C" {
fn virDomainGetHostname(ptr: sys::virDomainPtr, flags: libc::c_uint) -> *mut libc::c_char;
fn virDomainGetUUIDString(ptr: sys::virDomainPtr, uuid: *mut libc::c_char) -> libc::c_int;
fn virDomainGetXMLDesc(ptr: sys::virDomainPtr, flags: libc::c_uint) -> *mut libc::c_char;
- fn virDomainGetAutostart(ptr: sys::virDomainPtr) -> libc::c_int;
+ fn virDomainGetAutostart(ptr: sys::virDomainPtr, autostart: *mut libc::c_int) -> libc::c_int;
fn virDomainSetAutostart(ptr: sys::virDomainPtr, autostart: libc::c_uint) -> libc::c_int;
fn virDomainGetID(ptr: sys::virDomainPtr) -> libc::c_uint;
fn virDomainSetMaxMemory(ptr: sys::virDomainPtr, memory: libc::c_ulong) -> libc::c_int;
@@ -1036,11 +1036,12 @@ impl Domain {
pub fn get_autostart(&self) -> Result<bool, Error> {
unsafe {
- let ret = virDomainGetAutostart(self.as_ptr());
+ let mut autostart: libc::c_int = 0;
+ let ret = virDomainGetAutostart(self.as_ptr(), &mut autostart);
if ret == -1 {
return Err(Error::new());
}
- return Ok(ret == 1);
+ return Ok(autostart == 1);
}
}
--
2.17.1
5 years, 4 months
[libvirt] [PATCH] virDomainGetAutostart takes a pointer that it writes the output value to
by Sage Imel
---
src/domain.rs | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/domain.rs b/src/domain.rs
index 11ecb3c..acb9e6e 100644
--- a/src/domain.rs
+++ b/src/domain.rs
@@ -136,7 +136,7 @@ extern "C" {
fn virDomainGetHostname(ptr: sys::virDomainPtr, flags: libc::c_uint) -> *mut libc::c_char;
fn virDomainGetUUIDString(ptr: sys::virDomainPtr, uuid: *mut libc::c_char) -> libc::c_int;
fn virDomainGetXMLDesc(ptr: sys::virDomainPtr, flags: libc::c_uint) -> *mut libc::c_char;
- fn virDomainGetAutostart(ptr: sys::virDomainPtr) -> libc::c_int;
+ fn virDomainGetAutostart(ptr: sys::virDomainPtr, autostart: *mut libc::c_int) -> libc::c_int;
fn virDomainSetAutostart(ptr: sys::virDomainPtr, autostart: libc::c_uint) -> libc::c_int;
fn virDomainGetID(ptr: sys::virDomainPtr) -> libc::c_uint;
fn virDomainSetMaxMemory(ptr: sys::virDomainPtr, memory: libc::c_ulong) -> libc::c_int;
@@ -1036,11 +1036,12 @@ impl Domain {
pub fn get_autostart(&self) -> Result<bool, Error> {
unsafe {
- let ret = virDomainGetAutostart(self.as_ptr());
+ let mut autostart: libc::c_int = 0;
+ let ret = virDomainGetAutostart(self.as_ptr(), &mut autostart);
if ret == -1 {
return Err(Error::new());
}
- return Ok(ret == 1);
+ return Ok(autostart == 1);
}
}
--
2.17.1
5 years, 4 months
[libvirt] [PATCH] xml: namespaces: use uri instead of href
by Ján Tomko
Store the namespace URI as const char*, instead of in a function.
Suggested-by: Jiri Denemark <jdenemar(a)redhat.com>
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
src/bhyve/bhyve_domain.c | 11 ++---------
src/lxc/lxc_domain.c | 9 +--------
src/network/bridge_driver.c | 11 +----------
src/qemu/qemu_domain.c | 10 +---------
src/storage/storage_backend_fs.c | 9 +--------
src/storage/storage_backend_rbd.c | 11 +----------
src/test/test_driver.c | 11 ++---------
src/util/virxml.c | 6 +++---
src/util/virxml.h | 2 +-
src/vmx/vmx.c | 8 +-------
10 files changed, 14 insertions(+), 74 deletions(-)
diff --git a/src/bhyve/bhyve_domain.c b/src/bhyve/bhyve_domain.c
index ea4bd54969..ed281d7c68 100644
--- a/src/bhyve/bhyve_domain.c
+++ b/src/bhyve/bhyve_domain.c
@@ -31,8 +31,6 @@
VIR_LOG_INIT("bhyve.bhyve_domain");
-#define BHYVE_NAMESPACE_HREF "http://libvirt.org/schemas/domain/bhyve/1.0"
-
static void *
bhyveDomainObjPrivateAlloc(void *opaque ATTRIBUTE_UNUSED)
{
@@ -258,16 +256,11 @@ bhyveDomainDefNamespaceFormatXML(virBufferPtr buf,
return 0;
}
-static const char *
-bhyveDomainDefNamespaceHref(void)
-{
- return BHYVE_NAMESPACE_HREF;
-}
-
virXMLNamespace virBhyveDriverDomainXMLNamespace = {
.parse = bhyveDomainDefNamespaceParse,
.free = bhyveDomainDefNamespaceFree,
.format = bhyveDomainDefNamespaceFormatXML,
.prefix = "bhyve",
- .href = bhyveDomainDefNamespaceHref,
+ .uri = "http://libvirt.org/schemas/domain/bhyve/1.0",
+
};
diff --git a/src/lxc/lxc_domain.c b/src/lxc/lxc_domain.c
index 00362e4c7f..c4360f25f6 100644
--- a/src/lxc/lxc_domain.c
+++ b/src/lxc/lxc_domain.c
@@ -34,7 +34,6 @@
#include "virinitctl.h"
#define VIR_FROM_THIS VIR_FROM_LXC
-#define LXC_NAMESPACE_HREF "http://libvirt.org/schemas/domain/lxc/1.0"
VIR_ENUM_IMPL(virLXCDomainJob,
LXC_JOB_LAST,
@@ -302,19 +301,13 @@ lxcDomainDefNamespaceFormatXML(virBufferPtr buf,
return 0;
}
-static const char *
-lxcDomainDefNamespaceHref(void)
-{
- return LXC_NAMESPACE_HREF;
-}
-
virXMLNamespace virLXCDriverDomainXMLNamespace = {
.parse = lxcDomainDefNamespaceParse,
.free = lxcDomainDefNamespaceFree,
.format = lxcDomainDefNamespaceFormatXML,
.prefix = "lxc",
- .href = lxcDomainDefNamespaceHref,
+ .uri = "http://libvirt.org/schemas/domain/lxc/1.0",
};
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index dd4f111cc0..86e2035b85 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -83,8 +83,6 @@
VIR_LOG_INIT("network.bridge_driver");
-#define DNSMASQ_NAMESPACE_HREF "http://libvirt.org/schemas/network/dnsmasq/1.0"
-
static virNetworkDriverStatePtr network_driver;
@@ -231,19 +229,12 @@ networkDnsmasqDefNamespaceFormatXML(virBufferPtr buf,
}
-static const char *
-networkDnsmasqDefNamespaceHref(void)
-{
- return DNSMASQ_NAMESPACE_HREF;
-}
-
-
virXMLNamespace networkDnsmasqXMLNamespace = {
.parse = networkDnsmasqDefNamespaceParse,
.free = networkDnsmasqDefNamespaceFree,
.format = networkDnsmasqDefNamespaceFormatXML,
.prefix = "dnsmasq",
- .href = networkDnsmasqDefNamespaceHref,
+ .uri = "http://libvirt.org/schemas/network/dnsmasq/1.0",
};
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 6d770d3c13..8a3755c6fe 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -81,8 +81,6 @@
VIR_LOG_INIT("qemu.qemu_domain");
-#define QEMU_NAMESPACE_HREF "http://libvirt.org/schemas/domain/qemu/1.0"
-
VIR_ENUM_IMPL(qemuDomainJob,
QEMU_JOB_LAST,
"none",
@@ -3713,19 +3711,13 @@ qemuDomainDefNamespaceFormatXML(virBufferPtr buf,
return 0;
}
-static const char *
-qemuDomainDefNamespaceHref(void)
-{
- return QEMU_NAMESPACE_HREF;
-}
-
virXMLNamespace virQEMUDriverDomainXMLNamespace = {
.parse = qemuDomainDefNamespaceParse,
.free = qemuDomainDefNamespaceFree,
.format = qemuDomainDefNamespaceFormatXML,
.prefix = "qemu",
- .href = qemuDomainDefNamespaceHref,
+ .uri = "http://libvirt.org/schemas/domain/qemu/1.0",
};
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index d947beac2c..d793ac19e8 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -528,7 +528,6 @@ virStorageBackendFileSystemBuild(virStoragePoolObjPtr pool,
#if WITH_STORAGE_FS
-# define STORAGE_POOL_FS_NAMESPACE_HREF "http://libvirt.org/schemas/storagepool/fs/1.0"
/* Backend XML Namespace handling for fs or netfs specific mount options to
* be added to the mount -o {options_list} command line that are not otherwise
@@ -624,12 +623,6 @@ virStoragePoolDefFSNamespaceFormatXML(virBufferPtr buf,
}
-static const char *
-virStoragePoolDefFSNamespaceHref(void)
-{
- return STORAGE_POOL_FS_NAMESPACE_HREF;
-}
-
#endif /* WITH_STORAGE_FS */
@@ -697,7 +690,7 @@ static virXMLNamespace virStoragePoolFSXMLNamespace = {
.free = virStoragePoolDefFSNamespaceFree,
.format = virStoragePoolDefFSNamespaceFormatXML,
.prefix = "fs",
- .href = virStoragePoolDefFSNamespaceHref,
+ .uri = "http://libvirt.org/schemas/storagepool/fs/1.0",
};
#endif /* WITH_STORAGE_FS */
diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index 22caa189d7..c4781debd8 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -58,8 +58,6 @@ struct _virStoragePoolRBDConfigOptionsDef {
char **values;
};
-#define STORAGE_POOL_RBD_NAMESPACE_HREF "http://libvirt.org/schemas/storagepool/rbd/1.0"
-
static void
virStoragePoolDefRBDNamespaceFree(void *nsdata)
{
@@ -166,13 +164,6 @@ virStoragePoolDefRBDNamespaceFormatXML(virBufferPtr buf,
}
-static const char *
-virStoragePoolDefRBDNamespaceHref(void)
-{
- return STORAGE_POOL_RBD_NAMESPACE_HREF;
-}
-
-
static int
virStorageBackendRBDRADOSConfSet(rados_t cluster,
const char *option,
@@ -1538,7 +1529,7 @@ static virXMLNamespace virStoragePoolRBDXMLNamespace = {
.free = virStoragePoolDefRBDNamespaceFree,
.format = virStoragePoolDefRBDNamespaceFormatXML,
.prefix = "rbd",
- .href = virStoragePoolDefRBDNamespaceHref,
+ .uri = "http://libvirt.org/schemas/storagepool/rbd/1.0",
};
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 57d54c05b3..6a694d8b1f 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -167,8 +167,6 @@ testDriverDispose(void *obj)
virObjectUnref(driver->eventState);
}
-#define TEST_NAMESPACE_HREF "http://libvirt.org/schemas/domain/test/1.0"
-
typedef struct _testDomainNamespaceDef testDomainNamespaceDef;
typedef testDomainNamespaceDef *testDomainNamespaceDefPtr;
struct _testDomainNamespaceDef {
@@ -180,12 +178,6 @@ struct _testDomainNamespaceDef {
xmlNodePtr *snap_nodes;
};
-static const char*
-testDomainDefNamespaceHref(void)
-{
- return TEST_NAMESPACE_HREF;
-}
-
static void
testDomainDefNamespaceFree(void *data)
{
@@ -427,7 +419,8 @@ testDriverNew(void)
.parse = testDomainDefNamespaceParse,
.free = testDomainDefNamespaceFree,
.prefix = "test",
- .href = testDomainDefNamespaceHref,
+ .uri = "http://libvirt.org/schemas/domain/test/1.0",
+
};
virDomainDefParserConfig config = {
.features = VIR_DOMAIN_DEF_FEATURE_MEMORY_HOTPLUG |
diff --git a/src/util/virxml.c b/src/util/virxml.c
index 84b824f432..f9c117dd58 100644
--- a/src/util/virxml.c
+++ b/src/util/virxml.c
@@ -1416,7 +1416,7 @@ void
virXMLNamespaceFormatNS(virBufferPtr buf,
virXMLNamespace const *ns)
{
- virBufferAsprintf(buf, " xmlns:%s='%s'", ns->prefix, ns->href());
+ virBufferAsprintf(buf, " xmlns:%s='%s'", ns->prefix, ns->uri);
}
@@ -1426,10 +1426,10 @@ virXMLNamespaceRegister(xmlXPathContextPtr ctxt,
{
if (xmlXPathRegisterNs(ctxt,
BAD_CAST ns->prefix,
- BAD_CAST ns->href()) < 0) {
+ BAD_CAST ns->uri) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to register xml namespace '%s'"),
- ns->href());
+ ns->uri);
return -1;
}
diff --git a/src/util/virxml.h b/src/util/virxml.h
index be2abd23f7..30cc895436 100644
--- a/src/util/virxml.h
+++ b/src/util/virxml.h
@@ -257,7 +257,7 @@ struct _virXMLNamespace {
virXMLNamespaceFree free;
virXMLNamespaceFormat format;
const char *prefix;
- virXMLNamespaceHref href;
+ const char *uri;
};
typedef struct _virXMLNamespace virXMLNamespace;
typedef virXMLNamespace *virXMLNamespacePtr;
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index c4e90537f8..2cc0995783 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -597,18 +597,12 @@ virVMXDomainDefNamespaceFormatXML(virBufferPtr buf, void *nsdata)
return 0;
}
-static const char *
-virVMXDomainDefNamespaceHref(void)
-{
- return "http://libvirt.org/schemas/domain/vmware/1.0";
-}
-
static virXMLNamespace virVMXDomainXMLNamespace = {
.parse = NULL,
.free = virVMXDomainDefNamespaceFree,
.format = virVMXDomainDefNamespaceFormatXML,
.prefix = "vmware",
- .href = virVMXDomainDefNamespaceHref,
+ .uri = "http://libvirt.org/schemas/domain/vmware/1.0",
};
virDomainXMLOptionPtr
--
2.19.2
5 years, 4 months
[libvirt] [PATCH] virt-aa-helper: Actually fix AppArmor profile
by Andrea Bolognani
Tried previously in
commit b1eb8b3e8fd1d4cb1da8e5e2b16f2c10837fd823
Author: Andrea Bolognani <abologna(a)redhat.com>
Date: Mon Aug 19 10:23:42 2019 +0200
virt-aa-helper: Fix AppArmor profile
v5.6.0-243-gb1eb8b3e8f
with somewhat disappointing results.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
src/security/apparmor/usr.lib.libvirt.virt-aa-helper | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/security/apparmor/usr.lib.libvirt.virt-aa-helper b/src/security/apparmor/usr.lib.libvirt.virt-aa-helper
index d81dddef30..64772f0756 100644
--- a/src/security/apparmor/usr.lib.libvirt.virt-aa-helper
+++ b/src/security/apparmor/usr.lib.libvirt.virt-aa-helper
@@ -18,8 +18,8 @@ profile virt-aa-helper /usr/{lib,lib64}/libvirt/virt-aa-helper {
@{PROC}/filesystems r,
# Used when internally running another command (namely apparmor_parser)
- @{PROC}/self/fd r,
- @{PROC}/@{pid}/fd r,
+ @{PROC}/self/fd/ r,
+ @{PROC}/@{pid}/fd/ r,
/etc/libnl-3/classid r,
--
2.21.0
5 years, 4 months
[libvirt] [PATCH 00/21] conf: namespaces: remove some copy'n'paste
by Ján Tomko
Ján Tomko (21):
virDomainDefNamespaceParse: remove unused attributes
virDomainDefParseXML: remove unused parameter
prepare: domain format if format not href
conf: ns.parse: decouple call from condition
util: introduce virXMLNamespace
conf: network: use generic XML namespace types
conf: storage: use generic XML namespace types
conf: domain: use generic XML namespace types
xml: virXMLNamespace: add prefix
conf: network: store namespace prefix
conf: domain: store namespace prefix
conf: storage: store namespace prefix
conf: test: store namespace href
util: introduce virXMLNamespaceFormatNS
conf: network: use virXMLNamespaceFormatNS
conf: storage: use virXMLNamespaceFormatNS
conf: domain: use virXMLNamespaceFormatNS
util: xml: introduce virXMLNamespaceRegister
conf: network: use virXMLNamespaceRegister
conf: storage: use virXMLNamespaceRegister
conf: domain: use virXMLNamespaceRegister
src/bhyve/bhyve_domain.c | 18 ++++--------------
src/bhyve/bhyve_domain.h | 2 +-
src/conf/capabilities.h | 13 -------------
src/conf/domain_conf.c | 24 +++++++++++++-----------
src/conf/domain_conf.h | 6 +++---
src/conf/network_conf.c | 13 ++++++++-----
src/conf/network_conf.h | 25 ++++---------------------
src/conf/storage_conf.c | 15 +++++++++------
src/conf/storage_conf.h | 23 ++++-------------------
src/conf/virconftypes.h | 3 ---
src/lxc/lxc_domain.c | 17 ++++-------------
src/lxc/lxc_domain.h | 2 +-
src/network/bridge_driver.c | 15 +++------------
src/network/bridge_driver.h | 2 +-
src/qemu/qemu_domain.c | 17 ++++-------------
src/qemu/qemu_domain.h | 2 +-
src/storage/storage_backend_fs.c | 14 +++-----------
src/storage/storage_backend_rbd.c | 14 +++-----------
src/storage/storage_util.c | 2 +-
src/storage/storage_util.h | 2 +-
src/test/test_driver.c | 23 ++++++++++-------------
src/util/virxml.c | 27 +++++++++++++++++++++++++++
src/util/virxml.h | 22 ++++++++++++++++++++++
src/vmx/vmx.c | 5 +++--
24 files changed, 130 insertions(+), 176 deletions(-)
--
2.19.2
5 years, 4 months
[libvirt] [PATCH] virpci:fix Secondary Bus Reset bug
by hexin900110@163.com
From: hexin <hexin15(a)baidu.com>
The parent bridge configuration of the current device
should be read and reset, instead of reading the current
device configuration.
Signed-off-by: He Xin <hexin15(a)baidu.com>
Signed-off-by: Liu Qi <liuqi16(a)baidu.com>
Signed-off-by: Zhang Yu <zhangyu31(a)baidu.com>
---
src/util/virpci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/virpci.c b/src/util/virpci.c
index 61a6b359e5..483de2cb16 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -821,7 +821,7 @@ virPCIDeviceTrySecondaryBusReset(virPCIDevicePtr dev,
/* Read the control register, set the reset flag, wait 200ms,
* unset the reset flag and wait 200ms.
*/
- ctl = virPCIDeviceRead16(dev, cfgfd, PCI_BRIDGE_CONTROL);
+ ctl = virPCIDeviceRead16(dev, parentfd, PCI_BRIDGE_CONTROL);
virPCIDeviceWrite16(parent, parentfd, PCI_BRIDGE_CONTROL,
ctl | PCI_BRIDGE_CTL_RESET);
--
2.22.0
5 years, 4 months
[libvirt] [PATCH 0/2] cgroups v2 fixes
by Pavel Hrdina
*** BLURB HERE ***
Pavel Hrdina (2):
vircgroupv2: fix parsing multiple values in single file
vircgroupv2: fix virCgroupV2GetCpuCfsQuota for "max" value
src/util/vircgroupv2.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
--
2.21.0
5 years, 4 months
[libvirt] [ocaml PATCH 0/3] Misc improvements
by Pino Toscano
*** IMAGINE A BLURB HERE ***
Pino Toscano (3):
Synchronize Virterror with libvirt 5.6.0
Update config.guess and config.sub
Fix shebang in perl scripts
config.guess | 284 ++++++++++++++++++++++++++++-------
config.sub | 69 +++++----
libvirt/generator.pl | 3 +-
libvirt/libvirt.ml | 8 +
libvirt/libvirt.mli | 4 +
libvirt/libvirt_c_epilogue.c | 4 +-
6 files changed, 282 insertions(+), 90 deletions(-)
--
2.21.0
5 years, 4 months
[libvirt] 5.6.0 regression: "Some activation file descriptors are unclaimed"
by Allen, John
After upgrading to v5.6.0, starting libvirtd fails with the following message
in journalctl -xe:
libvirtd[186338]: internal error: Some activation file descriptors are unclaimed
5b8569dd6e284b9159c701e8bffafb196983fc4a introduces the message. The commit
message indicates that systemd version 227 is required, but my system seems to
be running version 237.
Is this a known issue? Is there any other configuration for systemd needed to
avoid the problem?
Thanks,
John
5 years, 4 months