[libvirt] [PATCH v2 0/3] qemu: Restore lost shutdown reason
by John Ferlan
v1:
https://www.redhat.com/archives/libvir-list/2018-October/msg00945.html
Changes since v1:
Patch 1 (NEW)
- Set the priv->allowReboot prior to any error processing since we
could/should be using that.
Patch 2 (ADJUSTED LOGIC)
- Rather than open code the "reason" to use the -no-shutdown flag,
let's create a qemu_domain helper for that so that both the command
line building and the Reconnection failure logic can use it.
Patch 3 (NEW)
- Let's narrow the window for using VIR_DOMAIN_SHUTOFF_CRASHED to
just the period where we try to open a monitor channel. If we
cannot do so, then "assume" the reason was crashed. There are
a few open failure steps that may not exactly fit the model, but
those are probably splitting hairs.
John Ferlan (3):
qemu: Move allow reboot check setting
qemu: Restore lost shutdown reason
qemu: Narrow the shutdown reconnection failure reason window
src/qemu/qemu_command.c | 6 +-----
src/qemu/qemu_domain.c | 17 +++++++++++++++++
src/qemu/qemu_domain.h | 3 +++
src/qemu/qemu_process.c | 27 ++++++++++++++++++---------
4 files changed, 39 insertions(+), 14 deletions(-)
--
2.17.2
6 years
[libvirt] [jenkins-ci PATCH 0/4] Add Fedora 29, drop Fedora 27
by Andrea Bolognani
It's that time of the year again :)
Andrea Bolognani (4):
guests: Add Fedora 29
Build on Fedora 29
Stop building on Fedora 27
guests: Drop Fedora 27
guests/host_vars/libvirt-fedora-27/docker.yml | 2 -
guests/host_vars/libvirt-fedora-29/docker.yml | 2 +
.../install.yml | 2 +-
.../main.yml | 2 +-
guests/inventory | 2 +-
guests/playbooks/build/jobs/defaults.yml | 4 +-
.../playbooks/build/projects/libvirt-dbus.yml | 6 +-
.../build/projects/libvirt-ocaml.yml | 2 +-
.../build/projects/libvirt-sandbox.yml | 4 +-
.../playbooks/build/projects/libvirt-tck.yml | 4 +-
guests/playbooks/build/projects/libvirt.yml | 2 +-
.../playbooks/build/projects/virt-manager.yml | 6 +-
.../playbooks/build/projects/virt-viewer.yml | 1 +
guests/vars/mappings.yml | 1 -
guests/vars/vault.yml | 82 +++++++++----------
jobs/defaults.yaml | 4 +-
projects/libvirt-dbus.yaml | 6 +-
projects/libvirt-ocaml.yaml | 2 +-
projects/libvirt-sandbox.yaml | 4 +-
projects/libvirt-tck.yaml | 4 +-
projects/libvirt.yaml | 2 +-
projects/virt-manager.yaml | 6 +-
projects/virt-viewer.yaml | 1 +
23 files changed, 76 insertions(+), 75 deletions(-)
delete mode 100644 guests/host_vars/libvirt-fedora-27/docker.yml
create mode 100644 guests/host_vars/libvirt-fedora-29/docker.yml
rename guests/host_vars/{libvirt-fedora-27 => libvirt-fedora-29}/install.yml (66%)
rename guests/host_vars/{libvirt-fedora-27 => libvirt-fedora-29}/main.yml (95%)
--
2.19.1
6 years
[libvirt] [PATCH] libxl: Properly dispose libxl_domain_config object
by Jim Fehlig
V2 of the libxl soft reset patch, which was pushed as commit da4b0fd9,
dropped the hunk that disposed of the libxl_domain_config object. Add
the missing hunk to properly dispose the object.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
Pushing as trivial...
src/libxl/libxl_domain.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 6aca7eebf8..5fe3f44fbe 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -605,6 +605,7 @@ libxlDomainShutdownThread(void *opaque)
virObjectEventStateQueue(driver->domainEventState, dom_event);
libxl_event_free(cfg->ctx, ev);
VIR_FREE(shutdown_info);
+ libxl_domain_config_dispose(&d_config);
virObjectUnref(cfg);
}
--
2.18.0
6 years
[libvirt] [PATCH v2] lxc: Include support to lxc version 3.0 or higher.
by Julio Faracco
This patch introduce the new settings for LXC 3.0 or higher. The older
versions keep the compatibility to deprecated settings for LXC, but
after release 3.0, the compatibility was removed. This commit adds the
support to the refactored settings.
Signed-off-by: Julio Faracco <jcfaracco(a)gmail.com>
---
src/lxc/lxc_native.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
index cbdec723dd..8604cbaf46 100644
--- a/src/lxc/lxc_native.c
+++ b/src/lxc/lxc_native.c
@@ -200,7 +200,9 @@ lxcSetRootfs(virDomainDefPtr def,
int type = VIR_DOMAIN_FS_TYPE_MOUNT;
VIR_AUTOFREE(char *) value = NULL;
- if (virConfGetValueString(properties, "lxc.rootfs", &value) <= 0)
+ if (virConfGetValueString(properties, "lxc.rootfs", &value) <= 0 &&
+ /* Legacy config keys were removed after release 3.0. */
+ virConfGetValueString(properties, "lxc.rootfs.path", &value) <= 0)
return -1;
if (STRPREFIX(value, "/dev/"))
@@ -684,7 +686,9 @@ lxcCreateConsoles(virDomainDefPtr def, virConfPtr properties)
virDomainChrDefPtr console;
size_t i;
- if (virConfGetValueString(properties, "lxc.tty", &value) <= 0)
+ if (virConfGetValueString(properties, "lxc.tty", &value) <= 0 &&
+ /* Legacy config keys were removed after release 3.0. */
+ virConfGetValueString(properties, "lxc.tty.max", &value) <= 0)
return 0;
if (virStrToLong_i(value, NULL, 10, &nbttys) < 0) {
@@ -724,7 +728,7 @@ lxcIdmapWalkCallback(const char *name, virConfValuePtr value, void *data)
char type;
unsigned long start, target, count;
- if (STRNEQ(name, "lxc.id_map") || !value->str)
+ if (STRNEQ(name, "lxc.id_map") || STRNEQ(name, "lxc.idmap") || !value->str)
return 0;
if (sscanf(value->str, "%c %lu %lu %lu", &type,
@@ -1041,7 +1045,9 @@ lxcParseConfigString(const char *config,
if (VIR_STRDUP(vmdef->os.init, "/sbin/init") < 0)
goto error;
- if (virConfGetValueString(properties, "lxc.utsname", &value) <= 0 ||
+ if ((virConfGetValueString(properties, "lxc.utsname", &value) <= 0 &&
+ /* Legacy config keys were removed after release 3.0. */
+ virConfGetValueString(properties, "lxc.uts.name", &value) <= 0) ||
VIR_STRDUP(vmdef->name, value) < 0)
goto error;
if (!vmdef->name && (VIR_STRDUP(vmdef->name, "unnamed") < 0))
@@ -1051,7 +1057,9 @@ lxcParseConfigString(const char *config,
goto error;
/* Look for fstab: we shouldn't have it */
- if (virConfGetValue(properties, "lxc.mount")) {
+ if (virConfGetValue(properties, "lxc.mount") ||
+ /* Legacy config keys were removed after release 3.0. */
+ virConfGetValue(properties, "lxc.mount.fstab")) {
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
_("lxc.mount found, use lxc.mount.entry lines instead"));
goto error;
--
2.17.1
6 years
[libvirt] [PATCH V2 0/3] libxl: add support for soft reset
by Jim Fehlig
Patches 1 and 2 are new to V2 and make slight improvements to
libxlDomainShutdownThread. Patch 3 is adjusted to work with Xen 4.6.
Jim Fehlig (3):
libxl: remove redundant calls to virObjectEventStateQueue
libxl: Remove some goto labels in libxlDomainShutdownThread
libxl: add support for soft reset
src/libxl/libxl_domain.c | 99 ++++++++++++++++++++++++++++------------
1 file changed, 69 insertions(+), 30 deletions(-)
--
2.18.0
6 years
[libvirt] RFC: VIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA is not functional?
by Han Han
Hello,
I found snapshot APIs(like virDomainSnapshotNum) invoked with
VIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA will return 0 even there are internal
no-metadata snapshots in the domain.
Then I find the reason is in virDomainSnapshotObjListGetNames():
937 /* If this common code is being used, we assume that all
snapshots
938 ┆* have metadata, and thus can handle METADATA up front as
an
939 ┆* all-or-none filter. XXX This might not always be true, if
we
940 ┆* add the ability to track qcow2 internal snapshots without
the
941 ┆* use of metadata.
*/
942 if ((data.flags & VIR_DOMAIN_SNAPSHOT_FILTERS_METADATA)
==
943 ┆
VIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA)
944 ┆ return 0;
So currently, with VIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA, no snapshot will
be returned.
I checked the commit. It is really old(6478ec1673a Eric Blake
2012-08-13 18:09:12 -0600) . I guess it was initially designed for the
function to list internal snapshots without metadata.
However, now internal snapshot seems lower prioritized than external
snapshot.
Do we have plan to design this function? Since the APIs invoked with this
flag don't return the **right** result, if the function for
VIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA will not be designed, how will we deal
with the flag? Remove it from code OR update the docs to mark it
unsupported?
--
Best regards,
-----------------------------------
Han Han
Quality Engineer
Redhat.
Email: hhan(a)redhat.com
Phone: +861065339333
6 years
[libvirt] [PATCH v2] snapshot: Don't hose list on deletion failure
by Eric Blake
If qemuDomainSnapshotDiscard() fails for any reason (rare,
but possible with an ill-timed ENOMEM or if
qemuDomainSnapshotForEachQcow2() has problems talking to the
qemu guest monitor), then an attempt to retry the snapshot
deletion API will crash because we didn't undo the effects
of virDomainSnapshotDropParent() temporarily rearranging the
internal list structures, and the second attempt to drop
parents will dereference NULL. Fix it by instead noting that
there are only two callers to qemuDomainSnapshotDiscard(),
and only one of the two callers wants the parent to be updated;
thus we can move the call to virDomainSnapshotDropParent()
into a code path that only gets executed on success.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
v2: avoid use-after-free
---
src/qemu/qemu_domain.c | 6 ++++--
src/qemu/qemu_driver.c | 1 -
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index f00f1b3fdb..dd67be5e2a 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -8246,7 +8246,7 @@ int
qemuDomainSnapshotDiscard(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainSnapshotObjPtr snap,
- bool update_current,
+ bool update_parent,
bool metadata_only)
{
char *snapFile = NULL;
@@ -8275,7 +8275,7 @@ qemuDomainSnapshotDiscard(virQEMUDriverPtr driver,
goto cleanup;
if (snap == vm->current_snapshot) {
- if (update_current && snap->def->parent) {
+ if (update_parent && snap->def->parent) {
parentsnap = virDomainSnapshotFindByName(vm->snapshots,
snap->def->parent);
if (!parentsnap) {
@@ -8298,6 +8298,8 @@ qemuDomainSnapshotDiscard(virQEMUDriverPtr driver,
if (unlink(snapFile) < 0)
VIR_WARN("Failed to unlink %s", snapFile);
+ if (update_parent)
+ virDomainSnapshotDropParent(snap);
virDomainSnapshotObjListRemove(vm->snapshots, snap);
ret = 0;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index a52e2495d5..9f71641dfa 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -16526,7 +16526,6 @@ qemuDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
snap->first_child = NULL;
ret = 0;
} else {
- virDomainSnapshotDropParent(snap);
ret = qemuDomainSnapshotDiscard(driver, vm, snap, true, metadata_only);
}
--
2.17.2
6 years
[libvirt] [PATCH v7 00/14] PCI passthrough support on s390
by Yi Min Zhao
Abstract
========
The PCI representation in QEMU has been extended for S390
allowing configuration of zPCI attributes like uid (user-defined
identifier) and fid (PCI function identifier).
The details can be found here:
https://lists.gnu.org/archive/html/qemu-devel/2016-06/msg07262.html
To support the new zPCI feature of the S390 platform, a new element of
PCI address is introduced. It has two optional attributes, @uid and
@fid. For example:
<hostdev mode='subsystem' type='pci'>
<driver name='vfio'/>
<source>
<address domain='0x0001' bus='0x00' slot='0x00' function='0x0'/>
</source>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'>
<zpci uid='0x0003' fid='0x00000027'/>
</address>
</hostdev>
If they are defined by the user, unique values within the guest domain
must be used. If they are not specified and the architecture requires
them, they are automatically generated with non-conflicting values.
zPCI address as an extension of the PCI address are stored in a new
structure 'virZPCIDeviceAddress' which is a member of common PCI
Address structure. Additionally, two hashtables are used for assignment
and reservation of zPCI uid/fid.
In support of extending the PCI address, a new PCI address extension flag is
introduced. This extension flag allows is not only dedicated for the S390
platform but also other architectures needing certain extensions to PCI
address space.
Code Base
=========
commit in master:
3a1cdb06fd conf: Fix bug in finding alloc through matching vcpus
Change Log
==========
v6->v7:
1. Optimize some functions' names and code logic.
2. Fixup build error.
3. Add negative test case for patch 9.
4. Use virXMLFormatElement() in virDomainDeviceInfoFormat().
v5->v6:
1. Modify zPCI XML definition.
2. Optimize the logic of zPCI address assignment and reservation.
3. Add extension flag into PCI address structure.
4. Update commit messages.
v4->v5:
1. Update the version number.
2. Fixup code style error.
3. Separate qemu code into single patch.
4. Rebase the patches to the new code of master branch.
v3->v4:
1. Update docs.
2. Format code style.
3. Optimize zPCI support check.
4. Move the check of zPCI defined in xml but unsupported by Qemu to
qemuDomainDeviceDefValidate().
5. Change zpci address member of PCI address struct from pointer to
instance.
6. Modify zpci address definition principle. Currently the user must
either define both of uid and fid or not.
v2->v3:
1. Revise code style.
2. Update test cases.
3. Introduce qemuDomainCollectPCIAddressExtension() to collect PCI
extension addresses.
4. Introduce virDeviceInfoPCIAddressExtensionPresent() to check if zPCI
address exists.
5. Optimize zPCI address check logic.
6. Optimize passed parameters of zPCI addr alloc/release/reserve functions.
7. Report enum range error in qemuDomainDeviceSupportZPCI().
8. Update commit messages.
v1->v2:
1. Separate test commit and merge testcases into corresponding commits that
introduce the functionalities firstly.
2. Spare some checks for zpci device.
3. Add vsock and controller support.
4. Add uin32 type schema.
5. Rename zpciuid and zpcifid to zpci_uid and zpci_fid.
6. Always return multibus support on S390.
Yi Min Zhao (14):
conf: Add definitions for 'uid' and 'fid' PCI address attributes
qemu: Introduce zPCI capability
conf: Introduce a new PCI address extension flag
qemu: Enable PCI multi bus for S390 guests
qemu: Auto add pci-root for s390/s390x guests
conf: Introduce address caching for PCI extensions
conf: use virXMLFormatElement() in virDomainDeviceInfoFormat()
conf: Introduce parser, formatter for uid and fid
qemu: Add zPCI address definition check
conf: Allocate/release 'uid' and 'fid' in PCI address
qemu: Generate and use zPCI device in QEMU command line
qemu: Add hotpluging support for PCI devices on S390 guests
docs: Add 'uid' and 'fid' information
news: Update news for PCI address extension attributes
cfg.mk | 1 +
docs/formatdomain.html.in | 10 +-
docs/news.xml | 11 +
docs/schemas/basictypes.rng | 27 ++
docs/schemas/domaincommon.rng | 1 +
src/bhyve/bhyve_device.c | 3 +-
src/conf/device_conf.c | 69 ++++
src/conf/device_conf.h | 7 +
src/conf/domain_addr.c | 340 +++++++++++++++++-
src/conf/domain_addr.h | 27 +-
src/conf/domain_conf.c | 50 ++-
src/libvirt_private.syms | 7 +
src/qemu/qemu_capabilities.c | 6 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 104 ++++++
src/qemu/qemu_command.h | 2 +
src/qemu/qemu_domain.c | 37 ++
src/qemu/qemu_domain_address.c | 205 ++++++++++-
src/qemu/qemu_hotplug.c | 160 ++++++++-
src/util/virpci.c | 26 ++
src/util/virpci.h | 15 +
.../caps_2.10.0.s390x.xml | 1 +
.../caps_2.11.0.s390x.xml | 1 +
.../caps_2.12.0.s390x.xml | 1 +
.../qemucapabilitiesdata/caps_2.7.0.s390x.xml | 1 +
.../qemucapabilitiesdata/caps_2.8.0.s390x.xml | 1 +
.../qemucapabilitiesdata/caps_2.9.0.s390x.xml | 1 +
.../qemucapabilitiesdata/caps_3.0.0.s390x.xml | 1 +
.../disk-virtio-s390-zpci.args | 26 ++
.../disk-virtio-s390-zpci.xml | 19 +
.../hostdev-vfio-zpci-autogenerate.args | 25 ++
.../hostdev-vfio-zpci-autogenerate.xml | 18 +
.../hostdev-vfio-zpci-boundaries.args | 29 ++
.../hostdev-vfio-zpci-boundaries.xml | 30 ++
.../hostdev-vfio-zpci-multidomain-many.args | 39 ++
.../hostdev-vfio-zpci-multidomain-many.xml | 79 ++++
.../hostdev-vfio-zpci-wrong-arch.xml | 34 ++
tests/qemuxml2argvdata/hostdev-vfio-zpci.args | 25 ++
tests/qemuxml2argvdata/hostdev-vfio-zpci.xml | 21 ++
tests/qemuxml2argvtest.c | 22 ++
.../disk-virtio-s390-zpci.xml | 31 ++
.../hostdev-vfio-zpci-autogenerate.xml | 34 ++
.../hostdev-vfio-zpci-boundaries.xml | 48 +++
.../hostdev-vfio-zpci-multidomain-many.xml | 97 +++++
.../qemuxml2xmloutdata/hostdev-vfio-zpci.xml | 32 ++
tests/qemuxml2xmltest.c | 17 +
46 files changed, 1707 insertions(+), 35 deletions(-)
create mode 100644 tests/qemuxml2argvdata/disk-virtio-s390-zpci.args
create mode 100644 tests/qemuxml2argvdata/disk-virtio-s390-zpci.xml
create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate.args
create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate.xml
create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-boundaries.args
create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-boundaries.xml
create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-multidomain-many.args
create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-multidomain-many.xml
create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-wrong-arch.xml
create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci.args
create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci.xml
create mode 100644 tests/qemuxml2xmloutdata/disk-virtio-s390-zpci.xml
create mode 100644 tests/qemuxml2xmloutdata/hostdev-vfio-zpci-autogenerate.xml
create mode 100644 tests/qemuxml2xmloutdata/hostdev-vfio-zpci-boundaries.xml
create mode 100644 tests/qemuxml2xmloutdata/hostdev-vfio-zpci-multidomain-many.xml
create mode 100644 tests/qemuxml2xmloutdata/hostdev-vfio-zpci.xml
--
Yi Min
6 years
[libvirt] [PATCH RESEND] qemu: Process RDMA GID state change event
by Yuval Shaia
This event is emitted on the monitor when a GID table in pvrdma device
is modified and the change needs to be propagate to the backend RDMA
device's GID table.
The control over the RDMA device's GID table is done by updating the
device's Ethernet function addresses.
Usually the first GID entry is determine by the MAC address, the second
by the first IPv6 address and the third by the IPv4 address. Other
entries can be added by adding more IP addresses. The opposite is the
same, i.e. whenever an address is removed, the corresponding GID entry
is removed.
The process is done by the network and RDMA stacks. Whenever an address
is added the ib_core driver is notified and calls the device driver's
add_gid function which in turn update the device.
To support this in pvrdma device we need to hook into the create_bind
and destroy_bind HW commands triggered by pvrdma driver in guest.
Whenever a changed is made to the pvrdma device's GID table a special
QMP messages is sent to be processed by libvirt to update the address of
the backend Ethernet device.
Signed-off-by: Yuval Shaia <yuval.shaia(a)oracle.com>
---
src/qemu/qemu_domain.c | 3 ++
src/qemu/qemu_domain.h | 15 +++++++++
src/qemu/qemu_driver.c | 40 ++++++++++++++++++++++++
src/qemu/qemu_monitor.c | 28 +++++++++++++++++
src/qemu/qemu_monitor.h | 13 ++++++++
src/qemu/qemu_monitor_json.c | 36 ++++++++++++++++++++++
src/qemu/qemu_process.c | 59 ++++++++++++++++++++++++++++++++++++
7 files changed, 194 insertions(+)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index ba3fff607a..8da54c7ee9 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -13479,6 +13479,9 @@ qemuProcessEventFree(struct qemuProcessEvent *event)
case QEMU_PROCESS_EVENT_GUESTPANIC:
qemuMonitorEventPanicInfoFree(event->data);
break;
+ case QEMU_PROCESS_EVENT_RDMA_GID_STATUS_CHANGED:
+ qemuMonitorEventRdmaGidStatusFree(event->data);
+ break;
case QEMU_PROCESS_EVENT_WATCHDOG:
case QEMU_PROCESS_EVENT_DEVICE_DELETED:
case QEMU_PROCESS_EVENT_NIC_RX_FILTER_CHANGED:
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 80bd4bde91..1b188843e3 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -478,6 +478,18 @@ struct _qemuDomainVsockPrivate {
};
+typedef struct _qemuDomainRdmaGidStatusChangedPrivate qemuDomainRdmaGidStatusChangedPrivate;
+typedef qemuDomainRdmaGidStatusChangedPrivate *qemuDomainRdmaGidStatusChangedPrivatePtr;
+struct _qemuDomainRdmaGidStatusChangedPrivate {
+ virObject parent;
+
+ char *netdev;
+ bool gid_status;
+ uint64_t subnet_prefix;
+ uint64_t interface_id;
+};
+
+
typedef enum {
QEMU_PROCESS_EVENT_WATCHDOG = 0,
QEMU_PROCESS_EVENT_GUESTPANIC,
@@ -487,6 +499,7 @@ typedef enum {
QEMU_PROCESS_EVENT_BLOCK_JOB,
QEMU_PROCESS_EVENT_MONITOR_EOF,
QEMU_PROCESS_EVENT_PR_DISCONNECT,
+ QEMU_PROCESS_EVENT_RDMA_GID_STATUS_CHANGED,
QEMU_PROCESS_EVENT_LAST
} qemuProcessEventType;
@@ -499,6 +512,8 @@ struct qemuProcessEvent {
void *data;
};
+void qemuMonitorEventRdmaGidStatusFree(qemuDomainRdmaGidStatusChangedPrivatePtr info);
+
void qemuProcessEventFree(struct qemuProcessEvent *event);
typedef struct _qemuDomainLogContext qemuDomainLogContext;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index a52e2495d5..dc088d844f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4788,6 +4788,43 @@ processPRDisconnectEvent(virDomainObjPtr vm)
}
+static void
+processRdmaGidStatusChangedEvent(virDomainObjPtr vm,
+ qemuDomainRdmaGidStatusChangedPrivatePtr info)
+{
+ unsigned int prefix_len;
+ virSocketAddr addr = {0};
+ int rc;
+
+ if (!virDomainObjIsActive(vm))
+ return;
+
+ VIR_DEBUG("netdev=%s,gid_status=%d,subnet_prefix=0x%lx,interface_id=0x%lx",
+ info->netdev, info->gid_status, info->subnet_prefix,
+ info->interface_id);
+
+ if (info->subnet_prefix) {
+ prefix_len = 64;
+ uint32_t ipv6[4];
+ memcpy(&ipv6[0], &info->subnet_prefix, sizeof(info->subnet_prefix));
+ memcpy(&ipv6[2], &info->interface_id, sizeof(info->subnet_prefix));
+ virSocketAddrSetIPv6AddrNetOrder(&addr, ipv6);
+ } else {
+ prefix_len = 24;
+ virSocketAddrSetIPv4AddrNetOrder(&addr, info->interface_id >> 32);
+ }
+
+ if (info->gid_status)
+ rc = virNetDevIPAddrAdd(info->netdev, &addr, NULL, prefix_len);
+ else
+ rc = virNetDevIPAddrDel(info->netdev, &addr, prefix_len);
+
+ if (rc)
+ VIR_ERROR(_("Fail to update address 0x%lx to %s"), info->interface_id,
+ info->netdev);
+}
+
+
static void qemuProcessEventHandler(void *data, void *opaque)
{
struct qemuProcessEvent *processEvent = data;
@@ -4828,6 +4865,9 @@ static void qemuProcessEventHandler(void *data, void *opaque)
case QEMU_PROCESS_EVENT_PR_DISCONNECT:
processPRDisconnectEvent(vm);
break;
+ case QEMU_PROCESS_EVENT_RDMA_GID_STATUS_CHANGED:
+ processRdmaGidStatusChangedEvent(vm, processEvent->data);
+ break;
case QEMU_PROCESS_EVENT_LAST:
break;
}
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 7f7013e115..375ed7ceaf 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -1686,6 +1686,23 @@ qemuMonitorEmitPRManagerStatusChanged(qemuMonitorPtr mon,
}
+int
+qemuMonitorEmitRdmaGidStatusChanged(qemuMonitorPtr mon, const char *netdev,
+ bool gid_status, uint64_t subnet_prefix,
+ uint64_t interface_id)
+{
+ int ret = -1;
+ VIR_DEBUG("mon=%p", mon);
+ VIR_DEBUG("netdev='%s',gid_status=%d,subnet_prefix=0x%lx,interface_id=0x%lx",
+ netdev, gid_status, subnet_prefix, interface_id);
+
+ QEMU_MONITOR_CALLBACK(mon, ret, domainRdmaGidStatusChanged, mon->vm, netdev,
+ gid_status, subnet_prefix, interface_id);
+
+ return ret;
+}
+
+
int
qemuMonitorSetCapabilities(qemuMonitorPtr mon)
{
@@ -4298,6 +4315,17 @@ qemuMonitorEventPanicInfoFree(qemuMonitorEventPanicInfoPtr info)
}
+void
+qemuMonitorEventRdmaGidStatusFree(qemuDomainRdmaGidStatusChangedPrivatePtr info)
+{
+ if (!info)
+ return;
+
+ VIR_FREE(info->netdev);
+ VIR_FREE(info);
+}
+
+
int
qemuMonitorSetWatchdogAction(qemuMonitorPtr mon,
const char *action)
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 48b142a4f4..f5affe615a 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -281,6 +281,14 @@ typedef int (*qemuMonitorDomainPRManagerStatusChangedCallback)(qemuMonitorPtr mo
bool connected,
void *opaque);
+typedef int (*qemuMonitorDomainRdmaGidStatusChangedCallback)(qemuMonitorPtr mon,
+ virDomainObjPtr vm,
+ const char *netdev,
+ bool gid_status,
+ uint64_t subnet_prefix,
+ uint64_t interface_id,
+ void *opaque);
+
typedef struct _qemuMonitorCallbacks qemuMonitorCallbacks;
typedef qemuMonitorCallbacks *qemuMonitorCallbacksPtr;
struct _qemuMonitorCallbacks {
@@ -314,6 +322,7 @@ struct _qemuMonitorCallbacks {
qemuMonitorDomainBlockThresholdCallback domainBlockThreshold;
qemuMonitorDomainDumpCompletedCallback domainDumpCompleted;
qemuMonitorDomainPRManagerStatusChangedCallback domainPRManagerStatusChanged;
+ qemuMonitorDomainRdmaGidStatusChangedCallback domainRdmaGidStatusChanged;
};
char *qemuMonitorEscapeArg(const char *in);
@@ -448,6 +457,10 @@ int qemuMonitorEmitPRManagerStatusChanged(qemuMonitorPtr mon,
const char *prManager,
bool connected);
+int qemuMonitorEmitRdmaGidStatusChanged(qemuMonitorPtr mon, const char *netdev,
+ bool gid_status, uint64_t subnet_prefix,
+ uint64_t interface_id);
+
int qemuMonitorStartCPUs(qemuMonitorPtr mon);
int qemuMonitorStopCPUs(qemuMonitorPtr mon);
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 3de298c9e2..8df9b426ba 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -91,6 +91,7 @@ static void qemuMonitorJSONHandleAcpiOstInfo(qemuMonitorPtr mon, virJSONValuePtr
static void qemuMonitorJSONHandleBlockThreshold(qemuMonitorPtr mon, virJSONValuePtr data);
static void qemuMonitorJSONHandleDumpCompleted(qemuMonitorPtr mon, virJSONValuePtr data);
static void qemuMonitorJSONHandlePRManagerStatusChanged(qemuMonitorPtr mon, virJSONValuePtr data);
+static void qemuMonitorJSONHandleRdmaGidStatusChanged(qemuMonitorPtr mon, virJSONValuePtr data);
typedef struct {
const char *type;
@@ -114,6 +115,7 @@ static qemuEventHandler eventHandlers[] = {
{ "NIC_RX_FILTER_CHANGED", qemuMonitorJSONHandleNicRxFilterChanged, },
{ "POWERDOWN", qemuMonitorJSONHandlePowerdown, },
{ "PR_MANAGER_STATUS_CHANGED", qemuMonitorJSONHandlePRManagerStatusChanged, },
+ { "RDMA_GID_STATUS_CHANGED", qemuMonitorJSONHandleRdmaGidStatusChanged, },
{ "RESET", qemuMonitorJSONHandleReset, },
{ "RESUME", qemuMonitorJSONHandleResume, },
{ "RTC_CHANGE", qemuMonitorJSONHandleRTCChange, },
@@ -1351,6 +1353,40 @@ static void qemuMonitorJSONHandlePRManagerStatusChanged(qemuMonitorPtr mon,
}
+static void qemuMonitorJSONHandleRdmaGidStatusChanged(qemuMonitorPtr mon,
+ virJSONValuePtr data)
+{
+ const char *netdev;
+ bool gid_status;
+ unsigned long long subnet_prefix, interface_id;
+
+ if (!(netdev = virJSONValueObjectGetString(data, "netdev"))) {
+ VIR_WARN("missing netdev in GID_STATUS_CHANGED event");
+ return;
+ }
+
+ if (virJSONValueObjectGetBoolean(data, "gid-status", &gid_status)) {
+ VIR_WARN("missing gid-status in GID_STATUS_CHANGED event");
+ return;
+ }
+
+ if (virJSONValueObjectGetNumberUlong(data, "subnet-prefix",
+ &subnet_prefix)) {
+ VIR_WARN("missing subnet-prefix in GID_STATUS_CHANGED event");
+ return;
+ }
+
+ if (virJSONValueObjectGetNumberUlong(data, "interface-id",
+ &interface_id)) {
+ VIR_WARN("missing interface-id in GID_STATUS_CHANGED event");
+ return;
+ }
+
+ qemuMonitorEmitRdmaGidStatusChanged(mon, netdev, gid_status, subnet_prefix,
+ interface_id);
+}
+
+
int
qemuMonitorJSONHumanCommandWithFd(qemuMonitorPtr mon,
const char *cmd_str,
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 9cf971808c..45fc155d31 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1703,6 +1703,64 @@ qemuProcessHandlePRManagerStatusChanged(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
}
+static int
+qemuProcessHandleRdmaGidStatusChanged(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
+ virDomainObjPtr vm, const char *netdev,
+ bool gid_status, uint64_t subnet_prefix,
+ uint64_t interface_id, void *opaque)
+{
+ virQEMUDriverPtr driver = opaque;
+ qemuDomainObjPrivatePtr priv;
+ struct qemuProcessEvent *processEvent = NULL;
+ qemuDomainRdmaGidStatusChangedPrivatePtr rdmaGitStatusChangedPriv;
+ int ret = -1;
+
+ virObjectLock(vm);
+
+ VIR_DEBUG("netdev=%s,gid_status=%d,subnet_prefix=0x%lx,interface_id=0x%lx",
+ netdev, gid_status, subnet_prefix, interface_id);
+
+ priv = vm->privateData;
+ priv->prDaemonRunning = false;
+
+ if (VIR_ALLOC(rdmaGitStatusChangedPriv) < 0)
+ goto out_unlock;
+
+ if (VIR_STRDUP(rdmaGitStatusChangedPriv->netdev, netdev) < 0)
+ goto out_free_rdma_priv;
+
+ rdmaGitStatusChangedPriv->gid_status = gid_status;
+ rdmaGitStatusChangedPriv->subnet_prefix = subnet_prefix;
+ rdmaGitStatusChangedPriv->interface_id = interface_id;
+
+ if (VIR_ALLOC(processEvent) < 0)
+ goto out_free_rdma_priv_netdev;
+
+ processEvent->eventType = QEMU_PROCESS_EVENT_RDMA_GID_STATUS_CHANGED;
+ processEvent->vm = virObjectRef(vm);
+ processEvent->data = rdmaGitStatusChangedPriv;
+
+ if (virThreadPoolSendJob(driver->workerPool, 0, processEvent) < 0) {
+ qemuProcessEventFree(processEvent);
+ virObjectUnref(vm);
+ goto out_free_rdma_priv_netdev;
+ }
+
+ ret = 0;
+ goto out_unlock;
+
+ out_free_rdma_priv_netdev:
+ VIR_FREE(rdmaGitStatusChangedPriv->netdev);
+
+ out_free_rdma_priv:
+ VIR_FREE(rdmaGitStatusChangedPriv);
+
+ out_unlock:
+ virObjectUnlock(vm);
+ return ret;
+}
+
+
static qemuMonitorCallbacks monitorCallbacks = {
.eofNotify = qemuProcessHandleMonitorEOF,
.errorNotify = qemuProcessHandleMonitorError,
@@ -1732,6 +1790,7 @@ static qemuMonitorCallbacks monitorCallbacks = {
.domainBlockThreshold = qemuProcessHandleBlockThreshold,
.domainDumpCompleted = qemuProcessHandleDumpCompleted,
.domainPRManagerStatusChanged = qemuProcessHandlePRManagerStatusChanged,
+ .domainRdmaGidStatusChanged = qemuProcessHandleRdmaGidStatusChanged,
};
static void
--
2.17.2
6 years