[PATCH] qemu: convert DomainLogContext class to use GObject
by Gaurav Agrawal
---
src/qemu/qemu_domain.c | 35 +++++++++++++++++++----------------
src/qemu/qemu_domain.h | 5 +++--
src/qemu/qemu_process.c | 4 ++--
3 files changed, 24 insertions(+), 20 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 4b467afa81..b91364b1a8 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -151,7 +151,7 @@ qemuDomainObjFromDomain(virDomainPtr domain)
struct _qemuDomainLogContext {
- virObject parent;
+ GObject parent;
int writefd;
int readfd; /* Only used if manager == NULL */
@@ -161,37 +161,46 @@ struct _qemuDomainLogContext {
virLogManagerPtr manager;
};
-static virClassPtr qemuDomainLogContextClass;
+G_DEFINE_TYPE(qemuDomainLogContext, qemu_domain_log_context, G_TYPE_OBJECT);
static virClassPtr qemuDomainSaveCookieClass;
-static void qemuDomainLogContextDispose(void *obj);
+static void qemuDomainLogContextFinalize(GObject *obj);
static void qemuDomainSaveCookieDispose(void *obj);
static int
qemuDomainOnceInit(void)
{
- if (!VIR_CLASS_NEW(qemuDomainLogContext, virClassForObject()))
- return -1;
-
if (!VIR_CLASS_NEW(qemuDomainSaveCookie, virClassForObject()))
return -1;
return 0;
}
+static void qemu_domain_log_context_init(qemuDomainLogContext *logctxt G_GNUC_UNUSED)
+{
+}
+
+static void qemu_domain_log_context_class_init(qemuDomainLogContextClass *klass)
+{
+ GObjectClass *obj = G_OBJECT_CLASS(klass);
+
+ obj->finalize = qemuDomainLogContextFinalize;
+}
+
VIR_ONCE_GLOBAL_INIT(qemuDomain);
static void
-qemuDomainLogContextDispose(void *obj)
+qemuDomainLogContextFinalize(GObject *object)
{
- qemuDomainLogContextPtr ctxt = obj;
+ qemuDomainLogContextPtr ctxt = QEMU_DOMAIN_LOG_CONTEXT(object);
VIR_DEBUG("ctxt=%p", ctxt);
virLogManagerFree(ctxt->manager);
VIR_FREE(ctxt->path);
VIR_FORCE_CLOSE(ctxt->writefd);
VIR_FORCE_CLOSE(ctxt->readfd);
+ G_OBJECT_CLASS(qemu_domain_log_context_parent_class)->finalize(object);
}
const char *
@@ -10591,13 +10600,7 @@ qemuDomainLogContextPtr qemuDomainLogContextNew(virQEMUDriverPtr driver,
qemuDomainLogContextMode mode)
{
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
- qemuDomainLogContextPtr ctxt = NULL;
-
- if (qemuDomainInitialize() < 0)
- return NULL;
-
- if (!(ctxt = virObjectNew(qemuDomainLogContextClass)))
- return NULL;
+ qemuDomainLogContextPtr ctxt = QEMU_DOMAIN_LOG_CONTEXT(g_object_new(QEMU_TYPE_DOMAIN_LOG_CONTEXT, NULL));
VIR_DEBUG("Context new %p stdioLogD=%d", ctxt, cfg->stdioLogD);
ctxt->writefd = -1;
@@ -10666,7 +10669,7 @@ qemuDomainLogContextPtr qemuDomainLogContextNew(virQEMUDriverPtr driver,
return ctxt;
error:
- virObjectUnref(ctxt);
+ g_clear_object(&ctxt);
return NULL;
}
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 099ee59772..ab4206177c 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -21,6 +21,7 @@
#pragma once
+#include <glib-object.h>
#include "virthread.h"
#include "vircgroup.h"
#include "virperf.h"
@@ -601,9 +602,9 @@ struct qemuProcessEvent {
void qemuProcessEventFree(struct qemuProcessEvent *event);
-typedef struct _qemuDomainLogContext qemuDomainLogContext;
+#define QEMU_TYPE_DOMAIN_LOG_CONTEXT qemu_domain_log_context_get_type()
+G_DECLARE_FINAL_TYPE(qemuDomainLogContext, qemu_domain_log_context, QEMU, DOMAIN_LOG_CONTEXT, GObject);
typedef qemuDomainLogContext *qemuDomainLogContextPtr;
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuDomainLogContext, virObjectUnref);
typedef struct _qemuDomainSaveCookie qemuDomainSaveCookie;
typedef qemuDomainSaveCookie *qemuDomainSaveCookiePtr;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 454db21b31..e8401030a2 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1929,7 +1929,7 @@ static void
qemuProcessMonitorLogFree(void *opaque)
{
qemuDomainLogContextPtr logCtxt = opaque;
- virObjectUnref(logCtxt);
+ g_clear_object(&logCtxt);
}
@@ -1983,7 +1983,7 @@ qemuConnectMonitor(virQEMUDriverPtr driver, virDomainObjPtr vm, int asyncJob,
driver);
if (mon && logCtxt) {
- virObjectRef(logCtxt);
+ g_object_ref(logCtxt);
qemuMonitorSetDomainLog(mon,
qemuProcessMonitorReportLogError,
logCtxt,
--
2.24.1
4 years, 9 months
[PATCH 0/8] qemu: support renaming domains with snapshots/checkpoints
by Nikolay Shirokovskiy
Nikolay Shirokovskiy (8):
qemu: remove duplicate code for removing remnant files
qemu: qemuDomainRenameCallback: fix sending false undefined event
qemu: rename: support renaming snapshots directory
qemu: rename: support renaming checkpoints directory
qemu: update name on reverting from snapshot
qemu: rename: remove snapshot/checkpoint restriction
qemu: refactor qemuDomainDefineXMLFlags
qemu: qemu: remove remnant files on define
src/qemu/qemu_checkpoint.c | 2 +-
src/qemu/qemu_checkpoint.h | 6 ++
src/qemu/qemu_domain.c | 41 ++++++++++
src/qemu/qemu_domain.h | 5 ++
src/qemu/qemu_driver.c | 161 ++++++++++++++++++++++---------------
src/qemu/qemu_migration.c | 3 +
6 files changed, 153 insertions(+), 65 deletions(-)
--
2.23.0
4 years, 9 months
[PATCH v3 00/34] Configurable policy for handling deprecated interfaces
by Markus Armbruster
This series extends QMP introspection to cover deprecation.
Additionally, new option -compat lets you configure what to do when
deprecated interfaces get used. This is intended for testing users of
the management interfaces. It is experimental.
-compat deprecated-input=<in-policy> configures what to do when
deprecated input is received. Available policies:
* accept: Accept deprecated commands and arguments (default)
* reject: Reject them
* crash: Crash
-compat deprecated-output=<out-policy> configures what to do when
deprecated output is sent. Available output policies:
* accept: Emit deprecated command results and events (default)
* hide: Suppress them
For now, -compat covers only deprecated syntactic aspects of QMP. We
may want to extend it to cover semantic aspects, CLI, and experimental
features.
PATCH 01-04: Documentation fixes
PATCH 05-10: Test improvements
PATCH 11-24: Add feature flags to remaining user-defined types and to
struct members
PATCH 25-26: New special feature 'deprecated', visible in
introspection
PATCH 27-34: New -compat to set policy for handling stuff marked with
feature 'deprecated'
v3:
* Rebased, non-trivial conflicts in PATCH 01+26+27+34 due to RST
conversion and code motion
* PATCH 28-29: Old PATCH 28 split up to ease review
* PATCH 30-31: New
* PATCH 32-33: Old PATCH 29 split up to ease review
Comparison to RFC (24 Oct 2019):
* Cover arguments and results in addition to commands and events
* Half-baked "[RFC PATCH 18/19] qapi: Include a warning in the
response to a deprecated command" dropped
See also last item of
Subject: Minutes of KVM Forum BoF on deprecating stuff
Date: Fri, 26 Oct 2018 16:03:51 +0200
Message-ID: <87mur0ls8o.fsf(a)dusky.pond.sub.org>
https://lists.nongnu.org/archive/html/qemu-devel/2018-10/msg05828.html
Cc: Lukáš Doktor <ldoktor(a)redhat.com>
Cc: libguestfs(a)redhat.com
Cc: libvir-list(a)redhat.com
Cc: Daniel P. Berrange <berrange(a)redhat.com>
Cc: Peter Krempa <pkrempa(a)redhat.com>
Markus Armbruster (34):
qemu-doc: Belatedly document QMP command arg & result deprecation
qapi: Belatedly update doc comment for @wait deprecation
docs/devel/qapi-code-gen: Clarify allow-oob introspection
docs/devel/qapi-code-gen: Document 'features' introspection
tests/test-qmp-cmds: Factor out qmp_dispatch() test helpers
tests/test-qmp-cmds: Check responses more thoroughly
tests/test-qmp-cmds: Simplify test data setup
tests/test-qmp-event: Simplify test data setup
tests/test-qmp-event: Use qobject_is_equal()
tests/test-qmp-event: Check event is actually emitted
qapi/schema: Clean up around QAPISchemaEntity.connect_doc()
qapi: Add feature flags to remaining definitions
qapi: Consistently put @features parameter right after @ifcond
qapi/introspect: Rename *qlit* to reduce confusion
qapi/introspect: Factor out _make_tree()
qapi/schema: Change _make_features() to a take feature list
qapi/schema: Reorder classes so related ones are together
qapi/schema: Rename QAPISchemaObjectType{Variant,Variants}
qapi/schema: Call QAPIDoc.connect_member() in just one place
qapi: Add feature flags to struct members
qapi: Inline do_qmp_dispatch() into qmp_dispatch()
qapi: Simplify how qmp_dispatch() deals with QCO_NO_SUCCESS_RESP
qapi: Simplify how qmp_dispatch() gets the request ID
qapi: Replace qmp_dispatch()'s TODO comment by an explanation
qapi: New special feature flag "deprecated"
qapi: Mark deprecated QMP parts with feature 'deprecated'
qemu-options: New -compat to set policy for deprecated interfaces
qapi: Implement deprecated-output=hide for QMP command results
qapi: Implement deprecated-output=hide for QMP events
qapi: Implement deprecated-output=hide for QMP event data
qapi: Implement deprecated-output=hide for QMP introspection
qapi: Implement deprecated-input=reject for QMP commands
qapi: Implement deprecated-input=reject for QMP command arguments
qapi: New -compat deprecated-input=crash
docs/devel/qapi-code-gen.txt | 79 ++-
docs/system/deprecated.rst | 48 +-
tests/qapi-schema/doc-good.texi | 32 ++
qapi/block-core.json | 48 +-
qapi/block.json | 30 +-
qapi/char.json | 1 +
qapi/compat.json | 52 ++
qapi/control.json | 11 +-
qapi/introspect.json | 28 +-
qapi/machine.json | 34 +-
qapi/migration.json | 36 +-
qapi/misc.json | 13 +-
qapi/qapi-schema.json | 1 +
include/qapi/compat-policy.h | 20 +
include/qapi/qmp/dispatch.h | 1 +
include/qapi/qobject-input-visitor.h | 9 +
include/qapi/qobject-output-visitor.h | 9 +
include/qapi/visitor-impl.h | 3 +
include/qapi/visitor.h | 9 +
monitor/monitor-internal.h | 3 -
monitor/misc.c | 2 -
monitor/qmp-cmds-control.c | 102 +++-
qapi/qapi-visit-core.c | 9 +
qapi/qmp-dispatch.c | 137 ++---
qapi/qobject-input-visitor.c | 29 ++
qapi/qobject-output-visitor.c | 20 +
qemu-storage-daemon.c | 2 -
softmmu/vl.c | 17 +
tests/test-qmp-cmds.c | 249 +++++----
tests/test-qmp-event.c | 201 +++-----
qapi/Makefile.objs | 8 +-
qapi/trace-events | 1 +
qemu-options.hx | 22 +
scripts/qapi/commands.py | 20 +-
scripts/qapi/doc.py | 16 +-
scripts/qapi/events.py | 22 +-
scripts/qapi/expr.py | 14 +-
scripts/qapi/introspect.py | 104 ++--
scripts/qapi/schema.py | 488 ++++++++++--------
scripts/qapi/types.py | 8 +-
scripts/qapi/visit.py | 28 +-
tests/Makefile.include | 1 +
tests/qapi-schema/alternate-base.err | 2 +-
tests/qapi-schema/doc-good.json | 22 +-
tests/qapi-schema/doc-good.out | 18 +
.../qapi-schema/features-deprecated-type.err | 2 +
.../qapi-schema/features-deprecated-type.json | 3 +
.../qapi-schema/features-deprecated-type.out | 0
tests/qapi-schema/qapi-schema-test.json | 51 +-
tests/qapi-schema/qapi-schema-test.out | 48 +-
tests/qapi-schema/test-qapi.py | 26 +-
51 files changed, 1384 insertions(+), 755 deletions(-)
create mode 100644 qapi/compat.json
create mode 100644 include/qapi/compat-policy.h
create mode 100644 tests/qapi-schema/features-deprecated-type.err
create mode 100644 tests/qapi-schema/features-deprecated-type.json
create mode 100644 tests/qapi-schema/features-deprecated-type.out
--
2.21.1
4 years, 9 months
[libvirt PATCH] build: workaround behaviour regression in gnu make 4.3
by Daniel P. Berrangé
We need the "$(space)" variable to contain a single whitespace
character. We do this by assigning and then appending an empty
string to the variable. Variable appends get separated by a
single whitespace historically, but GNU make 4.3 introduced a
behaviour regression.
https://lists.gnu.org/archive/html/bug-make/2020-01/msg00057.html
[quote]
* WARNING: Backward-incompatibility!
Previously appending using '+=' to an empty variable would
result in a value starting with a space. Now the initial
space is only added if the variable already contains some
value. Similarly, appending an empty string does not
add a trailing space.
[/quote]
This patch tries a new trick to get a single whitespace by
getting make to expand two non-existant variables separated
by a space.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
build-aux/syntax-check.mk | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk
index b829c8a18b..3020921be8 100644
--- a/build-aux/syntax-check.mk
+++ b/build-aux/syntax-check.mk
@@ -687,8 +687,7 @@ msg_gen_function += virLastErrorPrefixMessage
# msg_gen_function += vshPrint
# msg_gen_function += vshError
-space =
-space +=
+space = $(null) $(null)
func_re= ($(subst $(space),|,$(msg_gen_function)))
# Look for diagnostics that aren't marked for translation.
--
2.24.1
4 years, 9 months
[PATCH v3 0/4] Tighten qemu-img rules on missing backing format
by Eric Blake
In v3:
- patch 1 is new [Jan]
- patch 2:
- add test 225 for vmdk [Jan]
- add a few more tests where raw backing files are used [Peter]
- patch 3 add R-b
- patch 4:
- more tweaks on which messages are emitted [Peter]
- more test coverage in 114 of new messages
- rebase to .rst conversion
Eric Blake (4):
block: Add trivial backing_fmt support to qcow, sheepdog, vmdk
iotests: Specify explicit backing format where sensible
block: Add support to warn on backing file change without format
qemu-img: Deprecate use of -b without -F
docs/system/deprecated.rst | 19 ++++++++++++++
include/block/block.h | 4 +--
block.c | 34 ++++++++++++++++++++++---
block/qcow.c | 6 +++++
block/qcow2.c | 2 +-
block/sheepdog.c | 6 +++++
block/stream.c | 2 +-
block/vmdk.c | 5 ++++
blockdev.c | 3 ++-
qemu-img.c | 4 +--
tests/qemu-iotests/017 | 2 +-
tests/qemu-iotests/017.out | 2 +-
tests/qemu-iotests/018 | 2 +-
tests/qemu-iotests/018.out | 2 +-
tests/qemu-iotests/019 | 5 ++--
tests/qemu-iotests/019.out | 2 +-
tests/qemu-iotests/020 | 4 +--
tests/qemu-iotests/020.out | 4 +--
tests/qemu-iotests/024 | 8 +++---
tests/qemu-iotests/024.out | 5 ++--
tests/qemu-iotests/028 | 4 +--
tests/qemu-iotests/028.out | 2 +-
tests/qemu-iotests/030 | 26 +++++++++++++------
tests/qemu-iotests/034 | 2 +-
tests/qemu-iotests/034.out | 2 +-
tests/qemu-iotests/037 | 2 +-
tests/qemu-iotests/037.out | 2 +-
tests/qemu-iotests/038 | 2 +-
tests/qemu-iotests/038.out | 2 +-
tests/qemu-iotests/039 | 3 ++-
tests/qemu-iotests/039.out | 2 +-
tests/qemu-iotests/040 | 47 +++++++++++++++++++++++++----------
tests/qemu-iotests/041 | 37 ++++++++++++++++++---------
tests/qemu-iotests/042 | 4 +--
tests/qemu-iotests/043 | 18 +++++++-------
tests/qemu-iotests/043.out | 16 +++++++-----
tests/qemu-iotests/046 | 2 +-
tests/qemu-iotests/046.out | 2 +-
tests/qemu-iotests/050 | 4 +--
tests/qemu-iotests/050.out | 2 +-
tests/qemu-iotests/051 | 2 +-
tests/qemu-iotests/051.out | 2 +-
tests/qemu-iotests/051.pc.out | 2 +-
tests/qemu-iotests/056 | 3 ++-
tests/qemu-iotests/060 | 2 +-
tests/qemu-iotests/060.out | 2 +-
tests/qemu-iotests/061 | 10 ++++----
tests/qemu-iotests/061.out | 10 ++++----
tests/qemu-iotests/069 | 2 +-
tests/qemu-iotests/069.out | 2 +-
tests/qemu-iotests/073 | 2 +-
tests/qemu-iotests/073.out | 2 +-
tests/qemu-iotests/082 | 16 +++++++-----
tests/qemu-iotests/082.out | 16 ++++++------
tests/qemu-iotests/085 | 4 +--
tests/qemu-iotests/085.out | 6 ++---
tests/qemu-iotests/089 | 2 +-
tests/qemu-iotests/089.out | 2 +-
tests/qemu-iotests/095 | 4 +--
tests/qemu-iotests/095.out | 4 +--
tests/qemu-iotests/097 | 4 +--
tests/qemu-iotests/097.out | 16 ++++++------
tests/qemu-iotests/098 | 2 +-
tests/qemu-iotests/098.out | 8 +++---
tests/qemu-iotests/110 | 4 +--
tests/qemu-iotests/110.out | 4 +--
tests/qemu-iotests/114 | 11 ++++++++
tests/qemu-iotests/114.out | 8 ++++++
tests/qemu-iotests/122 | 27 ++++++++++++--------
tests/qemu-iotests/122.out | 8 +++---
tests/qemu-iotests/126 | 4 +--
tests/qemu-iotests/126.out | 4 +--
tests/qemu-iotests/127 | 4 +--
tests/qemu-iotests/127.out | 4 +--
tests/qemu-iotests/129 | 3 ++-
tests/qemu-iotests/133 | 2 +-
tests/qemu-iotests/133.out | 2 +-
tests/qemu-iotests/139 | 2 +-
tests/qemu-iotests/141 | 4 +--
tests/qemu-iotests/141.out | 4 +--
tests/qemu-iotests/142 | 2 +-
tests/qemu-iotests/142.out | 2 +-
tests/qemu-iotests/153 | 14 +++++------
tests/qemu-iotests/153.out | 35 ++++++++++++++------------
tests/qemu-iotests/154 | 42 +++++++++++++++----------------
tests/qemu-iotests/154.out | 42 +++++++++++++++----------------
tests/qemu-iotests/155 | 12 ++++++---
tests/qemu-iotests/156 | 9 ++++---
tests/qemu-iotests/156.out | 6 ++---
tests/qemu-iotests/158 | 2 +-
tests/qemu-iotests/158.out | 2 +-
tests/qemu-iotests/161 | 8 +++---
tests/qemu-iotests/161.out | 8 +++---
tests/qemu-iotests/176 | 4 +--
tests/qemu-iotests/176.out | 32 ++++++++++++------------
tests/qemu-iotests/177 | 2 +-
tests/qemu-iotests/177.out | 2 +-
tests/qemu-iotests/179 | 2 +-
tests/qemu-iotests/179.out | 2 +-
tests/qemu-iotests/189 | 2 +-
tests/qemu-iotests/189.out | 2 +-
tests/qemu-iotests/191 | 12 ++++-----
tests/qemu-iotests/191.out | 12 ++++-----
tests/qemu-iotests/195 | 6 ++---
tests/qemu-iotests/195.out | 6 ++---
tests/qemu-iotests/198 | 2 +-
tests/qemu-iotests/198.out | 3 ++-
tests/qemu-iotests/204 | 2 +-
tests/qemu-iotests/204.out | 2 +-
tests/qemu-iotests/216 | 2 +-
tests/qemu-iotests/224 | 4 +--
tests/qemu-iotests/225 | 2 +-
tests/qemu-iotests/225.out | 2 +-
tests/qemu-iotests/228 | 5 ++--
tests/qemu-iotests/245 | 3 ++-
tests/qemu-iotests/249 | 4 +--
tests/qemu-iotests/249.out | 4 +--
tests/qemu-iotests/252 | 2 +-
tests/qemu-iotests/257 | 3 ++-
tests/qemu-iotests/267 | 4 +--
tests/qemu-iotests/267.out | 6 ++---
tests/qemu-iotests/270 | 2 +-
tests/qemu-iotests/270.out | 2 +-
tests/qemu-iotests/273 | 4 +--
tests/qemu-iotests/273.out | 4 +--
tests/qemu-iotests/279 | 4 +--
tests/qemu-iotests/279.out | 4 +--
127 files changed, 509 insertions(+), 351 deletions(-)
--
2.25.1
4 years, 9 months
[libvirt PATCH v2 0/9] Second take on slirp-helper & dbus-vmstate
by marcandre.lureau@redhat.com
From: Marc-André Lureau <marcandre.lureau(a)redhat.com>
Hi,
The series "[libvirt] [PATCH v2 00/23] Use a slirp helper process" has
been merged and partially reverted. Meanwhile, qemu dbus-vmstate
design has been changed and merged upstream.
This new series fixes the slirp-helper support. The significant change
is that dbus-vmstate now requires a bus (instead of the earlier
peer-to-peer connection). The current series doesn't attempt to
enforce strict policies on the bus. As long as you can connect to the
bus, you can send/receive from/to anyone. A follow-up series should
implement the recommendations from
https://qemu.readthedocs.io/en/latest/interop/dbus.html#security.
The libslirp-rs slirp-helper hasn't yet received an official release.
For testing, you may:
$ cargo install --features=all --git https://gitlab.freedesktop.org/slirp/libslirp-rs
The resulting binary should be ~/.cargo/bin/slirp-helper, so qemu.conf
slirp_helper location should be adjusted. With that in place, a VM
with user networking (slirp) should now start with the helper process.
thanks
v2:
- merge most suggestions/changes from Michal Privoznik review of v1.
- added "WIP: qemu_slirp: update to follow current spec"
Marc-André Lureau (9):
qemu: remove dbus-vmstate code
qemu-conf: add configurable dbus-daemon location
qemu-conf: add dbusStateDir
qemu: add a DBus daemon helper unit
domain: save/restore the state of dbus-daemon running
qemu: prepare and stop the dbus daemon
qemu: add dbus-vmstate helper migration support
qemu-slirp: register helper for migration
WIP: qemu-slirp: update to follow current spec
m4/virt-driver-qemu.m4 | 6 +
src/qemu/libvirtd_qemu.aug | 1 +
src/qemu/qemu.conf | 3 +
src/qemu/qemu_alias.c | 17 +-
src/qemu/qemu_alias.h | 3 +-
src/qemu/qemu_command.c | 81 +++------
src/qemu/qemu_command.h | 6 +-
src/qemu/qemu_conf.c | 7 +
src/qemu/qemu_conf.h | 2 +
src/qemu/qemu_dbus.c | 264 +++++++++++++++++++++++++----
src/qemu/qemu_dbus.h | 25 ++-
src/qemu/qemu_domain.c | 30 ++--
src/qemu/qemu_domain.h | 8 +-
src/qemu/qemu_extdevice.c | 4 +-
src/qemu/qemu_hotplug.c | 165 +++++++++---------
src/qemu/qemu_hotplug.h | 17 +-
src/qemu/qemu_migration.c | 57 ++++++-
src/qemu/qemu_monitor.c | 21 +++
src/qemu/qemu_monitor.h | 3 +
src/qemu/qemu_monitor_json.c | 15 ++
src/qemu/qemu_monitor_json.h | 5 +
src/qemu/qemu_process.c | 6 +
src/qemu/qemu_slirp.c | 157 +++--------------
src/qemu/qemu_slirp.h | 4 +-
src/qemu/test_libvirtd_qemu.aug.in | 1 +
25 files changed, 544 insertions(+), 364 deletions(-)
--
2.25.0.rc2.1.g09a9a1a997
4 years, 9 months
[PATCH 0/5] virCommand: fix approach to pidfiles
by Michal Privoznik
This was inspired by reviewing Marc-Andre's patchset [2]. I was
wondering why the dbus-daemon is not being killed even though the
corresponding function was called. The problem is, the dbus-daemon
doesn't have the pidfile locked and therefore
virPidFileForceCleanupPath() can't be used. This got me thinking, what
is the pidfile good for if the daemon doesn't own it. Sure, we have
virPidFileReadPathIfAlive() but that won't work if the daemon binary
gets updated meanwhile.
Michal Prívozník (5):
virCommand: Actually acquire pidfile instead of just writing it
qemuProcessStartManagedPRDaemon: Don't pass -f pidfile to the daemon
qemuSlirpStop: Simplify helper kill
qemuVirtioFSStop: Simplify daemon kill
bridge_driver: Replace and drop networkKillDaemon
docs/internals/command.html.in | 4 +-
src/network/bridge_driver.c | 107 ++++++---------------------------
src/qemu/qemu_process.c | 9 ---
src/qemu/qemu_slirp.c | 16 ++---
src/qemu/qemu_virtiofs.c | 21 +++----
src/util/vircommand.c | 56 ++++++++++++++---
tests/commanddata/test4.log | 1 +
7 files changed, 81 insertions(+), 133 deletions(-)
--
2.24.1
4 years, 9 months
[libvirt] [PATCH] virt-host-validate: warn if kvm_hv is not loaded for POWER hosts
by Daniel Henrique Barboza
POWER hosts does not implement CPU virtualization extensions like
x86 or s390x. Instead, all bare-metal POWER hosts are considered
to be virtualization ready.
For POWER, the validation is done by checking the virtualization
kernel modules, kvm_hv and kvm_pr, to see if they are either not
installed or not loaded in the host. If the KVM modules aren't
present, we should not just warn but fail to validate.
This patch implements this support. If kvm_hv is not installed,
which can be determined by 'modinfo' returning not-zero return
code, fail the verification. If kvm_hv is installed but not
loaded, show a warning. The exception are POWER8 hosts, which can
work with kvm_pr. In its case, ACK the use of kvm_pr if kvm_hv
is not loaded/present.
Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
tools/virt-host-validate-common.c | 136 ++++++++++++++++++++++++++++++
tools/virt-host-validate-common.h | 2 +
tools/virt-host-validate-qemu.c | 6 ++
3 files changed, 144 insertions(+)
diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-common.c
index bce0f14917..e6d7986758 100644
--- a/tools/virt-host-validate-common.c
+++ b/tools/virt-host-validate-common.c
@@ -411,3 +411,139 @@ int virHostValidateIOMMU(const char *hvname,
virHostMsgPass();
return 0;
}
+
+
+static bool virHostCPUIsPower8(void)
+{
+ FILE *fp;
+ bool ret = false;
+
+ if (!(fp = fopen("/proc/cpuinfo", "r")))
+ return false;
+
+ do {
+ char line[1024];
+
+ if (!fgets(line, sizeof(line), fp))
+ break;
+
+ /* Looks for the 'model name' line. This is more common for
+ * Intel /proc/cpuinfo formats, but let's account for it
+ * too. */
+ if (STRPREFIX(line, "model name")) {
+ if (strstr(line, "POWER8"))
+ ret = true;
+ break;
+ }
+
+ /* Looks for the 'cpu:' line which is more commonly present
+ * in /proc/cpuinfo Power systems. To ensure this is not
+ * 'cpu id' or any other cpu attribute, peek at the next char
+ * after the first whitespace. A tab, whitespace or ':'
+ * indicates we're on the right line */
+ if (STRPREFIX(line, "cpu") &&
+ (line[3] == '\t' || line[3] == ':' || line[3] == ' ')) {
+ if (strstr(line, "POWER8"))
+ ret = true;
+ break;
+ }
+
+ } while (1);
+
+ VIR_FORCE_FCLOSE(fp);
+
+ return ret;
+}
+
+
+static bool virHostKernelModuleExists(const char *module)
+{
+ g_autofree char *cmd = g_strdup_printf("modinfo %s", module);
+ g_autofree char *stdout = NULL;
+ g_autofree char *stderr = NULL;
+ g_autoptr(GError) err = NULL;
+ int errStatus;
+
+ if (g_spawn_command_line_sync(cmd, &stdout, &stderr, &errStatus, &err))
+ return true;
+
+ return false;
+}
+
+
+static bool virHostKernelModuleIsLoaded(const char *module)
+{
+ FILE *fp;
+ bool ret = false;
+
+ if (!(fp = fopen("/proc/modules", "r")))
+ return false;
+
+ do {
+ char line[1024];
+
+ if (!fgets(line, sizeof(line), fp))
+ break;
+
+ if (STRPREFIX(line, module)) {
+ ret = true;
+ break;
+ }
+
+ } while (1);
+
+ VIR_FORCE_FCLOSE(fp);
+
+ return ret;
+}
+
+
+int virHostValidatePowerPCModules(void)
+{
+ bool kvm_pr_exists = virHostKernelModuleExists("kvm_pr");
+ bool kvm_pr_loaded = kvm_pr_exists && virHostKernelModuleIsLoaded("kvm_pr");
+ bool kvm_hv_exists = virHostKernelModuleExists("kvm_hv");
+ bool kvm_hv_loaded = kvm_hv_exists && virHostKernelModuleIsLoaded("kvm_hv");
+ bool hostIsP8 = virHostCPUIsPower8();
+
+ virHostMsgCheck("QEMU", "%s", _("for PowerPC KVM modules loaded"));
+
+ /* No Power KVM virtualization modules present on the host. */
+ if (!kvm_hv_exists && !kvm_pr_exists) {
+ virHostMsgFail(VIR_HOST_VALIDATE_FAIL,
+ _("No kvm_hv or kvm_pr module present in "
+ "the host"));
+ return -1;
+ }
+
+ /* Bail out for all non-Power8 CPUs if kvm_hv is not present. */
+ if (!kvm_hv_exists && !hostIsP8) {
+ virHostMsgFail(VIR_HOST_VALIDATE_FAIL,
+ _("No kvm_hv module present in the host"));
+ return -1;
+ }
+
+ /* Power8 CPUs virtualization works with any of kvm_hv and kvm_pr.
+ * Issue a warning if none are loaded. */
+ if (hostIsP8) {
+ if (!kvm_hv_loaded && !kvm_pr_loaded) {
+ virHostMsgFail(VIR_HOST_VALIDATE_WARN,
+ _("Load kvm_hv or kvm_pr module "
+ "for better performance"));
+ return 0;
+ }
+
+ virHostMsgPass();
+ return 0;
+ }
+
+ /* For non-Power8 hosts, show a warning if kvm_hv is not loaded. */
+ if (!kvm_hv_loaded) {
+ virHostMsgFail(VIR_HOST_VALIDATE_WARN,
+ _("Load kvm_hv for better performance"));
+ return 0;
+ }
+
+ virHostMsgPass();
+ return 0;
+}
diff --git a/tools/virt-host-validate-common.h b/tools/virt-host-validate-common.h
index 1b7e93e520..7a2933c8fd 100644
--- a/tools/virt-host-validate-common.h
+++ b/tools/virt-host-validate-common.h
@@ -83,3 +83,5 @@ int virHostValidateCGroupControllers(const char *hvname,
int virHostValidateIOMMU(const char *hvname,
virHostValidateLevel level);
+
+int virHostValidatePowerPCModules(void);
\ No newline at end of file
diff --git a/tools/virt-host-validate-qemu.c b/tools/virt-host-validate-qemu.c
index ff3c1f0231..8753c6a31d 100644
--- a/tools/virt-host-validate-qemu.c
+++ b/tools/virt-host-validate-qemu.c
@@ -57,6 +57,12 @@ int virHostValidateQEMU(void)
if (virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_SIE))
hasHwVirt = true;
break;
+ case VIR_ARCH_PPC64:
+ case VIR_ARCH_PPC64LE:
+ hasVirtFlag = true;
+ if (virHostValidatePowerPCModules() == 0)
+ hasHwVirt = true;
+ break;
default:
hasHwVirt = false;
}
--
2.23.0
4 years, 9 months
[PATCH] news: Mention regression in virDomainBlockCopy with shallow/reuse flags
by Peter Krempa
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
docs/news.xml | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/docs/news.xml b/docs/news.xml
index 7fd88f9998..92103ec308 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -48,6 +48,23 @@
<section title="Improvements">
</section>
<section title="Bug fixes">
+ <change>
+ <summary>
+ qemu: Open backing chain late for shallow block copy reusing external images
+ </summary>
+ <description>
+ With introduction of -blockdev specification of storage for qemu VMs
+ in libvirt-5.10 we've started opening the backing chain of the
+ destination/mirror of a virDomainBlockcopy started with
+ VIR_DOMAIN_BLOCK_COPY_REUSE_EXT | VIR_DOMAIN_BLOCK_COPY_SHALLOW flags
+ when starting the job rather than when virDomainBlockJobAbort with
+ VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT is issued. For users depending on
+ this undocumented quirk this caused a regression in behaviour as
+ the backing chain could not be modified while the copy of the top
+ image was progressing. Note that this fix also requires qemu-5.0 while
+ -blockdev is used starting from qemu-4.2.
+ </description>
+ </change>
</section>
</release>
<release version="v6.1.0" date="2020-03-03">
--
2.24.1
4 years, 9 months