[PATCH] qemu: snapshot: Prevent too-nested domain XML when doing inactive snapshot
by Peter Krempa
Similarly to 510d154a0b41aa70aadabc0918d16dee22882394 we need to prevent
doing too deeply nested backing chains and reject them with a sane error
message.
Add a loop to go through the snapshots prior to attempting actually
creating them to prevent some possible inconsistent scenarios.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_driver.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 2f66d7cd9a..4cebb54913 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14618,6 +14618,16 @@ qemuDomainSnapshotCreateInactiveExternal(virQEMUDriverPtr driver,
if (!(created = virBitmapNew(snapdef->ndisks)))
goto cleanup;
+ for (i = 0; i < snapdef->ndisks && !reuse; i++) {
+ snapdisk = &(snapdef->disks[i]);
+ defdisk = snapdef->parent.dom->disks[snapdisk->idx];
+ if (snapdisk->snapshot != VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)
+ continue;
+
+ if (qemuDomainStorageSourceValidateDepth(defdisk->src, 1, defdisk->dst) < 0)
+ return -1;
+ }
+
/* If reuse is true, then qemuDomainSnapshotPrepare already
* ensured that the new files exist, and it was up to the user to
* create them correctly. */
--
2.24.1
4 years, 11 months
[PATCH] qemu: monitor: Improve error message when QEMU reply is too large
by Peter Krempa
Don't use ERANGE as it doesn't make much sense in the error message.
Also point out that the reply from qemu was too large which is not
obvious from the original error:
error: No complete monitor response found in 10485760 bytes: Numerical result out of range
The new message will read:
error: internal error: QEMU monitor reply exceeds buffer size (10485760 bytes)
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_monitor.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index ccd20b3740..e3bd000ccb 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -484,9 +484,9 @@ qemuMonitorIORead(qemuMonitorPtr mon)
if (avail < 1024) {
if (mon->bufferLength >= QEMU_MONITOR_MAX_RESPONSE) {
- virReportSystemError(ERANGE,
- _("No complete monitor response found in %d bytes"),
- QEMU_MONITOR_MAX_RESPONSE);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("QEMU monitor reply exceeds buffer size (%d bytes)"),
+ QEMU_MONITOR_MAX_RESPONSE);
return -1;
}
if (VIR_REALLOC_N(mon->buffer,
--
2.24.1
4 years, 11 months
[libvirt PATCH] qemu: end the agent job in qemuDomainSetTimeAgent
by Ján Tomko
This function grabs an agent job but ends a monitor job.
End the agent job instead.
https://bugzilla.redhat.com/show_bug.cgi?id=1792723
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
Reported-by: Dan Zheng <dzheng(a)redhat.com>
Fixes: e005c95f56fee9ed780be7f8db103d690bd34cbd
---
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 7e379fe83a..2f66d7cd9a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -20464,7 +20464,7 @@ qemuDomainSetTimeAgent(virQEMUDriverPtr driver,
qemuDomainObjExitAgent(vm, agent);
endjob:
- qemuDomainObjEndJob(driver, vm);
+ qemuDomainObjEndAgentJob(vm);
return ret;
}
--
2.21.0
4 years, 11 months
[libvirt] [PATCH] Don't check if the path exists for LVM
by ebenner
I'm not entirely sure why Libvirt is checking to see if the target file
exists for LVM but it is a problem. Empty volume groups do not appear in
/dev. When libvirt starts these pools then fail to autostart because
their path does not exist. This is not useful, this is the patch we are
running to resolve this issue.
---
src/storage/storage_backend_logical.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/storage/storage_backend_logical.c
b/src/storage/storage_backend_logical.c
index 42dec05ba0..2c60719b8c 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -641,11 +641,9 @@
virStorageBackendLogicalCheckPool(virStoragePoolObjPtr pool,
{
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
- /* If we can find the target.path as well as ensure that the
- * pool's def source
- */
- *isActive = virFileExists(def->target.path) &&
- virStorageBackendLogicalMatchPoolSource(pool);
+ /* Ensure that the pool's def source is correct */
+ *isActive = virStorageBackendLogicalMatchPoolSource(pool);
+
return 0;
}
--
2.24.1
4 years, 11 months
[PATCH] Re: storage: Cleaning up pools is not always ideal
by ebenner@vultr.com
From: Eric Benner <ebenner(a)vultr.com>
Didn't have a sign off and was formatted by a mail client. This is a functional copy of this patch with the requirements.
Signed-off-by: Eric Benner <ebenner(a)vultr.com>
---
src/remote/libvirtd.conf.in | 7 +++++++
src/storage/storage_driver.c | 38 ++++++++++++++++++++++++++++++++----
2 files changed, 41 insertions(+), 4 deletions(-)
diff --git a/src/remote/libvirtd.conf.in b/src/remote/libvirtd.conf.in
index 34741183cc..5600c26eca 100644
--- a/src/remote/libvirtd.conf.in
+++ b/src/remote/libvirtd.conf.in
@@ -506,3 +506,10 @@
# potential infinite waits blocking libvirt.
#
#ovs_timeout = 5
+
+###################################################################
+# This decides whether to disable pools that errors in some way such as during a refresh
+# This can negatively affect LVM pools. 1 = disable the pools, 2 = don't disable the pools
+# Do not use this if you are not using only LVM pools
+#
+cleanup_pools = 1
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 0bb116cf08..5f8bc8a835 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -55,6 +55,7 @@
VIR_LOG_INIT("storage.storage_driver");
static virStorageDriverStatePtr driver;
+static int cleanup_pools = -1;
static int storageStateCleanup(void);
@@ -74,6 +75,20 @@ static void storageDriverUnlock(void)
virMutexUnlock(&driver->lock);
}
+static int cleanupPools(void)
+{
+ if (cleanup_pools == -1) {
+ g_autoptr(virConf) libvirtConf = NULL;
+ virConfLoadConfig(&libvirtConf, "libvirtd.conf");
+
+ if (!virConfGetValueInt(libvirtConf, "cleanup_pools", &cleanup_pools)
+ || (cleanup_pools != 0 && cleanup_pools != 1))
+ cleanup_pools = 1;
+ }
+
+ return cleanup_pools;
+}
+
static void
storagePoolRefreshFailCleanup(virStorageBackendPtr backend,
@@ -81,14 +96,26 @@ storagePoolRefreshFailCleanup(virStorageBackendPtr backend,
const char *stateFile)
{
virErrorPtr orig_err;
-
virErrorPreserveLast(&orig_err);
virStoragePoolObjClearVols(obj);
if (stateFile)
unlink(stateFile);
- if (backend->stopPool)
- backend->stopPool(obj);
+
+ if (!cleanupPools()) {
+ virStoragePoolDefPtr def = virStoragePoolObjGetDef(obj);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to refresh storage pool '%s'. Would have disabled this pool but clean_pools = 0: %s"),
+ def->name, virGetLastErrorMessage());
+ } else {
+ virStoragePoolDefPtr def = virStoragePoolObjGetDef(obj);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to refresh storage pool '%s'. Disabled this pool because clean_pools = 1: %s"),
+ def->name, virGetLastErrorMessage());
+ if (backend->stopPool) {
+ backend->stopPool(obj);
+ }
+ }
virErrorRestore(&orig_err);
}
@@ -101,7 +128,10 @@ storagePoolRefreshImpl(virStorageBackendPtr backend,
virStoragePoolObjClearVols(obj);
if (backend->refreshPool(obj) < 0) {
storagePoolRefreshFailCleanup(backend, obj, stateFile);
- return -1;
+ if (!cleanupPools())
+ return 0;
+ else
+ return -1;
}
return 0;
--
2.24.1
4 years, 11 months
[RFC PATCH] libxl: support configuring paravirtualized keyboard
by Marek Marczykowski-Górecki
Xen since 4.13 allows to configure whether PV vkb device is created or
not - instead of always creating it. Plug it into <input/> device
configuration and give the user a choice - setting PS2 keyboard disables
PV one, and setting XEN keyboard enables PV.
There is one issue with this approach: there are implicit keyboard and
mouse device added with bus 'ps2'. This is at least done by the xen-xl
-> libvirt xml config converter (why?). When one use a config generated
this way, this commit will make behavior change - PV keyboard will get
disabled. I'm not sure if that's a big issue - both keyboards works.
Can it be this way? Or maybe some better idea how to represent
vkb_device option in libvirt xml?
Once the above is sorted out (or chosen to ignore), I'll send updated
patch with tests and config converter support.
Because the implicit keyboard is added, I also avoided to reject keybord
device on too old Xen versions. This means <input type='keyboard'
bus='xen'/> will be _silently_ ignored on older Xen.
Signed-off-by: Marek Marczykowski-Górecki <marmarek(a)invisiblethingslab.com>
---
src/libxl/libxl_conf.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 27de67d266..0999fb5678 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -637,6 +637,24 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
for (i = 0; i < def->ninputs; i++) {
char **usbdevice;
+#ifdef LIBXL_HAVE_BUILDINFO_VKB_DEVICE
+ if (def->inputs[i]->type == VIR_DOMAIN_INPUT_TYPE_KBD) {
+ switch (def->inputs[i]->bus) {
+ case VIR_DOMAIN_INPUT_BUS_PS2:
+ libxl_defbool_set(&b_info->u.hvm.vkb_device, false);
+ break;
+ case VIR_DOMAIN_INPUT_BUS_XEN:
+ libxl_defbool_set(&b_info->u.hvm.vkb_device, true);
+ break;
+ case VIR_DOMAIN_INPUT_BUS_VIRTIO:
+ default:
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("libxenlight supports only ps2/xen keyboard device"));
+ return -1;
+ }
+ }
+#endif
+
if (def->inputs[i]->bus != VIR_DOMAIN_INPUT_BUS_USB)
continue;
--
2.21.0
4 years, 11 months
[libvirt] [rust PATCH v2 0/5] Map more functions in stream module
by Zixing Liu
This set of patches will add more functions to the Rust bindings.
Newly mapped functions from C library: virStreamNew virStreamEventUpdateCallback virStreamEventRemoveCallback virStreamEventAddCallback.
virStreamEventAddCallback can accept normal fn functions or closures (can capture variables outside)
The changes are not very thoroughly tested since event module is not implemented at all so the virStreamEventAddCallback will always return "unsupported by the connection driver".
Also the changes have run though the rustfmt to ensure the format conforms to Rust officially recommended code style.
Version 2: Addressed comments
Zixing Liu (5):
libvirt-rust: stream: add more functions in stream
libvirt-rust: stream: add more functions in stream
libvirt-rust: stream: automated lint
libvirt-rust: use reference instead of moving
libvirt-rust: stream: addressed comments
src/domain.rs | 2 +-
src/stream.rs | 129 +++++++++++++++++++++++++++++++++++++++++-------
tests/stream.rs | 40 +++++++++++++++
3 files changed, 153 insertions(+), 18 deletions(-)
create mode 100644 tests/stream.rs
--
2.24.1
4 years, 11 months
[PATCH] docs: fixing typos 'libivrt' > 'libvirt'
by Julio Faracco
This is only 2 simple typo fixes for wrong documentation wording.
Signed-off-by: Julio Faracco <jcfaracco(a)gmail.com>
---
docs/apps.html.in | 2 +-
docs/auditlog.html.in | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/apps.html.in b/docs/apps.html.in
index 41dd26f7ff..629d740c28 100644
--- a/docs/apps.html.in
+++ b/docs/apps.html.in
@@ -224,7 +224,7 @@
<dd>
Eucalyptus is an on-premise Infrastructure as a Service cloud
software platform that is open source and
- AWS-compatible. Eucalyptus uses libivrt virtualization API to
+ AWS-compatible. Eucalyptus uses libvirt virtualization API to
directly interact with Xen and KVM hypervisors.
</dd>
diff --git a/docs/auditlog.html.in b/docs/auditlog.html.in
index f8f0c99b23..eb00d9742e 100644
--- a/docs/auditlog.html.in
+++ b/docs/auditlog.html.in
@@ -42,7 +42,7 @@
In addition to have formal messages sent to the audit subsystem it is
possible to tell libvirt to inject messages into its own logging
layer. This will result in messages ending up in the systemd journal
- or <code>/var/log/libvirt/libivrtd.log</code> on non-systemd hosts.
+ or <code>/var/log/libvirt/libvirtd.log</code> on non-systemd hosts.
This is disabled by default, but can be requested by setting the
<code>audit_logging=1</code> configuration parameter in the same file
mentioned above.
--
2.20.1
4 years, 11 months
[libvirt PATCH v3 00/10] build system cleanup
by Pavel Hrdina
This patch series is motivated by the effort to adopt Meson as our
build system but all of it improves the current build system on its own.
Changes in v3:
- dropped a patches that stores bootstrap result in git and
removes some options from autogen.sh, I'll repost once we get
rid of gnulib
- added a new patch that fixes threadlib dependency
Pavel Hrdina (10):
secret: move virSecretGetSecretString into virsecret
configure.ac: add check for getegid function
bootstrap.conf: add threadlib module
bootstrap.conf: drop gnulib tests from libvirt
bootstrap.conf: always copy files
bootstrap.conf: declare bootstrap sync in configuration file
bootstrap.conf: disable VC ignore files
bootstrap.conf: stop creating AUTHORS file
syntax-check: remove deleted daemon directory from space_indent_check
autogen.sh: fix autoreconf step
.gitignore | 7 +-
Makefile.am | 2 +-
autogen.sh | 6 +-
bootstrap.conf | 29 ++----
build-aux/syntax-check.mk | 2 +-
configure.ac | 2 +-
gnulib/tests/Makefile.am | 32 -------
po/POTFILES.in | 1 -
src/libvirt_private.syms | 5 +-
src/libxl/libxl_conf.c | 2 +-
src/qemu/qemu_domain.c | 2 +-
src/qemu/qemu_process.c | 2 +-
src/qemu/qemu_tpm.c | 2 +-
src/secret/Makefile.inc.am | 11 ---
src/secret/secret_util.c | 102 ---------------------
src/secret/secret_util.h | 33 -------
src/storage/storage_backend_iscsi.c | 2 +-
src/storage/storage_backend_iscsi_direct.c | 2 +-
src/storage/storage_backend_rbd.c | 2 +-
src/storage/storage_util.c | 2 +-
src/util/virsecret.c | 69 ++++++++++++++
src/util/virsecret.h | 8 ++
22 files changed, 104 insertions(+), 221 deletions(-)
delete mode 100644 gnulib/tests/Makefile.am
delete mode 100644 src/secret/secret_util.c
delete mode 100644 src/secret/secret_util.h
--
2.23.0
4 years, 11 months
[libvirt] [PATCH] man: fix section of virt-sanlock-cleanup
by Christian Ehrhardt
Reported at buld time by litian:
manpage-section-mismatch usr/share/man/man8/virt-sanlock-cleanup.8.gz:3 8 != 1
And indeed the rst file says 1 while the makefile say 8:
if WITH_SANLOCK
manpages8_rst += manpages/virt-sanlock-cleanup.rst
else ! WITH_SANLOCK
8 "System administration commands and daemons" seems to match, so fix
the rst file to match.
Signed-off-by: Christian Ehrhardt <christian.ehrhardt(a)canonical.com>
---
docs/manpages/virt-sanlock-cleanup.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/manpages/virt-sanlock-cleanup.rst b/docs/manpages/virt-sanlock-cleanup.rst
index ac49fa4191..3ad70ce683 100644
--- a/docs/manpages/virt-sanlock-cleanup.rst
+++ b/docs/manpages/virt-sanlock-cleanup.rst
@@ -6,7 +6,7 @@ virt-sanlock-cleanup
remove stale sanlock resource lease files
-----------------------------------------
-:Manual section: 1
+:Manual section: 8
:Manual group: Virtualization Support
.. contents::
--
2.25.0
4 years, 11 months