[libvirt] [PATCH 0/5] qemu: Disk emptiness and disk migration fixes
by Peter Krempa
Recent change to use virDomainDiskEmptySource broke internal snapshots since
the check was not robust enough. While looking at it I found more brokenness.
Peter Krempa (5):
conf: Keep 'readonly' property when resetting disk source
qemu: snapshot: Skip empty drives with internal snapshots
qemu: migration: Skip cache=none check for disks which are
storage-migrated
qemu: migration: Use virStorageSourceIsEmpty in qemuMigrateDisk
qemu: migration: Reject migration of an empty disk
src/conf/domain_conf.c | 3 +++
src/qemu/qemu_driver.c | 3 ++-
src/qemu/qemu_migration.c | 64 ++++++++++++++++++++++++++++-------------------
3 files changed, 43 insertions(+), 27 deletions(-)
--
2.12.2
7 years, 8 months
[libvirt] [PATCH v2 0/3] nwfilter: Create common virNWFilterObj* APIs
by John Ferlan
v1: https://www.redhat.com/archives/libvir-list/2017-April/msg00299.html
Effectively move code from nwfilter_driver.c into virnwfiltereobj to
count the number of devices, to return a list of names, and to return
an array of filters.
FWIW: This is part of the common driver objects code I've been working
through. I figured I will post each driver separately rather than one
larger series.
v2: Differences:
- Remove memset() from *GetName
- Change "if (aclfilter && aclfilter())" to "if (!aclfilter || aclfilter())"
John Ferlan (3):
nwfilter: Introduce virNWFilterObjNumOfNWFilters
nwfilter: Introduce virNWFilterObjGetNames
nwfilter: Introduce virNWFilterObjListExport
src/conf/virnwfilterobj.c | 103 +++++++++++++++++++++++++++++++++++++++++
src/conf/virnwfilterobj.h | 22 +++++++++
src/libvirt_private.syms | 3 ++
src/nwfilter/nwfilter_driver.c | 86 +++++-----------------------------
4 files changed, 139 insertions(+), 75 deletions(-)
--
2.9.3
7 years, 8 months
[libvirt] [PATCH] conf: Add check for non scsi_host parent during vport delete
by John Ferlan
https://bugzilla.redhat.com/show_bug.cgi?id=1420740
If the parent is not a scsi_host, then we can just happily return since
we won't be removing a vport.
Fixes a bug with the following output:
$ virsh pool-destroy host4_hba_pool
error: Failed to destroy pool host4_hba_pool
error: internal error: Invalid adapter name 'pci_0000_10_00_1' for SCSI pool
$
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/conf/node_device_conf.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 7d0baa9..cc3fad8 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -2074,6 +2074,13 @@ virNodeDeviceDeleteVport(virConnectPtr conn,
if (!(vhba_parent = virNodeDeviceGetParentName(conn, scsi_host_name)))
goto cleanup;
+ /* If the parent is not a scsi_host, then this is a pool backed
+ * directly to an HBA and there's no vHBA to remove - so we're done */
+ if (!STRPREFIX(vhba_parent, "scsi_host")) {
+ ret = 0;
+ goto cleanup;
+ }
+
if (virSCSIHostGetNumber(vhba_parent, &parent_host) < 0)
goto cleanup;
}
--
2.9.3
7 years, 8 months
[libvirt] [PATCH 0/4] Allow some cross pool type source device path checks
by John Ferlan
https://bugzilla.redhat.com/show_bug.cgi?id=1233129
Refactor the virStoragePoolSourceFindDuplicateDevices code a bit to
make it a bit easier to read, then allow pool def type's that use a
pool source device to define the source device to perform cross pool
source device conflicts.
John Ferlan (4):
conf: Introduce virStoragePoolObjSourceMatchTypeDIR
conf: Introduce virStoragePoolObjSourceMatchTypeISCSI
conf: Introduce virStoragePoolObjSourceMatchTypeDEVICE
conf: Check for storage conflicts across pool types
src/conf/virstorageobj.c | 241 +++++++++++++++++++++++++++--------------------
1 file changed, 140 insertions(+), 101 deletions(-)
--
2.9.3
7 years, 8 months
[libvirt] [PATCH] qemu: Report shutdown event details
by Martin Kletzander
QEMU will likely report the details of it shutting down, particularly
the system it received in case it was killed. We should forward that
information along. Since the only way we can extend information
provided to the user is adding event details, we might as well emit
multiple events (one with the reason for the shutdown and keep the one
for the shutdown being finished for clarity and compatibility).
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1384007
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
This is waiting for a patch in QEMU [1] that I tested this with.
[1] https://lists.gnu.org/archive/html/qemu-devel/2017-04/msg01098.html
examples/object-events/event-test.c | 9 +++++++++
include/libvirt/libvirt-domain.h | 3 +++
src/qemu/qemu_monitor.c | 6 +++---
src/qemu/qemu_monitor.h | 3 ++-
src/qemu/qemu_monitor_json.c | 4 ++--
src/qemu/qemu_process.c | 20 ++++++++++++++++++++
tools/virsh-domain.c | 6 +++++-
7 files changed, 44 insertions(+), 7 deletions(-)
diff --git a/examples/object-events/event-test.c b/examples/object-events/event-test.c
index 12690cac09ce..b4e1dd7970d9 100644
--- a/examples/object-events/event-test.c
+++ b/examples/object-events/event-test.c
@@ -240,6 +240,15 @@ eventDetailToString(int event,
case VIR_DOMAIN_EVENT_SHUTDOWN_FINISHED:
return "Finished";
+ case VIR_DOMAIN_EVENT_SHUTDOWN_SIGINT:
+ return "Killed with SIGINT";
+
+ case VIR_DOMAIN_EVENT_SHUTDOWN_SIGHUP:
+ return "Killed with SIGHUP";
+
+ case VIR_DOMAIN_EVENT_SHUTDOWN_SIGTERM:
+ return "Killed with SIGTERM";
+
case VIR_DOMAIN_EVENT_SHUTDOWN_LAST:
break;
}
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index 501996bc84f1..b3619c4baae7 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -2984,6 +2984,9 @@ typedef enum {
*/
typedef enum {
VIR_DOMAIN_EVENT_SHUTDOWN_FINISHED = 0, /* Guest finished shutdown sequence */
+ VIR_DOMAIN_EVENT_SHUTDOWN_SIGINT = 1, /* Guest is shutting down due to SIGINT */
+ VIR_DOMAIN_EVENT_SHUTDOWN_SIGHUP = 2, /* Guest is shutting down due to SIGHUP */
+ VIR_DOMAIN_EVENT_SHUTDOWN_SIGTERM = 3, /* Guest is shutting down due to SIGKILL */
# ifdef VIR_ENUM_SENTINELS
VIR_DOMAIN_EVENT_SHUTDOWN_LAST
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 1d40d521a9b3..044b58ff090d 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -1323,12 +1323,12 @@ qemuMonitorEmitEvent(qemuMonitorPtr mon, const char *event,
int
-qemuMonitorEmitShutdown(qemuMonitorPtr mon)
+qemuMonitorEmitShutdown(qemuMonitorPtr mon, const char *signal)
{
int ret = -1;
- VIR_DEBUG("mon=%p", mon);
+ VIR_DEBUG("mon=%p signal=%s", mon, NULLSTR(signal));
- QEMU_MONITOR_CALLBACK(mon, ret, domainShutdown, mon->vm);
+ QEMU_MONITOR_CALLBACK(mon, ret, domainShutdown, mon->vm, signal);
return ret;
}
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 12f98beba763..c6ecee66a140 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -130,6 +130,7 @@ typedef int (*qemuMonitorDomainEventCallback)(qemuMonitorPtr mon,
void *opaque);
typedef int (*qemuMonitorDomainShutdownCallback)(qemuMonitorPtr mon,
virDomainObjPtr vm,
+ const char *signal,
void *opaque);
typedef int (*qemuMonitorDomainResetCallback)(qemuMonitorPtr mon,
virDomainObjPtr vm,
@@ -344,7 +345,7 @@ int qemuMonitorGetDiskSecret(qemuMonitorPtr mon,
int qemuMonitorEmitEvent(qemuMonitorPtr mon, const char *event,
long long seconds, unsigned int micros,
const char *details);
-int qemuMonitorEmitShutdown(qemuMonitorPtr mon);
+int qemuMonitorEmitShutdown(qemuMonitorPtr mon, const char *signal);
int qemuMonitorEmitReset(qemuMonitorPtr mon);
int qemuMonitorEmitPowerdown(qemuMonitorPtr mon);
int qemuMonitorEmitStop(qemuMonitorPtr mon);
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index aeb777d37c12..4f67b4496b43 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -523,9 +523,9 @@ qemuMonitorJSONKeywordStringToJSON(const char *str, const char *firstkeyword)
}
-static void qemuMonitorJSONHandleShutdown(qemuMonitorPtr mon, virJSONValuePtr data ATTRIBUTE_UNUSED)
+static void qemuMonitorJSONHandleShutdown(qemuMonitorPtr mon, virJSONValuePtr data)
{
- qemuMonitorEmitShutdown(mon);
+ qemuMonitorEmitShutdown(mon, virJSONValueObjectGetString(data, "signal"));
}
static void qemuMonitorJSONHandleReset(qemuMonitorPtr mon, virJSONValuePtr data ATTRIBUTE_UNUSED)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 5e119a237fba..3265db8f1590 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -634,10 +634,12 @@ qemuProcessHandleEvent(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
static int
qemuProcessHandleShutdown(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
virDomainObjPtr vm,
+ const char *signal,
void *opaque)
{
virQEMUDriverPtr driver = opaque;
qemuDomainObjPrivatePtr priv;
+ virObjectEventPtr pre_event = NULL;
virObjectEventPtr event = NULL;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
@@ -662,6 +664,23 @@ qemuProcessHandleShutdown(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
virDomainObjSetState(vm,
VIR_DOMAIN_SHUTDOWN,
VIR_DOMAIN_SHUTDOWN_UNKNOWN);
+
+ if (signal) {
+ virDomainEventShutdownDetailType detail = 0;
+
+ if (STREQ(signal, "int"))
+ detail = VIR_DOMAIN_EVENT_SHUTDOWN_SIGINT;
+ else if (STREQ(signal, "hup"))
+ detail = VIR_DOMAIN_EVENT_SHUTDOWN_SIGHUP;
+ else if (STREQ(signal, "term"))
+ detail = VIR_DOMAIN_EVENT_SHUTDOWN_SIGTERM;
+
+ if (detail)
+ pre_event = virDomainEventLifecycleNewFromObj(vm,
+ VIR_DOMAIN_EVENT_SHUTDOWN,
+ detail);
+ }
+
event = virDomainEventLifecycleNewFromObj(vm,
VIR_DOMAIN_EVENT_SHUTDOWN,
VIR_DOMAIN_EVENT_SHUTDOWN_FINISHED);
@@ -678,6 +697,7 @@ qemuProcessHandleShutdown(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
unlock:
virObjectUnlock(vm);
+ qemuDomainEventQueue(driver, pre_event);
qemuDomainEventQueue(driver, event);
virObjectUnref(cfg);
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index db8accfe436b..12c1908c44f9 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -12220,7 +12220,11 @@ VIR_ENUM_IMPL(virshDomainEventStopped,
VIR_ENUM_DECL(virshDomainEventShutdown)
VIR_ENUM_IMPL(virshDomainEventShutdown,
VIR_DOMAIN_EVENT_SHUTDOWN_LAST,
- N_("Finished"))
+ N_("Finished"),
+ N_("Killed with SIGINT"),
+ N_("Killed with SIGHUP"),
+ N_("Killed with SIGTERM"),
+ )
VIR_ENUM_DECL(virshDomainEventPMSuspended)
VIR_ENUM_IMPL(virshDomainEventPMSuspended,
--
2.12.2
7 years, 8 months
[libvirt] [PATCH] util: add missing equal sign in initialization
by Ján Tomko
Fix the build with clang:
util/virperf.c:86:27: error: use of GNU 'missing =' extension
in designator [-Werror,-Wgnu-designator]
[VIR_PERF_EVENT_MBML] {
^
=
---
src/util/virperf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Pushed.
diff --git a/src/util/virperf.c b/src/util/virperf.c
index 9ac27c1..fa5b6cc 100644
--- a/src/util/virperf.c
+++ b/src/util/virperf.c
@@ -83,7 +83,7 @@ static struct virPerfEventAttr attrs[] = {
.attrType = 0,
.attrConfig = 2
},
- [VIR_PERF_EVENT_MBML] {
+ [VIR_PERF_EVENT_MBML] = {
.attrType = 0,
.attrConfig = 3
},
--
2.10.2
7 years, 8 months
[libvirt] [PATCH] daemon: Fix domain name leak in error path
by Wang King
domain name duplicated in make_nonnull_domain, but not freed when virTypedParamsSerialize return negative.
---
daemon/remote.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index 1610fea..edee981 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -1066,8 +1066,10 @@ remoteRelayDomainEventTunable(virConnectPtr conn,
if (virTypedParamsSerialize(params, nparams,
(virTypedParameterRemotePtr *) &data.params.params_val,
&data.params.params_len,
- VIR_TYPED_PARAM_STRING_OKAY) < 0)
+ VIR_TYPED_PARAM_STRING_OKAY) < 0) {
+ VIR_FREE(data.dom.name);
return -1;
+ }
remoteDispatchObjectEventSend(callback->client, remoteProgram,
REMOTE_PROC_DOMAIN_EVENT_CALLBACK_TUNABLE,
--
2.8.3
7 years, 8 months
[libvirt] [PATCH 0/9] Support more options for intel-iommu
by Ján Tomko
https://bugzilla.redhat.com/show_bug.cgi?id=1427005
Ján Tomko (9):
conf: add <irqchip mode> to <features>
qemu: format kernel_irqchip on the command line
Split out virDomainIOMMUDefFormat
conf: add <driver intremap> to <iommu>
qemu: allow conditional device property probing
qemu: refactor qemuBuildIOMMUCommandLine
qemu: format intremap= on intel-iommu command line
conf: add caching attribute to iommu device
qemu: format caching-mode on iommu command line
docs/formatdomain.html.in | 41 +++++++-
docs/schemas/domaincommon.rng | 30 ++++++
src/conf/domain_conf.c | 103 +++++++++++++++++--
src/conf/domain_conf.h | 15 +++
src/libvirt_private.syms | 1 +
src/qemu/qemu_capabilities.c | 111 +++++++++++++++------
src/qemu/qemu_capabilities.h | 3 +
src/qemu/qemu_command.c | 53 ++++++++--
tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml | 1 +
.../qemucapabilitiesdata/caps_2.4.0.x86_64.replies | 22 ++--
tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml | 1 +
.../qemucapabilitiesdata/caps_2.5.0.x86_64.replies | 24 +++--
tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml | 1 +
.../caps_2.6.0-gicv2.aarch64.xml | 1 +
.../caps_2.6.0-gicv3.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml | 1 +
.../qemucapabilitiesdata/caps_2.6.0.x86_64.replies | 24 +++--
tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml | 1 +
.../qemucapabilitiesdata/caps_2.7.0.x86_64.replies | 28 ++++--
tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml | 2 +
tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml | 1 +
.../qemucapabilitiesdata/caps_2.8.0.x86_64.replies | 37 +++++--
tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml | 2 +
.../qemucapabilitiesdata/caps_2.9.0.x86_64.replies | 49 +++++++--
tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 3 +
.../qemuxml2argv-intel-iommu-caching.args | 19 ++++
.../qemuxml2argv-intel-iommu-caching.xml | 28 ++++++
.../qemuxml2argv-intel-iommu-irqchip.args | 19 ++++
.../qemuxml2argv-intel-iommu-irqchip.xml | 31 ++++++
tests/qemuxml2argvtest.c | 10 ++
.../qemuxml2xmlout-intel-iommu-caching.xml | 28 ++++++
.../qemuxml2xmlout-intel-iommu-irqchip.xml | 31 ++++++
tests/qemuxml2xmltest.c | 4 +
37 files changed, 641 insertions(+), 89 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-caching.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-caching.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-irqchip.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-irqchip.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-caching.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-irqchip.xml
--
2.10.2
7 years, 8 months
[libvirt] [PATCH] conf: remove unused assignment statement in virSysinfoBaseBoardParseXML
by Wang King
Assigning value 0 to @nboards in success path, that stored value is not used.
---
src/conf/domain_conf.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 80baa09..52f4c7a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -13086,7 +13086,6 @@ virSysinfoBaseBoardParseXML(xmlXPathContextPtr ctxt,
*baseBoard = boards;
*nbaseBoard = nboards;
boards = NULL;
- nboards = 0;
ret = 0;
cleanup:
VIR_FREE(boards);
--
2.8.3
7 years, 8 months
[libvirt] [PATCH] tools: remove unused assignment statement in virshStorageVolListCollect
by Wang King
Assigning value true to @success if there is no volumes, that stored value is not used.
---
tools/virsh-volume.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c
index ddd41d2..66fe70e 100644
--- a/tools/virsh-volume.c
+++ b/tools/virsh-volume.c
@@ -1282,10 +1282,8 @@ virshStorageVolListCollect(vshControl *ctl,
goto cleanup;
}
- if (nvols == 0) {
- success = true;
+ if (nvols == 0)
return list;
- }
/* Retrieve the list of volume names in the pool */
names = vshCalloc(ctl, nvols, sizeof(*names));
--
2.8.3
7 years, 8 months