Devel
Threads by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- 37 participants
- 40661 discussions
Roman Bogorodskiy (2):
qemu: move qemu_agent.c to hypervisor/
bhyve: add agent support
po/POTFILES | 2 +-
src/bhyve/bhyve_domain.c | 32 +++++
src/bhyve/bhyve_domain.h | 14 ++
src/bhyve/bhyve_driver.c | 180 +++++++++++++++++++++++++-
src/bhyve/bhyve_process.c | 118 +++++++++++++++++
src/bhyve/bhyve_process.h | 4 +
src/hypervisor/meson.build | 1 +
src/{qemu => hypervisor}/qemu_agent.c | 20 ++-
src/{qemu => hypervisor}/qemu_agent.h | 3 +-
src/libvirt_private.syms | 32 +++++
src/qemu/meson.build | 1 -
src/qemu/qemu_process.c | 3 +-
tests/qemuagenttest.c | 2 +-
tests/qemumonitortestutils.c | 6 +-
tests/qemumonitortestutils.h | 2 +-
15 files changed, 405 insertions(+), 15 deletions(-)
rename src/{qemu => hypervisor}/qemu_agent.c (99%)
rename src/{qemu => hypervisor}/qemu_agent.h (98%)
--
2.52.0
2
4
15 May '26
This series fixes a leak of the 'opaque' pointer registered as private
data for virStream Event callback. This manifests itself as leak of
connections to virtstoraged in modular deployments if e.g. virsh
vol-upload is used.
The rest of the series adds various VIR_DEBUG statements and logging of
class name and reference count for virObject(Un)Ref.
Peter Krempa (9):
remote_driver: Don't leak opaque pointer passed to
'virStreamEventAddCallback'
libvirt_probes: Fix alignment of 'virobject' probe points
util: probe: Add 'PROBE_DEBUG'
util: object: Downgrade PROBE points to PROBE_DEBUG
util: object: Add class name to the Ref/Unref/Dispose debug messages
daemonRemoveClientStream: Add debug log
remoteClientFree: Add debug log of parameters
virNetClientStreamEventRemoveCallback: Add debug log
util: virobject: Add debug refcounting output
src/libvirt_probes.d | 12 +++++------
src/remote/remote_daemon_dispatch.c | 5 +++++
src/remote/remote_daemon_stream.c | 5 +++--
src/remote/remote_driver.c | 9 +++++++-
src/rpc/virnetclientstream.c | 4 ++++
src/util/virobject.c | 33 +++++++++++++++++++++++++----
src/util/virprobe.h | 14 ++++++++++++
7 files changed, 69 insertions(+), 13 deletions(-)
--
2.54.0
2
11
v3:
- Remove leftover comment
- Parse both UUIDs and leave the legacy one in <hwuuid>
- Fix the callback for VMX parsing
v2:
- https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/ODGB…
- ESX driver has an opt-in for the legacy behaviour just in case anynone needs
that, although hopefully that should not be the case. The opt-in does not
exist in the vmware driver or the vmx tests, there the v1 behaviour is kept in
which vc.uuid is preferred, but uuid.bios is a fallback.
v1:
- https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/WEKR…
Martin Kletzander (2):
esx: Track VMs by instanceUuid instead of UUID
NEWS: Add information about VMWare domains having different UUIDs
NEWS.rst | 9 +++++
docs/drvesx.rst | 9 +++++
src/esx/esx_driver.c | 43 ++++++++++++++++--------
src/esx/esx_util.c | 11 ++++++
src/esx/esx_util.h | 1 +
src/esx/esx_vi.c | 32 +++++++++++++++---
src/esx/esx_vi.h | 3 ++
src/vmx/vmx.c | 12 +++++--
tests/vmx2xmldata/esx-in-the-wild-10.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-11.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-12.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-13.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-14.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-15.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-16.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-17.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-5.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-6.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-7.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-8.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-9.xml | 2 +-
21 files changed, 113 insertions(+), 33 deletions(-)
--
2.54.0
2
7
15 May '26
Add a generic domain event that fires when libvirt detects a state
change on any virtio-serial channel of a domain (connected /
disconnected). The existing VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE
event is restricted to the QEMU guest agent channel
("org.qemu.guest_agent.0"), making it impossible for management
applications to observe lifecycle transitions of other channels
(custom guest agents, SPICE, etc.) without polling the domain XML
status file.
The new event is emitted for every virtio-serial channel, including
the guest agent channel, and carries the affected channels name.
The hypervisor must support virtio-serial port state notifications
(e.g. QEMU's VSERPORT_CHANGE event) for the event to be delivered.
Forward-port of the v2 series originally posted to libvirt-devel in
2016 by Matt Broadstone <mbroadst(a)gmail.com>.
Signed-off-by: Lucas Kornicki <lucas.kornicki(a)nutanix.com>
---
examples/c/misc/event-test.c | 57 +++++++++++++++++
include/libvirt/libvirt-domain.h | 65 ++++++++++++++++++++
src/conf/domain_event.c | 95 +++++++++++++++++++++++++++++
src/conf/domain_event.h | 12 ++++
src/libvirt_private.syms | 2 +
src/qemu/qemu_driver.c | 8 +++
src/qemu/qemu_process.c | 17 ++++--
src/remote/remote_daemon_dispatch.c | 34 +++++++++++
src/remote/remote_driver.c | 34 +++++++++++
src/remote/remote_protocol.x | 16 ++++-
src/remote_protocol-structs | 8 +++
tools/virsh-domain-event.c | 35 +++++++++++
12 files changed, 377 insertions(+), 6 deletions(-)
diff --git a/examples/c/misc/event-test.c b/examples/c/misc/event-test.c
index 2ce82ca9e0..cb22c6b619 100644
--- a/examples/c/misc/event-test.c
+++ b/examples/c/misc/event-test.c
@@ -353,6 +353,45 @@ guestAgentLifecycleEventReasonToString(int event)
return "unknown";
}
+
+static const char *
+guestChannelLifecycleEventStateToString(int event)
+{
+ switch ((virConnectDomainEventChannelLifecycleState) event) {
+ case VIR_CONNECT_DOMAIN_EVENT_CHANNEL_LIFECYCLE_STATE_DISCONNECTED:
+ return "Disconnected";
+
+ case VIR_CONNECT_DOMAIN_EVENT_CHANNEL_LIFECYCLE_STATE_CONNECTED:
+ return "Connected";
+
+ case VIR_CONNECT_DOMAIN_EVENT_CHANNEL_LIFECYCLE_STATE_LAST:
+ break;
+ }
+
+ return "unknown";
+}
+
+
+static const char *
+guestChannelLifecycleEventReasonToString(int event)
+{
+ switch ((virConnectDomainEventChannelLifecycleReason) event) {
+ case VIR_CONNECT_DOMAIN_EVENT_CHANNEL_LIFECYCLE_REASON_UNKNOWN:
+ return "Unknown";
+
+ case VIR_CONNECT_DOMAIN_EVENT_CHANNEL_LIFECYCLE_REASON_DOMAIN_STARTED:
+ return "Domain started";
+
+ case VIR_CONNECT_DOMAIN_EVENT_CHANNEL_LIFECYCLE_REASON_CHANNEL:
+ return "Channel event";
+
+ case VIR_CONNECT_DOMAIN_EVENT_CHANNEL_LIFECYCLE_REASON_LAST:
+ break;
+ }
+
+ return "unknown";
+}
+
static const char *
storagePoolEventToString(int event)
{
@@ -869,6 +908,23 @@ myDomainEventAgentLifecycleCallback(virConnectPtr conn G_GNUC_UNUSED,
}
+static int
+myDomainEventChannelLifecycleCallback(virConnectPtr conn G_GNUC_UNUSED,
+ virDomainPtr dom,
+ const char *channelName,
+ int state,
+ int reason,
+ void *opaque G_GNUC_UNUSED)
+{
+ printf("%s EVENT: Domain %s(%d) guest channel(%s) state changed: %s reason: %s\n",
+ __func__, virDomainGetName(dom), virDomainGetID(dom), channelName,
+ guestChannelLifecycleEventStateToString(state),
+ guestChannelLifecycleEventReasonToString(reason));
+
+ return 0;
+}
+
+
static int
myDomainEventDeviceAddedCallback(virConnectPtr conn G_GNUC_UNUSED,
virDomainPtr dom,
@@ -1183,6 +1239,7 @@ struct domainEventData domainEvents[] = {
DOMAIN_EVENT(VIR_DOMAIN_EVENT_ID_MEMORY_FAILURE, myDomainEventMemoryFailureCallback),
DOMAIN_EVENT(VIR_DOMAIN_EVENT_ID_MEMORY_DEVICE_SIZE_CHANGE, myDomainEventMemoryDeviceSizeChangeCallback),
DOMAIN_EVENT(VIR_DOMAIN_EVENT_ID_NIC_MAC_CHANGE, myDomainEventNICMACChangeCallback),
+ DOMAIN_EVENT(VIR_DOMAIN_EVENT_ID_CHANNEL_LIFECYCLE, myDomainEventChannelLifecycleCallback),
};
struct storagePoolEventData {
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index 4a8e3114b3..fc0fc30e83 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -7568,6 +7568,70 @@ typedef void (*virConnectDomainEventNICMACChangeCallback)(virConnectPtr conn,
const char *newMAC,
void *opaque);
+
+/**
+ * virConnectDomainEventChannelLifecycleState:
+ *
+ * Since: 12.3.0
+ */
+typedef enum {
+ VIR_CONNECT_DOMAIN_EVENT_CHANNEL_LIFECYCLE_STATE_CONNECTED = 1, /* channel connected (Since: 12.3.0) */
+ VIR_CONNECT_DOMAIN_EVENT_CHANNEL_LIFECYCLE_STATE_DISCONNECTED = 2, /* channel disconnected (Since: 12.3.0) */
+
+# ifdef VIR_ENUM_SENTINELS
+ VIR_CONNECT_DOMAIN_EVENT_CHANNEL_LIFECYCLE_STATE_LAST /* (Since: 12.3.0) */
+# endif
+} virConnectDomainEventChannelLifecycleState;
+
+/**
+ * virConnectDomainEventChannelLifecycleReason:
+ *
+ * The reason values are intentionally numerically aligned with
+ * virConnectDomainEventAgentLifecycleReason so that the qemu driver
+ * can pass the same int through both events.
+ *
+ * Since: 12.3.0
+ */
+typedef enum {
+ VIR_CONNECT_DOMAIN_EVENT_CHANNEL_LIFECYCLE_REASON_UNKNOWN = 0, /* unknown state change reason (Since: 12.3.0) */
+ VIR_CONNECT_DOMAIN_EVENT_CHANNEL_LIFECYCLE_REASON_DOMAIN_STARTED = 1, /* state changed due to domain start (Since: 12.3.0) */
+ VIR_CONNECT_DOMAIN_EVENT_CHANNEL_LIFECYCLE_REASON_CHANNEL = 2, /* channel state changed (Since: 12.3.0) */
+
+# ifdef VIR_ENUM_SENTINELS
+ VIR_CONNECT_DOMAIN_EVENT_CHANNEL_LIFECYCLE_REASON_LAST /* (Since: 12.3.0) */
+# endif
+} virConnectDomainEventChannelLifecycleReason;
+
+/**
+ * virConnectDomainEventChannelLifecycleCallback:
+ * @conn: connection object
+ * @dom: domain on which the event occurred
+ * @channelName: the name of the channel on which the event occurred
+ * @state: new state of the guest channel, one of virConnectDomainEventChannelLifecycleState
+ * @reason: reason for state change, one of virConnectDomainEventChannelLifecycleReason
+ * @opaque: application specified data
+ *
+ * This callback occurs when libvirt detects a change in the state of a guest
+ * virtio-serial channel. Unlike VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE which is
+ * tied to the QEMU guest agent channel ("org.qemu.guest_agent.0"), this event
+ * is emitted for every virtio-serial channel attached to the domain,
+ * including the guest agent channel.
+ *
+ * The hypervisor must support virtio-serial port state notifications for the
+ * event to be delivered.
+ *
+ * The callback signature to use when registering for an event of type
+ * VIR_DOMAIN_EVENT_ID_CHANNEL_LIFECYCLE with virConnectDomainEventRegisterAny()
+ *
+ * Since: 12.3.0
+ */
+typedef void (*virConnectDomainEventChannelLifecycleCallback)(virConnectPtr conn,
+ virDomainPtr dom,
+ const char *channelName,
+ int state,
+ int reason,
+ void *opaque);
+
/**
* VIR_DOMAIN_EVENT_CALLBACK:
*
@@ -7617,6 +7681,7 @@ typedef enum {
VIR_DOMAIN_EVENT_ID_MEMORY_FAILURE = 25, /* virConnectDomainEventMemoryFailureCallback (Since: 6.9.0) */
VIR_DOMAIN_EVENT_ID_MEMORY_DEVICE_SIZE_CHANGE = 26, /* virConnectDomainEventMemoryDeviceSizeChangeCallback (Since: 7.9.0) */
VIR_DOMAIN_EVENT_ID_NIC_MAC_CHANGE = 27, /* virConnectDomainEventNICMACChangeCallback (Since: 11.2.0) */
+ VIR_DOMAIN_EVENT_ID_CHANNEL_LIFECYCLE = 28, /* virConnectDomainEventChannelLifecycleCallback (Since: 12.3.0) */
# ifdef VIR_ENUM_SENTINELS
VIR_DOMAIN_EVENT_ID_LAST
diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index 88087bad4f..38ab902aa2 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
@@ -58,6 +58,7 @@ static virClass *virDomainEventBlockThresholdClass;
static virClass *virDomainEventMemoryFailureClass;
static virClass *virDomainEventMemoryDeviceSizeChangeClass;
static virClass *virDomainEventNICMACChangeClass;
+static virClass *virDomainEventChannelLifecycleClass;
static void virDomainEventDispose(void *obj);
static void virDomainEventLifecycleDispose(void *obj);
@@ -83,6 +84,7 @@ static void virDomainEventBlockThresholdDispose(void *obj);
static void virDomainEventMemoryFailureDispose(void *obj);
static void virDomainEventMemoryDeviceSizeChangeDispose(void *obj);
static void virDomainEventNICMACChangeDispose(void *obj);
+static void virDomainEventChannelLifecycleDispose(void *obj);
static void
virDomainEventDispatchDefaultFunc(virConnectPtr conn,
@@ -296,6 +298,21 @@ struct _virDomainEventNICMACChange {
};
typedef struct _virDomainEventNICMACChange virDomainEventNICMACChange;
+struct _virDomainEventChannelLifecycle {
+ virDomainEvent parent;
+
+ char *channelName;
+ int state;
+ int reason;
+};
+typedef struct _virDomainEventChannelLifecycle virDomainEventChannelLifecycle;
+
+/* Make sure the AGENT and CHANNEL lifecycle enums stay in sync with each other. */
+G_STATIC_ASSERT((int)VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_DOMAIN_STARTED ==
+ (int)VIR_CONNECT_DOMAIN_EVENT_CHANNEL_LIFECYCLE_REASON_DOMAIN_STARTED);
+G_STATIC_ASSERT((int)VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_CHANNEL ==
+ (int)VIR_CONNECT_DOMAIN_EVENT_CHANNEL_LIFECYCLE_REASON_CHANNEL);
+
static int
virDomainEventsOnceInit(void)
{
@@ -347,6 +364,8 @@ virDomainEventsOnceInit(void)
return -1;
if (!VIR_CLASS_NEW(virDomainEventNICMACChange, virDomainEventClass))
return -1;
+ if (!VIR_CLASS_NEW(virDomainEventChannelLifecycle, virDomainEventClass))
+ return -1;
return 0;
}
@@ -582,6 +601,14 @@ virDomainEventNICMACChangeDispose(void *obj)
g_free(event->newMAC);
}
+static void
+virDomainEventChannelLifecycleDispose(void *obj)
+{
+ virDomainEventChannelLifecycle *event = obj;
+
+ g_free(event->channelName);
+}
+
static void *
virDomainEventNew(virClass *klass,
int eventID,
@@ -1812,6 +1839,61 @@ virDomainEventNICMACChangeNewFromDom(virDomainPtr dom,
}
+
+static virObjectEvent *
+virDomainEventChannelLifecycleNew(int id,
+ const char *name,
+ const unsigned char *uuid,
+ const char *channelName,
+ int state,
+ int reason)
+{
+ virDomainEventChannelLifecycle *ev;
+
+ if (virDomainEventsInitialize() < 0)
+ return NULL;
+
+ if (!(ev = virDomainEventNew(virDomainEventChannelLifecycleClass,
+ VIR_DOMAIN_EVENT_ID_CHANNEL_LIFECYCLE,
+ id, name, uuid)))
+ return NULL;
+
+ ev->channelName = g_strdup(channelName);
+ ev->state = state;
+ ev->reason = reason;
+
+ return (virObjectEvent *)ev;
+}
+
+
+virObjectEvent *
+virDomainEventChannelLifecycleNewFromObj(virDomainObj *obj,
+ const char *channelName,
+ int state,
+ int reason)
+{
+ return virDomainEventChannelLifecycleNew(obj->def->id,
+ obj->def->name,
+ obj->def->uuid,
+ channelName,
+ state,
+ reason);
+}
+
+virObjectEvent *
+virDomainEventChannelLifecycleNewFromDom(virDomainPtr dom,
+ const char *channelName,
+ int state,
+ int reason)
+{
+ return virDomainEventChannelLifecycleNew(dom->id,
+ dom->name,
+ dom->uuid,
+ channelName,
+ state,
+ reason);
+}
+
static void
virDomainEventDispatchDefaultFunc(virConnectPtr conn,
virObjectEvent *event,
@@ -2134,6 +2216,19 @@ virDomainEventDispatchDefaultFunc(virConnectPtr conn,
goto cleanup;
}
+ case VIR_DOMAIN_EVENT_ID_CHANNEL_LIFECYCLE:
+ {
+ virDomainEventChannelLifecycle *channelLifecycleEvent;
+
+ channelLifecycleEvent = (virDomainEventChannelLifecycle *)event;
+ ((virConnectDomainEventChannelLifecycleCallback)cb)(conn, dom,
+ channelLifecycleEvent->channelName,
+ channelLifecycleEvent->state,
+ channelLifecycleEvent->reason,
+ cbopaque);
+ goto cleanup;
+ }
+
case VIR_DOMAIN_EVENT_ID_LAST:
break;
}
diff --git a/src/conf/domain_event.h b/src/conf/domain_event.h
index f31cfb9e42..8764c93902 100644
--- a/src/conf/domain_event.h
+++ b/src/conf/domain_event.h
@@ -289,6 +289,18 @@ virDomainEventNICMACChangeNewFromDom(virDomainPtr dom,
const char *oldMAC,
const char *newMAC);
+virObjectEvent *
+virDomainEventChannelLifecycleNewFromObj(virDomainObj *obj,
+ const char *channelName,
+ int state,
+ int reason);
+
+virObjectEvent *
+virDomainEventChannelLifecycleNewFromDom(virDomainPtr dom,
+ const char *channelName,
+ int state,
+ int reason);
+
int
virDomainEventStateRegister(virConnectPtr conn,
virObjectEventState *state,
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index cf0e71cc6a..7d221f08c4 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -761,6 +761,8 @@ virDomainEventBlockJobNewFromDom;
virDomainEventBlockJobNewFromObj;
virDomainEventBlockThresholdNewFromDom;
virDomainEventBlockThresholdNewFromObj;
+virDomainEventChannelLifecycleNewFromDom;
+virDomainEventChannelLifecycleNewFromObj;
virDomainEventControlErrorNewFromDom;
virDomainEventControlErrorNewFromObj;
virDomainEventDeviceAddedNewFromDom;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 529e9fe3be..dcb664834a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3834,6 +3834,14 @@ processSerialChangedEvent(virQEMUDriver *driver,
qemuDomainSaveStatus(vm);
+ /* queue the generic channel-lifecycle event before the agent-specific one
+ * because the latter might goto endjob if qemuConnectAgent() fails */
+ virObjectEventStateQueue(driver->domainEventState,
+ virDomainEventChannelLifecycleNewFromObj(vm,
+ dev.data.chr->target.name,
+ newstate,
+ VIR_CONNECT_DOMAIN_EVENT_CHANNEL_LIFECYCLE_REASON_CHANNEL));
+
if (STREQ_NULLABLE(dev.data.chr->target.name, "org.qemu.guest_agent.0")) {
if (newstate == VIR_DOMAIN_CHR_DEVICE_STATE_CONNECTED) {
if (qemuConnectAgent(driver, vm) < 0)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index a6d33f6746..ba1d17d91a 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2270,11 +2270,18 @@ qemuProcessRefreshChannelVirtioState(virQEMUDriver *driver,
!entry->state)
continue;
- if (entry->state != VIR_DOMAIN_CHR_DEVICE_STATE_DEFAULT &&
- STREQ_NULLABLE(chr->target.name, "org.qemu.guest_agent.0") &&
- (event = virDomainEventAgentLifecycleNewFromObj(vm, entry->state,
- agentReason)))
- virObjectEventStateQueue(driver->domainEventState, event);
+ if (entry->state != VIR_DOMAIN_CHR_DEVICE_STATE_DEFAULT) {
+ if (STREQ_NULLABLE(chr->target.name, "org.qemu.guest_agent.0") &&
+ (event = virDomainEventAgentLifecycleNewFromObj(vm, entry->state,
+ agentReason)))
+ virObjectEventStateQueue(driver->domainEventState, event);
+
+ virObjectEventStateQueue(driver->domainEventState,
+ virDomainEventChannelLifecycleNewFromObj(vm,
+ chr->target.name,
+ entry->state,
+ agentReason));
+ }
chr->state = entry->state;
}
diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c
index 7e74ff063f..ac0440eb0b 100644
--- a/src/remote/remote_daemon_dispatch.c
+++ b/src/remote/remote_daemon_dispatch.c
@@ -1354,6 +1354,39 @@ remoteRelayDomainEventNICMACChange(virConnectPtr conn,
}
+static int
+remoteRelayDomainEventChannelLifecycle(virConnectPtr conn,
+ virDomainPtr dom,
+ const char *channelName,
+ int state,
+ int reason,
+ void *opaque)
+{
+ daemonClientEventCallback *callback = opaque;
+ remote_domain_event_callback_channel_lifecycle_msg data = { 0 };
+
+ if (callback->callbackID < 0 ||
+ !remoteRelayDomainEventCheckACL(callback->client, conn, dom))
+ return -1;
+
+ VIR_DEBUG("Relaying domain channel lifecycle event %s %d, callback %d, "
+ "name: %s, state %d, reason %d",
+ dom->name, dom->id, callback->callbackID, channelName, state, reason);
+
+ data.callbackID = callback->callbackID;
+ make_nonnull_domain(&data.dom, dom);
+ data.channelName = g_strdup(channelName);
+ data.state = state;
+ data.reason = reason;
+
+ remoteDispatchObjectEventSend(callback->client, remoteProgram,
+ REMOTE_PROC_DOMAIN_EVENT_CALLBACK_CHANNEL_LIFECYCLE,
+ (xdrproc_t)xdr_remote_domain_event_callback_channel_lifecycle_msg,
+ &data);
+ return 0;
+}
+
+
static virConnectDomainEventGenericCallback domainEventCallbacks[] = {
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventLifecycle),
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventReboot),
@@ -1383,6 +1416,7 @@ static virConnectDomainEventGenericCallback domainEventCallbacks[] = {
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventMemoryFailure),
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventMemoryDeviceSizeChange),
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventNICMACChange),
+ VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventChannelLifecycle),
};
G_STATIC_ASSERT(G_N_ELEMENTS(domainEventCallbacks) == VIR_DOMAIN_EVENT_ID_LAST);
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index ec71eaed87..1fbead5941 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -437,6 +437,11 @@ remoteDomainBuildEventNICMACChange(virNetClientProgram *prog,
virNetClient *client,
void *evdata, void *opaque);
+static void
+remoteDomainBuildEventCallbackChannelLifecycle(virNetClientProgram *prog,
+ virNetClient *client,
+ void *evdata, void *opaque);
+
static virNetClientProgramEvent remoteEvents[] = {
{ REMOTE_PROC_DOMAIN_EVENT_LIFECYCLE,
remoteDomainBuildEventLifecycle,
@@ -659,6 +664,10 @@ static virNetClientProgramEvent remoteEvents[] = {
remoteDomainBuildEventNICMACChange,
sizeof(remote_domain_event_nic_mac_change_msg),
(xdrproc_t)xdr_remote_domain_event_nic_mac_change_msg },
+ { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_CHANNEL_LIFECYCLE,
+ remoteDomainBuildEventCallbackChannelLifecycle,
+ sizeof(remote_domain_event_callback_channel_lifecycle_msg),
+ (xdrproc_t)xdr_remote_domain_event_callback_channel_lifecycle_msg },
};
static void
@@ -5164,6 +5173,31 @@ remoteDomainBuildEventNICMACChange(virNetClientProgram *prog G_GNUC_UNUSED,
}
+static void
+remoteDomainBuildEventCallbackChannelLifecycle(virNetClientProgram *prog G_GNUC_UNUSED,
+ virNetClient *client G_GNUC_UNUSED,
+ void *evdata, void *opaque)
+{
+ virConnectPtr conn = opaque;
+ remote_domain_event_callback_channel_lifecycle_msg *msg = evdata;
+ struct private_data *priv = conn->privateData;
+ virDomainPtr dom;
+ virObjectEvent *event = NULL;
+
+ if (!(dom = get_nonnull_domain(conn, msg->dom)))
+ return;
+
+ event = virDomainEventChannelLifecycleNewFromDom(dom,
+ msg->channelName,
+ msg->state,
+ msg->reason);
+
+ virObjectUnref(dom);
+
+ virObjectEventStateQueueRemote(priv->eventState, event, msg->callbackID);
+}
+
+
static int
remoteStreamSend(virStreamPtr st,
const char *data,
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index 38a83c64ea..1041cd0fa2 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -4009,6 +4009,14 @@ struct remote_domain_event_nic_mac_change_msg {
remote_nonnull_string newMAC;
};
+struct remote_domain_event_callback_channel_lifecycle_msg {
+ int callbackID;
+ remote_nonnull_domain dom;
+ remote_nonnull_string channelName;
+ int state;
+ int reason;
+};
+
/*----- Protocol. -----*/
/* Define the program number, protocol version and procedure numbers here. */
@@ -7120,5 +7128,11 @@ enum remote_procedure {
* @generate: both
* @acl: none
*/
- REMOTE_PROC_DOMAIN_EVENT_NIC_MAC_CHANGE = 453
+ REMOTE_PROC_DOMAIN_EVENT_NIC_MAC_CHANGE = 453,
+
+ /**
+ * @generate: both
+ * @acl: none
+ */
+ REMOTE_PROC_DOMAIN_EVENT_CALLBACK_CHANNEL_LIFECYCLE = 454
};
diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
index 0f87d13a5a..7d678afee3 100644
--- a/src/remote_protocol-structs
+++ b/src/remote_protocol-structs
@@ -3337,6 +3337,13 @@ struct remote_domain_event_nic_mac_change_msg {
remote_nonnull_string oldMAC;
remote_nonnull_string newMAC;
};
+struct remote_domain_event_callback_channel_lifecycle_msg {
+ int callbackID;
+ remote_nonnull_domain dom;
+ remote_nonnull_string channelName;
+ int state;
+ int reason;
+};
enum remote_procedure {
REMOTE_PROC_CONNECT_OPEN = 1,
REMOTE_PROC_CONNECT_CLOSE = 2,
@@ -3791,4 +3798,5 @@ enum remote_procedure {
REMOTE_PROC_DOMAIN_SET_THROTTLE_GROUP = 451,
REMOTE_PROC_DOMAIN_DEL_THROTTLE_GROUP = 452,
REMOTE_PROC_DOMAIN_EVENT_NIC_MAC_CHANGE = 453,
+ REMOTE_PROC_DOMAIN_EVENT_CALLBACK_CHANNEL_LIFECYCLE = 454,
};
diff --git a/tools/virsh-domain-event.c b/tools/virsh-domain-event.c
index b9d1cdf019..d0e571d491 100644
--- a/tools/virsh-domain-event.c
+++ b/tools/virsh-domain-event.c
@@ -655,6 +655,39 @@ virshEventAgentLifecyclePrint(virConnectPtr conn G_GNUC_UNUSED,
virshEventPrint(opaque, &buf);
}
+VIR_ENUM_DECL(virshEventChannelLifecycleState);
+VIR_ENUM_IMPL(virshEventChannelLifecycleState,
+ VIR_CONNECT_DOMAIN_EVENT_CHANNEL_LIFECYCLE_STATE_LAST,
+ N_("unknown"),
+ N_("connected"),
+ N_("disconnected"));
+
+VIR_ENUM_DECL(virshEventChannelLifecycleReason);
+VIR_ENUM_IMPL(virshEventChannelLifecycleReason,
+ VIR_CONNECT_DOMAIN_EVENT_CHANNEL_LIFECYCLE_REASON_LAST,
+ N_("unknown"),
+ N_("domain started"),
+ N_("channel event"));
+
+static void
+virshEventChannelLifecyclePrint(virConnectPtr conn G_GNUC_UNUSED,
+ virDomainPtr dom,
+ const char *channelName,
+ int state,
+ int reason,
+ void *opaque)
+{
+ g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+
+ virBufferAsprintf(&buf,
+ _("event 'channel-lifecycle' for domain '%1$s': channel name: '%2$s', state: '%3$s' reason: '%4$s'\n"),
+ virDomainGetName(dom),
+ channelName,
+ UNKNOWNSTR(virshEventChannelLifecycleStateTypeToString(state)),
+ UNKNOWNSTR(virshEventChannelLifecycleReasonTypeToString(reason)));
+ virshEventPrint(opaque, &buf);
+}
+
static void
virshEventMigrationIterationPrint(virConnectPtr conn G_GNUC_UNUSED,
virDomainPtr dom,
@@ -873,6 +906,8 @@ virshDomainEventCallback virshDomainEventCallbacks[] = {
VIR_DOMAIN_EVENT_CALLBACK(virshEventMemoryDeviceSizeChangePrint), },
{ "nic-mac-change",
VIR_DOMAIN_EVENT_CALLBACK(virshEventNICMACChangePrint), },
+ { "channel-lifecycle",
+ VIR_DOMAIN_EVENT_CALLBACK(virshEventChannelLifecyclePrint), },
};
G_STATIC_ASSERT(VIR_DOMAIN_EVENT_ID_LAST == G_N_ELEMENTS(virshDomainEventCallbacks));
--
2.43.0
2
2
v2:
- ESX driver has an opt-in for the legacy behaviour just in case anynone needs
that, although hopefully that should not be the case. The opt-in does not
exist in the vmware driver or the vmx tests, there the v1 behaviour is kept in
which vc.uuid is preferred, but uuid.bios is a fallback.
v1:
- https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/WEKR…
Martin Kletzander (2):
esx: Track VMs by instanceUuid instead of UUID
NEWS: Add information about VMWare domains having different UUIDs
NEWS.rst | 9 ++++++
docs/drvesx.rst | 9 ++++++
src/esx/esx_driver.c | 40 +++++++++++++++---------
src/esx/esx_util.c | 11 +++++++
src/esx/esx_util.h | 1 +
src/esx/esx_vi.c | 33 ++++++++++++++++---
src/esx/esx_vi.h | 3 ++
src/vmx/vmx.c | 10 ++++--
tests/vmx2xmldata/esx-in-the-wild-10.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-11.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-12.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-13.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-14.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-15.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-16.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-17.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-5.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-6.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-7.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-8.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-9.xml | 2 +-
21 files changed, 108 insertions(+), 34 deletions(-)
--
2.54.0
2
4
From: Ján Tomko <jtomko(a)redhat.com>
Fixes: af83ac00eba56e50de70d7d29d1dc7f726786aa5
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
Pushed as a build fix.
src/esx/esx_util.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/esx/esx_util.c b/src/esx/esx_util.c
index 1443ec3b9e..035b646fb6 100644
--- a/src/esx/esx_util.c
+++ b/src/esx/esx_util.c
@@ -24,6 +24,7 @@
#include <config.h>
#include "internal.h"
+#include "viralloc.h"
#include "virlog.h"
#include "viruuid.h"
#include "vmx.h"
--
2.54.0
1
0
From: Ján Tomko <jtomko(a)redhat.com>
On systems with many users, this file can be larger than BUFSIZ.
Since the file should only be editable by root and virFileReadAll
reallocates the buffer in increments as needed as opposed to
allocating for 'maxlen' upfront, set the maximum to INT_MAX.
https://gitlab.com/libvirt/libvirt/-/work_items/874
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
src/util/virutil.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/util/virutil.c b/src/util/virutil.c
index 187b8202dd..3e107cdae6 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -1223,7 +1223,9 @@ virGetSubIDs(virSubID **retval, const char *file)
*retval = NULL;
- if (virFileReadAll(file, BUFSIZ, &buf) < 0)
+ /* We trust the source of the file so we set the limit absurdly high.
+ * For smaller files, the helper function will not allocate as much space */
+ if (virFileReadAll(file, INT_MAX, &buf) < 0)
return -1;
lines = g_strsplit(buf, "\n", 0);
--
2.54.0
2
1
From: Martin Kletzander <mkletzan(a)redhat.com>
The difference is that the usual UUID is supposed to be unique per host
and instanceUuid should be unique across the whole cluster. One could
think of them as HUID and CUID (as the first "U" does apparently mean
something else in the Broadcom world). That _would_ be fine for our
scenario. However, that piece of information turns out to be false as
well and the UUID we were using (`config.uuid`, or in VMX the
`uuid.bios`) can be the same in two machines on the same host.
Fortunately the `FindByUuid()` function can also search for VMs based on
their `instanceUuid`, dictated by the so far omitted third parameter.
Unfortunately that parameter is not parsed (or at least properly) before
vSphere API 4.0 (the documentation says 2.0, but we are not using that
namespace and 4.0 is the lowest we can target), which we are not
specifying in the server returns a 500 HTTP error if we use the
`instanceUuid` parameter.
So this patch adds the `SOAPAction: urn:vim25/4.0` header to the cURL
requests which makes that `FindByUuid()` function work even with the
`instanceUuid` set, but without any extra labor.
After that this patch also changes all UUIDs to be parsed from the
`config.instanceUuid` (or `vc.uuid` in the VMX, but there's a fallback
to the old `uuid.bios`) and adjusts tests accordingly.
Last, but not least it changes the parameter to aforementioned function
to be always true and henceforth all searching ought to be done with the
more unique ID.
Resolves: https://redhat.atlassian.net/browse/RHEL-174300
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/esx/esx_driver.c | 8 ++++----
src/esx/esx_vi.c | 16 ++++++++++++++--
src/vmx/vmx.c | 10 +++++++---
tests/vmx2xmldata/esx-in-the-wild-10.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-11.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-12.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-13.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-14.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-15.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-16.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-17.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-5.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-6.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-7.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-8.xml | 2 +-
tests/vmx2xmldata/esx-in-the-wild-9.xml | 2 +-
16 files changed, 38 insertions(+), 22 deletions(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 010c62b8e880..7cc54af69239 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -1419,7 +1419,7 @@ esxDomainLookupByID(virConnectPtr conn, int id)
"configStatus\0"
"name\0"
"runtime.powerState\0"
- "config.uuid\0") < 0 ||
+ "config.instanceUuid\0") < 0 ||
esxVI_LookupVirtualMachineList(priv->primary, propertyNameList,
&virtualMachineList) < 0) {
goto cleanup;
@@ -1522,7 +1522,7 @@ esxDomainLookupByName(virConnectPtr conn, const char *name)
if (esxVI_String_AppendValueListToList(&propertyNameList,
"configStatus\0"
"runtime.powerState\0"
- "config.uuid\0") < 0 ||
+ "config.instanceUuid\0") < 0 ||
esxVI_LookupVirtualMachineByName(priv->primary, name, propertyNameList,
&virtualMachine,
esxVI_Occurrence_RequiredItem) < 0) {
@@ -4788,7 +4788,7 @@ esxConnectListAllDomains(virConnectPtr conn,
if (esxVI_String_AppendValueListToList(&propertyNameList,
"configStatus\0"
"name\0"
- "config.uuid\0") < 0) {
+ "config.instanceUuid\0") < 0) {
goto cleanup;
}
}
@@ -4970,7 +4970,7 @@ esxDomainHasManagedSaveImage(virDomainPtr domain, unsigned int flags)
if (esxVI_FindByUuid(priv->primary, priv->primary->datacenter->_reference,
uuid_string, esxVI_Boolean_True,
- esxVI_Boolean_Undefined,
+ esxVI_Boolean_True,
&managedObjectReference) < 0) {
return -1;
}
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index db006ed16f40..55d5d1478586 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -300,6 +300,17 @@ esxVI_CURL_Connect(esxVI_CURL *curl, esxUtil_ParsedUri *parsedUri)
curl->headers = curl_slist_append(curl->headers,
"Content-Type: text/xml; charset=UTF-8");
+ /*
+ * Testing showed that the 4.0 version is most close to our current types in
+ * esx_vi_generator.input data. We could update the version if new method
+ * parameters or object properties are needed.
+ *
+ * The other option is to drop the "/x.y" suffix completely once
+ * https://gitlab.com/libvirt/libvirt/-/work_items/878 is implemented since
+ * that will not limit the version at all.
+ */
+ curl->headers = curl_slist_append(curl->headers, "SOAPAction: urn:vim25/4.0");
+
/*
* Add an empty expect header to stop CURL from waiting for a response code
* 100 (Continue) from the server before continuing the POST operation.
@@ -2452,7 +2463,8 @@ esxVI_GetVirtualMachineIdentity(esxVI_ObjectContent *virtualMachine,
for (dynamicProperty = virtualMachine->propSet;
dynamicProperty;
dynamicProperty = dynamicProperty->_next) {
- if (STREQ(dynamicProperty->name, "config.uuid")) {
+
+ if (STREQ(dynamicProperty->name, "config.instanceUuid")) {
if (esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_String) < 0) {
goto failure;
@@ -2682,7 +2694,7 @@ esxVI_LookupVirtualMachineByUuid(esxVI_Context *ctx, const unsigned char *uuid,
virUUIDFormat(uuid, uuid_string);
if (esxVI_FindByUuid(ctx, ctx->datacenter->_reference, uuid_string,
- esxVI_Boolean_True, esxVI_Boolean_Undefined,
+ esxVI_Boolean_True, esxVI_Boolean_True,
&managedObjectReference) < 0) {
return -1;
}
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 084b4154427f..a2422c37355c 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -1492,9 +1492,13 @@ virVMXParseConfig(virVMXContext *ctx,
def->scsiBusMaxUnit = SCSI_SUPER_WIDE_BUS_MAX_CONT_UNIT;
}
- /* vmx:uuid.bios -> def:uuid */
- /* FIXME: Need to handle 'uuid.action = "create"' */
- if (virVMXGetConfigUUID(conf, "uuid.bios", def->uuid, true) < 0)
+ /* vmx:vc.uuid (fallback to uuid.bios) -> def:uuid */
+ if (virVMXGetConfigUUID(conf, "vc.uuid", def->uuid, true) < 0)
+ goto cleanup;
+
+ /* FIXME: Need to handle 'uuid.action = "create"' ? */
+ if (!virUUIDIsValid(def->uuid) &&
+ virVMXGetConfigUUID(conf, "uuid.bios", def->uuid, true) < 0)
goto cleanup;
/* vmx:displayName -> def:name */
diff --git a/tests/vmx2xmldata/esx-in-the-wild-10.xml b/tests/vmx2xmldata/esx-in-the-wild-10.xml
index 1b1fdf06623f..3a8bb20140a1 100644
--- a/tests/vmx2xmldata/esx-in-the-wild-10.xml
+++ b/tests/vmx2xmldata/esx-in-the-wild-10.xml
@@ -1,6 +1,6 @@
<domain type='vmware'>
<name>w2019biosvmware</name>
- <uuid>421a6177-5aa9-abb7-5924-fc376c18a1b4</uuid>
+ <uuid>501af9f2-6d29-1c76-19a9-b208ede5f374</uuid>
<genid>13c67c91-9f47-526f-b0d6-e4dd2e4bb4f9</genid>
<memory unit='KiB'>4194304</memory>
<currentMemory unit='KiB'>4194304</currentMemory>
diff --git a/tests/vmx2xmldata/esx-in-the-wild-11.xml b/tests/vmx2xmldata/esx-in-the-wild-11.xml
index 0dd297af43f0..6398e50c5c6c 100644
--- a/tests/vmx2xmldata/esx-in-the-wild-11.xml
+++ b/tests/vmx2xmldata/esx-in-the-wild-11.xml
@@ -1,6 +1,6 @@
<domain type='vmware'>
<name>esx6.7-rhel7.7-x86_64</name>
- <uuid>422c0152-63ab-cd03-9650-4301ae77aefd</uuid>
+ <uuid>502ca229-12eb-24f6-0c37-c025ff5da005</uuid>
<memory unit='KiB'>2097152</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
<vcpu placement='static'>1</vcpu>
diff --git a/tests/vmx2xmldata/esx-in-the-wild-12.xml b/tests/vmx2xmldata/esx-in-the-wild-12.xml
index ac83982b9b88..d505ff58d12d 100644
--- a/tests/vmx2xmldata/esx-in-the-wild-12.xml
+++ b/tests/vmx2xmldata/esx-in-the-wild-12.xml
@@ -1,6 +1,6 @@
<domain type='vmware'>
<name>Auto-esx8.0-rhell9.3-efi-with-empty-cdrom</name>
- <uuid>4220fca7-11dd-d67e-19cc-fcad0a37c342</uuid>
+ <uuid>5020ca5b-7ac1-5c44-cfa1-9e762e2f933b</uuid>
<memory unit='KiB'>2097152</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
<vcpu placement='static'>1</vcpu>
diff --git a/tests/vmx2xmldata/esx-in-the-wild-13.xml b/tests/vmx2xmldata/esx-in-the-wild-13.xml
index cef9fd4e48c9..2bea51a087eb 100644
--- a/tests/vmx2xmldata/esx-in-the-wild-13.xml
+++ b/tests/vmx2xmldata/esx-in-the-wild-13.xml
@@ -1,6 +1,6 @@
<domain type='vmware'>
<name>Test-Mig-VM-1 (01ce57d0-4e20-41a5-8b6c-bcbf49a032ec)</name>
- <uuid>421eb458-5448-fc12-2074-83d5e419e138</uuid>
+ <uuid>01ce57d0-4e20-41a5-8b6c-bcbf49a032ec</uuid>
<description>name:Test-Mig-VM-1
userid:962314ba515c48388a0e95c0961709ff
username:admin
diff --git a/tests/vmx2xmldata/esx-in-the-wild-14.xml b/tests/vmx2xmldata/esx-in-the-wild-14.xml
index f10707d1d412..574dd2097455 100644
--- a/tests/vmx2xmldata/esx-in-the-wild-14.xml
+++ b/tests/vmx2xmldata/esx-in-the-wild-14.xml
@@ -1,6 +1,6 @@
<domain type='vmware'>
<name>wild14</name>
- <uuid>421b223a-f2c1-c7c9-a399-34d2d9fde26d</uuid>
+ <uuid>501b831e-75d8-15f8-36fa-b9e225f395aa</uuid>
<description>execution env sandbox automation platform</description>
<memory unit='KiB'>33554432</memory>
<currentMemory unit='KiB'>33554432</currentMemory>
diff --git a/tests/vmx2xmldata/esx-in-the-wild-15.xml b/tests/vmx2xmldata/esx-in-the-wild-15.xml
index 78d15e1538e6..4c753f87e2ea 100644
--- a/tests/vmx2xmldata/esx-in-the-wild-15.xml
+++ b/tests/vmx2xmldata/esx-in-the-wild-15.xml
@@ -1,6 +1,6 @@
<domain type='vmware'>
<name>dokuwiki</name>
- <uuid>420338bd-1c9e-ad50-99a2-59e92ddda8b6</uuid>
+ <uuid>500341d5-fe23-ac46-8cb3-77a8e5a1143d</uuid>
<memory unit='KiB'>2097152</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
<vcpu placement='static'>2</vcpu>
diff --git a/tests/vmx2xmldata/esx-in-the-wild-16.xml b/tests/vmx2xmldata/esx-in-the-wild-16.xml
index 51746dd77ef0..8c5bc7f43513 100644
--- a/tests/vmx2xmldata/esx-in-the-wild-16.xml
+++ b/tests/vmx2xmldata/esx-in-the-wild-16.xml
@@ -1,6 +1,6 @@
<domain type='vmware'>
<name>Auto-esx8.0-rhel9.4-efi-nvme-disk</name>
- <uuid>4220df89-e3a8-8513-f611-ad252bfd7047</uuid>
+ <uuid>5020196e-c5c8-7310-fcdb-d2933d0c4b2f</uuid>
<memory unit='KiB'>2097152</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
<vcpu placement='static'>1</vcpu>
diff --git a/tests/vmx2xmldata/esx-in-the-wild-17.xml b/tests/vmx2xmldata/esx-in-the-wild-17.xml
index 725f21bdf601..506e08fc54ec 100644
--- a/tests/vmx2xmldata/esx-in-the-wild-17.xml
+++ b/tests/vmx2xmldata/esx-in-the-wild-17.xml
@@ -1,6 +1,6 @@
<domain type='vmware'>
<name>esx8.0-win11-with-second-disk-in-subfolder</name>
- <uuid>42256ec1-e066-9364-3dd1-36a0b75263dd</uuid>
+ <uuid>50250f27-538b-5091-a43b-a50ce95f2382</uuid>
<genid>3191ed70-eb21-9c71-2478-373fb27fed9b</genid>
<memory unit='KiB'>4194304</memory>
<currentMemory unit='KiB'>4194304</currentMemory>
diff --git a/tests/vmx2xmldata/esx-in-the-wild-5.xml b/tests/vmx2xmldata/esx-in-the-wild-5.xml
index c88e60bdc070..a86119508c70 100644
--- a/tests/vmx2xmldata/esx-in-the-wild-5.xml
+++ b/tests/vmx2xmldata/esx-in-the-wild-5.xml
@@ -1,6 +1,6 @@
<domain type='vmware'>
<name>vmtest.local</name>
- <uuid>423e94a9-a1c7-b31d-7161-76c7586c830e</uuid>
+ <uuid>503e06db-f8d5-458e-a2fb-f9820253a7be</uuid>
<description>Centos 5.5 64bit Server</description>
<memory unit='KiB'>2097152</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
diff --git a/tests/vmx2xmldata/esx-in-the-wild-6.xml b/tests/vmx2xmldata/esx-in-the-wild-6.xml
index 805f03356129..f252304f9796 100644
--- a/tests/vmx2xmldata/esx-in-the-wild-6.xml
+++ b/tests/vmx2xmldata/esx-in-the-wild-6.xml
@@ -1,6 +1,6 @@
<domain type='vmware'>
<name>el6-test</name>
- <uuid>564d15d4-d062-fe9a-80f5-eb8e1a2c3afc</uuid>
+ <uuid>5200b69b-8d88-7bdf-a14a-02705d653772</uuid>
<memory unit='KiB'>1048576</memory>
<currentMemory unit='KiB'>1048576</currentMemory>
<vcpu placement='static'>1</vcpu>
diff --git a/tests/vmx2xmldata/esx-in-the-wild-7.xml b/tests/vmx2xmldata/esx-in-the-wild-7.xml
index b641574776b6..076655f37ac2 100644
--- a/tests/vmx2xmldata/esx-in-the-wild-7.xml
+++ b/tests/vmx2xmldata/esx-in-the-wild-7.xml
@@ -1,6 +1,6 @@
<domain type='vmware'>
<name>esx-rhel6-mini-with-scsi-device</name>
- <uuid>564d9176-621f-0239-f5ad-3a002371953b</uuid>
+ <uuid>52409533-33a2-56c5-36ce-80d605f8ecf4</uuid>
<memory unit='KiB'>2097152</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
<vcpu placement='static'>1</vcpu>
diff --git a/tests/vmx2xmldata/esx-in-the-wild-8.xml b/tests/vmx2xmldata/esx-in-the-wild-8.xml
index f13e6f744880..2ef609e87bdb 100644
--- a/tests/vmx2xmldata/esx-in-the-wild-8.xml
+++ b/tests/vmx2xmldata/esx-in-the-wild-8.xml
@@ -1,6 +1,6 @@
<domain type='vmware'>
<name>RHEL7_10_NICs</name>
- <uuid>42359420-99dc-4261-5264-ba58ddae20e4</uuid>
+ <uuid>50351de6-7d56-29ab-9d72-c7f9ea3fcfd0</uuid>
<memory unit='KiB'>2097152</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
<vcpu placement='static'>8</vcpu>
diff --git a/tests/vmx2xmldata/esx-in-the-wild-9.xml b/tests/vmx2xmldata/esx-in-the-wild-9.xml
index 6b4d878ab18a..4fbe141f6c47 100644
--- a/tests/vmx2xmldata/esx-in-the-wild-9.xml
+++ b/tests/vmx2xmldata/esx-in-the-wild-9.xml
@@ -1,6 +1,6 @@
<domain type='vmware'>
<name>v2v-windows-kkulkarn</name>
- <uuid>42009372-17da-be73-779d-007ccf1bd228</uuid>
+ <uuid>5000d2b0-616e-6129-8c06-82b07440a871</uuid>
<description>MIQ GUID=b55c806d-99b9-4fa5-bbcc-a4de04f822e5</description>
<memory unit='KiB'>16777216</memory>
<currentMemory unit='KiB'>16777216</currentMemory>
--
2.54.0
3
8
13 May '26
Jirka reported to me that one of the test cases I've introduced started
to fail for him. It turned out that flatpak "leaks" a FD of the wayland
socket to run programs in his env, which broke a test case wanting to
use fd '205'. (we use stable FD numbers via dup2 to ensure output stays
identical)
To prevent this from happening refactor virCommandMassClose and use it
in all tests to close everything except stdio.
Peter Krempa (2):
util: command: Extract non-virCommand related bits from
virCommandMassClose
testutils: Close FDs leaked into test programs to avoid random
breakage
src/libvirt_private.syms | 1 +
src/util/vircommand.c | 101 +++++++++++++++++++++------------------
src/util/vircommand.h | 3 ++
tests/testutils.c | 10 ++++
4 files changed, 69 insertions(+), 46 deletions(-)
--
2.54.0
2
7
[RFC PATCH] resctrl: add energy monitoring via resctrl's PERF_PKG_MON
by Jedrzej Wasiukiewicz 13 May '26
by Jedrzej Wasiukiewicz 13 May '26
13 May '26
Linux kernel 7.0 introduced PERF_PKG_MON support in resctrl filesystem
which exposes per-workload energy and performance monitoring.
This patch enables per-VM energy monitoring via core_energy (Joules) and
activity (Farads) counters. Energy monitors can be configured through new
<energytune> element under <cputune> following earlier cachetune and
memorytune patterns.
Design notes:
Energy values from resctrl are floating-point. I added separate dvals/ndvals
pair to virResctrlMonitorStats to handle them. I kept them in a single
struct for easier integration with performance counters (integers and floats
within same monitor) that might be integrated in another patch.
The new XML element is <energytune> under <cputune> following earlier pattern for
resctrl features (cachetune, memorytune). Energytune doesn't currently support
the "tuning" part, only monitoring. I added it as energytune for consistency with
cache and memory features, keeping all resctrl handling under cputune. This also makes
sense with current resctrl architecture - all monitoring groups are part of an
allocation group. This approach allows for easy opt-in/out on the monitoring features.
Signed-off-by: Jedrzej Wasiukiewicz <jedrzej.wasiukiewicz(a)intel.com>
Signed-off-by: Christopher M. Cantalupo <christopher.m.cantalupo(a)intel.com>
---
Please let me know if there's a better approach for this. I'm happy to rework
the design based on feedback. I can also split this patch if necessary.
NEWS.rst | 6 +
docs/formatdomain.rst | 20 ++
include/libvirt/libvirt-domain.h | 65 +++++++
src/conf/capabilities.c | 42 ++++
src/conf/capabilities.h | 6 +
src/conf/domain_conf.c | 99 ++++++++++
src/conf/schemas/capability.rng | 26 +++
src/conf/schemas/domaincommon.rng | 19 ++
src/conf/virconftypes.h | 2 +
src/qemu/qemu_driver.c | 70 ++++++-
src/util/virresctrl.c | 180 +++++++++++++++---
src/util/virresctrl.h | 12 +-
.../genericxml2xmlindata/energytune-basic.xml | 32 ++++
tests/genericxml2xmltest.c | 1 +
14 files changed, 543 insertions(+), 37 deletions(-)
create mode 100644 tests/genericxml2xmlindata/energytune-basic.xml
diff --git a/NEWS.rst b/NEWS.rst
index 105a398ca8..02dda023ed 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -17,6 +17,12 @@ v12.4.0 (unreleased)
* **New features**
+ * resctrl: Add energy monitoring via resctrl's PERF_PKG_MON
+
+ Add support for Linux kernel 7.0 feature - energy monitoring via resctrl.
+ This allows to monitor per-VM energy consumption on supported platforms.
+ Implemented via ``energytune`` element in ``cputune`` .
+
* **Improvements**
* **Bug fixes**
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index 078cd7aa84..db1ca5637a 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -900,6 +900,9 @@ CPU Tuning
<memorytune vcpus='0-3'>
<node id='0' bandwidth='60'/>
</memorytune>
+ <energytune vcpus='0-3'>
+ <monitor vcpus='0-3'/>
+ </energytune>
</cputune>
...
@@ -1084,6 +1087,23 @@ CPU Tuning
responsible for making sure the value makes sense on their system and
configuration.
+``energytune`` :since:`Since 12.4.0`
+ Optional ``energytune`` element allows to monitor energy consumption using the
+ resctrl filesystem on the host. Whether or not is this supported can be
+ gathered from capabilities where number of monitors and available features are
+ reported. The required attribute ``vcpus`` specifies to which allocation group
+ this monitor belongs. A vCPU can only be member of one allocation group and monitor
+ group. The ``vcpus`` specified by ``energytune`` can be identical to those
+ specified by ``cachetune`` or ``memorytune``. However they are not allowed to
+ overlap each other. Supported subelements are:
+
+ ``monitor``
+ The optional element ``monitor`` creates the energy monitor for
+ this allocation group and has the following required attribute:
+
+ ``vcpus``
+ vCPU list the monitor applies to.
+
Memory Allocation
-----------------
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index 4a8e3114b3..3ba1b27743 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -4401,6 +4401,71 @@ struct _virDomainStatsRecord {
# define VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_NODE_SUFFIX_BYTES_TOTAL ".bytes.total"
+/**
+ * VIR_DOMAIN_STATS_CPU_ENERGY_MONITOR_COUNT:
+ *
+ * The number of energy monitors for this domain, as an unsigned int.
+ *
+ * Since: 12.4.0
+ */
+# define VIR_DOMAIN_STATS_CPU_ENERGY_MONITOR_COUNT "cpu.energy.monitor.count"
+
+/**
+ * VIR_DOMAIN_STATS_CPU_ENERGY_MONITOR_PREFIX:
+ *
+ * Prefix for an individual energy monitor group. Concatenate
+ * with the monitor index and one of the "cpu.energy.monitor.<i>." suffix
+ * macros below to form a full parameter name.
+ *
+ * Since: 12.4.0
+ */
+# define VIR_DOMAIN_STATS_CPU_ENERGY_MONITOR_PREFIX "cpu.energy.monitor."
+
+/**
+ * VIR_DOMAIN_STATS_CPU_ENERGY_MONITOR_SUFFIX_NAME:
+ *
+ * Name of the monitor group as a string.
+ *
+ * Since: 12.4.0
+ */
+# define VIR_DOMAIN_STATS_CPU_ENERGY_MONITOR_SUFFIX_NAME ".name"
+
+/**
+ * VIR_DOMAIN_STATS_CPU_ENERGY_MONITOR_SUFFIX_VCPUS:
+ *
+ * vCPU set covered by the monitor group as a string.
+ *
+ * Since: 12.4.0
+ */
+# define VIR_DOMAIN_STATS_CPU_ENERGY_MONITOR_SUFFIX_VCPUS ".vcpus"
+
+/**
+ * VIR_DOMAIN_STATS_CPU_ENERGY_MONITOR_SUFFIX_PKG_COUNT:
+ *
+ * Number of PERF_PKG nodes the monitor group exposes, as an unsigned int.
+ *
+ * Since: 12.4.0
+ */
+# define VIR_DOMAIN_STATS_CPU_ENERGY_MONITOR_SUFFIX_PKG_COUNT ".pkg.count"
+
+/**
+ * VIR_DOMAIN_STATS_CPU_ENERGY_MONITOR_SUFFIX_PKG_PREFIX:
+ *
+ * Prefix for a single mon_PERF_PKG node inside a monitor group.
+ *
+ * Since: 12.4.0
+ */
+# define VIR_DOMAIN_STATS_CPU_ENERGY_MONITOR_SUFFIX_PKG_PREFIX ".pkg."
+
+/**
+ * VIR_DOMAIN_STATS_CPU_ENERGY_MONITOR_SUFFIX_PKG_SUFFIX_ID:
+ *
+ * Kernel-assigned mon_PERF_PKG node id, as an unsigned int.
+ *
+ * Since: 12.4.0
+ */
+# define VIR_DOMAIN_STATS_CPU_ENERGY_MONITOR_SUFFIX_PKG_SUFFIX_ID ".id"
+
/**
* VIR_DOMAIN_STATS_DIRTYRATE_CALC_STATUS:
*
diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index 1821e36e61..e83de6d1bc 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -263,6 +263,8 @@ virCapsDispose(void *object)
virResctrlInfoMonFree(caps->host.memBW.monitor);
g_free(caps->host.memBW.nodes);
+ virResctrlInfoMonFree(caps->host.energy.monitor);
+
g_free(caps->host.netprefix);
g_free(caps->host.pagesSize);
virCPUDefFree(caps->host.cpu);
@@ -1057,6 +1059,26 @@ virCapabilitiesFormatMemoryBandwidth(virBuffer *buf,
}
+static int
+virCapabilitiesFormatEnergy(virBuffer *buf,
+ virCapsHostEnergy *energy)
+{
+ if (!energy->monitor)
+ return 0;
+
+ virBufferAddLit(buf, "<energy>\n");
+ virBufferAdjustIndent(buf, 2);
+
+ if (virCapabilitiesFormatResctrlMonitor(buf, energy->monitor) < 0)
+ return -1;
+
+ virBufferAdjustIndent(buf, -2);
+ virBufferAddLit(buf, "</energy>\n");
+
+ return 0;
+}
+
+
static int
virCapabilitiesFormatHostXML(virCapsHost *host,
virBuffer *buf)
@@ -1156,6 +1178,9 @@ virCapabilitiesFormatHostXML(virCapsHost *host,
if (virCapabilitiesFormatMemoryBandwidth(buf, &host->memBW) < 0)
return -1;
+ if (virCapabilitiesFormatEnergy(buf, &host->energy) < 0)
+ return -1;
+
for (i = 0; i < host->nsecModels; i++) {
virBufferAddLit(buf, "<secmodel>\n");
virBufferAdjustIndent(buf, 2);
@@ -2143,6 +2168,20 @@ virCapabilitiesInitResctrlMemory(virCaps *caps)
}
+static int
+virCapabilitiesInitEnergy(virCaps *caps)
+{
+ const char *prefix = virResctrlMonitorPrefixTypeToString(
+ VIR_RESCTRL_MONITOR_TYPE_ENERGY);
+
+ if (virResctrlInfoGetMonitorPrefix(caps->host.resctrl, prefix,
+ &caps->host.energy.monitor) < 0)
+ return -1;
+
+ return 0;
+}
+
+
int
virCapabilitiesInitCaches(virCaps *caps)
{
@@ -2294,6 +2333,9 @@ virCapabilitiesInitCaches(virCaps *caps)
&caps->host.cache.monitor) < 0)
return -1;
+ if (virCapabilitiesInitEnergy(caps) < 0)
+ return -1;
+
return 0;
}
diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h
index daea835817..0482e4297a 100644
--- a/src/conf/capabilities.h
+++ b/src/conf/capabilities.h
@@ -162,6 +162,10 @@ struct _virCapsHostMemBW {
virResctrlInfoMon *monitor;
};
+struct _virCapsHostEnergy {
+ virResctrlInfoMon *monitor;
+};
+
struct _virCapsHost {
virArch arch;
size_t nfeatures;
@@ -184,6 +188,8 @@ struct _virCapsHost {
virCapsHostMemBW memBW;
+ virCapsHostEnergy energy;
+
size_t nsecModels;
virCapsHostSecModel *secModels;
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 3497e84bf5..946b34abf3 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19467,6 +19467,57 @@ virDomainMemorytuneDefParse(virDomainDef *def,
}
+static int
+virDomainEnergytuneDefParse(virDomainDef *def,
+ xmlXPathContextPtr ctxt,
+ xmlNodePtr node,
+ unsigned int flags)
+{
+ VIR_XPATH_NODE_AUTORESTORE(ctxt)
+ virDomainResctrlDef *resctrl = NULL;
+ virDomainResctrlDef *newresctrl = NULL;
+ g_autoptr(virBitmap) vcpus = NULL;
+ g_autoptr(virResctrlAlloc) alloc = NULL;
+ size_t nmons;
+ int ret = -1;
+
+ ctxt->node = node;
+
+ if (virDomainResctrlParseVcpus(def, node, &vcpus) < 0)
+ return -1;
+
+ if (virBitmapIsAllClear(vcpus))
+ return 0;
+
+ if (virDomainResctrlVcpuMatch(def, vcpus, &resctrl) < 0)
+ return -1;
+
+ if (resctrl) {
+ alloc = virObjectRef(resctrl->alloc);
+ } else {
+ if (!(alloc = virResctrlAllocNew()))
+ return -1;
+ if (!(newresctrl = virDomainResctrlNew(node, alloc, vcpus, flags)))
+ return -1;
+ resctrl = newresctrl;
+ }
+
+ nmons = resctrl->nmonitors;
+ if (virDomainResctrlMonDefParse(def, ctxt, node,
+ VIR_RESCTRL_MONITOR_TYPE_ENERGY,
+ resctrl) < 0)
+ goto cleanup;
+
+ if (newresctrl && resctrl->nmonitors > nmons)
+ VIR_APPEND_ELEMENT(def->resctrls, def->nresctrls, newresctrl);
+
+ ret = 0;
+ cleanup:
+ virDomainResctrlDefFree(newresctrl);
+ return ret;
+}
+
+
static int
virDomainDefTunablesParse(virDomainDef *def,
xmlXPathContextPtr ctxt,
@@ -19671,6 +19722,15 @@ virDomainDefTunablesParse(virDomainDef *def,
}
VIR_FREE(nodes);
+ if ((n = virXPathNodeSet("./cputune/energytune", ctxt, &nodes)) < 0)
+ return -1;
+
+ for (i = 0; i < n; i++) {
+ if (virDomainEnergytuneDefParse(def, ctxt, nodes[i], flags) < 0)
+ return -1;
+ }
+ VIR_FREE(nodes);
+
return 0;
}
@@ -28721,6 +28781,42 @@ virDomainMemorytuneDefFormat(virBuffer *buf,
return 0;
}
+
+static int
+virDomainEnergytuneDefFormat(virBuffer *buf,
+ virDomainResctrlDef *resctrl,
+ unsigned int flags)
+{
+ g_auto(virBuffer) childrenBuf = VIR_BUFFER_INIT_CHILD(buf);
+ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
+ g_autofree char *vcpus = NULL;
+ size_t i;
+
+ for (i = 0; i < resctrl->nmonitors; i++) {
+ if (virDomainResctrlMonDefFormatHelper(resctrl->monitors[i],
+ VIR_RESCTRL_MONITOR_TYPE_ENERGY,
+ &childrenBuf) < 0)
+ return -1;
+ }
+
+ if (!virBufferUse(&childrenBuf))
+ return 0;
+
+ vcpus = virBitmapFormat(resctrl->vcpus);
+ virBufferAsprintf(&attrBuf, " vcpus='%s'", vcpus);
+
+ if (!(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE)) {
+ const char *alloc_id = virResctrlAllocGetID(resctrl->alloc);
+ if (!alloc_id)
+ return -1;
+
+ virBufferAsprintf(&attrBuf, " id='%s'", alloc_id);
+ }
+
+ virXMLFormatElement(buf, "energytune", &attrBuf, &childrenBuf);
+ return 0;
+}
+
static int
virDomainCputuneDefFormat(virBuffer *buf,
virDomainDef *def,
@@ -28821,6 +28917,9 @@ virDomainCputuneDefFormat(virBuffer *buf,
for (i = 0; i < def->nresctrls; i++)
virDomainMemorytuneDefFormat(&childrenBuf, def->resctrls[i], flags);
+ for (i = 0; i < def->nresctrls; i++)
+ virDomainEnergytuneDefFormat(&childrenBuf, def->resctrls[i], flags);
+
virXMLFormatElement(buf, "cputune", NULL, &childrenBuf);
return 0;
diff --git a/src/conf/schemas/capability.rng b/src/conf/schemas/capability.rng
index 8ef6e9a282..2aa711178f 100644
--- a/src/conf/schemas/capability.rng
+++ b/src/conf/schemas/capability.rng
@@ -45,6 +45,9 @@
<optional>
<ref name="memory_bandwidth"/>
</optional>
+ <optional>
+ <ref name="energy"/>
+ </optional>
<zeroOrMore>
<ref name="secmodel"/>
</zeroOrMore>
@@ -333,6 +336,29 @@
</data>
</define>
+ <define name="energyMonitorFeature">
+ <data type="string">
+ <param name="pattern">[a-zA-Z0-9\-_]+</param>
+ </data>
+ </define>
+
+ <define name="energy">
+ <element name="energy">
+ <element name="monitor">
+ <attribute name="maxMonitors">
+ <ref name="unsignedInt"/>
+ </attribute>
+ <oneOrMore>
+ <element name="feature">
+ <attribute name="name">
+ <ref name="energyMonitorFeature"/>
+ </attribute>
+ </element>
+ </oneOrMore>
+ </element>
+ </element>
+ </define>
+
<define name="guestcaps">
<element name="guest">
<ref name="ostype"/>
diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng
index 8c03e14d37..eb365a83b5 100644
--- a/src/conf/schemas/domaincommon.rng
+++ b/src/conf/schemas/domaincommon.rng
@@ -1293,6 +1293,25 @@
</oneOrMore>
</element>
</zeroOrMore>
+ <zeroOrMore>
+ <element name="energytune">
+ <attribute name="vcpus">
+ <ref name="cpuset"/>
+ </attribute>
+ <optional>
+ <attribute name="id">
+ <data type="string"/>
+ </attribute>
+ </optional>
+ <oneOrMore>
+ <element name="monitor">
+ <attribute name="vcpus">
+ <ref name="cpuset"/>
+ </attribute>
+ </element>
+ </oneOrMore>
+ </element>
+ </zeroOrMore>
</interleave>
</element>
</define>
diff --git a/src/conf/virconftypes.h b/src/conf/virconftypes.h
index 0596791a4d..f1a200bfe2 100644
--- a/src/conf/virconftypes.h
+++ b/src/conf/virconftypes.h
@@ -52,6 +52,8 @@ typedef struct _virCapsHostMemBW virCapsHostMemBW;
typedef struct _virCapsHostMemBWNode virCapsHostMemBWNode;
+typedef struct _virCapsHostEnergy virCapsHostEnergy;
+
typedef struct _virCapsHostNUMA virCapsHostNUMA;
typedef struct _virCapsHostNUMACell virCapsHostNUMACell;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 529e9fe3be..3fafaaea19 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -16917,11 +16917,11 @@ qemuDomainFreeResctrlMonData(virQEMUResctrlMonData *resdata)
* returns an error, the caller is also required to call
* qemuDomainFreeResctrlMonData to free each element in the
* *@resdata array and then the array itself.
- * @tag: Could be VIR_RESCTRL_MONITOR_TYPE_CACHE for getting cache statistics
- * from @dom cache monitors. VIR_RESCTRL_MONITOR_TYPE_MEMBW for
- * getting memory bandwidth statistics from memory bandwidth monitors.
+ * @tag: VIR_RESCTRL_MONITOR_TYPE_CACHE for getting cache statistics.
+ * VIR_RESCTRL_MONITOR_TYPE_MEMBW for getting memory bandwidth statistics.
+ * VIR_RESCTRL_MONITOR_TYPE_ENERGY for getting energy statistics.
*
- * Get cache or memory bandwidth statistics from @dom monitors.
+ * Get cache, memory bandwidth or energy statistics from @dom monitors.
*
* Returns -1 on failure, or 0 on success.
*/
@@ -16951,6 +16951,10 @@ qemuDomainGetResctrlMonData(virQEMUDriver *driver,
if (caps->host.memBW.monitor)
features = caps->host.memBW.monitor->features;
break;
+ case VIR_RESCTRL_MONITOR_TYPE_ENERGY:
+ if (caps->host.energy.monitor)
+ features = caps->host.energy.monitor->features;
+ break;
case VIR_RESCTRL_MONITOR_TYPE_UNSUPPORT:
case VIR_RESCTRL_MONITOR_TYPE_LAST:
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
@@ -17066,6 +17070,62 @@ qemuDomainGetStatsMemoryBandwidth(virQEMUDriver *driver,
}
+static void
+qemuDomainGetStatsEnergy(virQEMUDriver *driver,
+ virDomainObj *dom,
+ virTypedParamList *params)
+{
+ g_autofree virQEMUResctrlMonData **resdata = NULL;
+ size_t nresdata = 0;
+ size_t i = 0;
+ size_t j = 0;
+ size_t k = 0;
+
+ if (!virDomainObjIsActive(dom))
+ return;
+
+ if (qemuDomainGetResctrlMonData(driver, dom, &resdata, &nresdata,
+ VIR_RESCTRL_MONITOR_TYPE_ENERGY) < 0) {
+ virResetLastError();
+ return;
+ }
+
+ if (nresdata == 0)
+ return;
+
+ virTypedParamListAddUInt(params, nresdata,
+ VIR_DOMAIN_STATS_CPU_ENERGY_MONITOR_COUNT);
+
+ for (i = 0; i < nresdata; i++) {
+ virTypedParamListAddString(params, resdata[i]->name,
+ VIR_DOMAIN_STATS_CPU_ENERGY_MONITOR_PREFIX "%zu" VIR_DOMAIN_STATS_CPU_ENERGY_MONITOR_SUFFIX_NAME, i);
+ virTypedParamListAddString(params, resdata[i]->vcpus,
+ VIR_DOMAIN_STATS_CPU_ENERGY_MONITOR_PREFIX "%zu" VIR_DOMAIN_STATS_CPU_ENERGY_MONITOR_SUFFIX_VCPUS, i);
+ virTypedParamListAddUInt(params, resdata[i]->nstats,
+ VIR_DOMAIN_STATS_CPU_ENERGY_MONITOR_PREFIX "%zu" VIR_DOMAIN_STATS_CPU_ENERGY_MONITOR_SUFFIX_PKG_COUNT, i);
+
+ for (j = 0; j < resdata[i]->nstats; j++) {
+ char **features = resdata[i]->stats[j]->features;
+
+ virTypedParamListAddUInt(params, resdata[i]->stats[j]->id,
+ VIR_DOMAIN_STATS_CPU_ENERGY_MONITOR_PREFIX "%zu" VIR_DOMAIN_STATS_CPU_ENERGY_MONITOR_SUFFIX_PKG_PREFIX "%zu" VIR_DOMAIN_STATS_CPU_ENERGY_MONITOR_SUFFIX_PKG_SUFFIX_ID, i, j);
+
+ for (k = 0; features[k]; k++) {
+ if (k >= resdata[i]->stats[j]->ndvals)
+ break;
+
+ virTypedParamListAddDouble(params, resdata[i]->stats[j]->dvals[k],
+ VIR_DOMAIN_STATS_CPU_ENERGY_MONITOR_PREFIX "%zu" VIR_DOMAIN_STATS_CPU_ENERGY_MONITOR_SUFFIX_PKG_PREFIX "%zu" ".%s", i, j,
+ features[k]);
+ }
+ }
+ }
+
+ for (i = 0; i < nresdata; i++)
+ qemuDomainFreeResctrlMonData(resdata[i]);
+}
+
+
static void
qemuDomainGetStatsCpuCache(virQEMUDriver *driver,
virDomainObj *dom,
@@ -17277,6 +17337,8 @@ qemuDomainGetStatsCpu(virQEMUDriver *driver,
qemuDomainGetStatsCpuCache(driver, dom, params);
+ qemuDomainGetStatsEnergy(driver, dom, params);
+
qemuDomainGetStatsCpuHaltPollTime(dom, params, privflags);
}
diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
index 8f33a85a56..32cbfb6c2e 100644
--- a/src/util/virresctrl.c
+++ b/src/util/virresctrl.c
@@ -79,15 +79,24 @@ VIR_ENUM_IMPL(virResctrl,
"DATA",
);
-/* Monitor feature name prefix mapping for monitor naming */
+/* Monitor feature prefix/type mapping for monitor naming */
VIR_ENUM_IMPL(virResctrlMonitorPrefix,
VIR_RESCTRL_MONITOR_TYPE_LAST,
"__unsupported__",
"llc_",
"mbm_",
+ "energy",
);
+/* PERF_PKG_MON features that report energy data (floating-point). */
+static const char *virResctrlEnergyFeatures[] = {
+ "core_energy",
+ "activity",
+ NULL,
+};
+
+
/* All private typedefs so that they exist for all later definitions. This way
* structs can be included in one or another without reorganizing the code every
* time. */
@@ -183,6 +192,8 @@ struct _virResctrlInfo {
virResctrlInfoMemBW *membw_info;
virResctrlInfoMongrp *monitor_info;
+
+ virResctrlInfoMongrp *perf_monitor_info;
};
static void
@@ -235,10 +246,14 @@ virResctrlInfoDispose(void *obj)
if (resctrl->monitor_info)
g_strfreev(resctrl->monitor_info->features);
+ if (resctrl->perf_monitor_info)
+ g_strfreev(resctrl->perf_monitor_info->features);
+
virResctrlInfoMemBWFree(resctrl->membw_info);
g_free(resctrl->levels);
g_free(resctrl->monitor_info);
+ g_free(resctrl->perf_monitor_info);
}
@@ -771,6 +786,52 @@ virResctrlGetMonitorInfo(virResctrlInfo *resctrl)
}
+static int
+virResctrlGetPerfMonitorInfo(virResctrlInfo *resctrl)
+{
+ int rv = -1;
+ g_autofree char *featurestr = NULL;
+ g_autofree virResctrlInfoMongrp *info_monitor = NULL;
+
+ info_monitor = g_new0(virResctrlInfoMongrp, 1);
+
+ rv = virFileReadValueUint(&info_monitor->max_monitor,
+ SYSFS_RESCTRL_PATH
+ "/info/PERF_PKG_MON/num_rmids");
+ if (rv == -2) {
+ VIR_INFO("The file '" SYSFS_RESCTRL_PATH "/info/PERF_PKG_MON/num_rmids' "
+ "does not exist");
+ return 0;
+ } else if (rv < 0) {
+ return -1;
+ }
+
+ rv = virFileReadValueString(&featurestr,
+ SYSFS_RESCTRL_PATH
+ "/info/PERF_PKG_MON/mon_features");
+ if (rv == -2)
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Cannot get mon_features from resctrl PERF_PKG_MON"));
+ if (rv < 0)
+ return -1;
+
+ if (!*featurestr) {
+ VIR_WARN("Got empty feature list from PERF_PKG_MON; "
+ "AET energy monitoring will not be available");
+ return 0;
+ }
+
+ info_monitor->features = g_strsplit(featurestr, "\n", 0);
+ info_monitor->nfeatures = g_strv_length(info_monitor->features);
+ VIR_DEBUG("Resctrl supported %zd AET monitoring features",
+ info_monitor->nfeatures);
+
+ resctrl->perf_monitor_info = g_steal_pointer(&info_monitor);
+
+ return 0;
+}
+
+
static int
virResctrlGetInfo(virResctrlInfo *resctrl)
{
@@ -790,6 +851,9 @@ virResctrlGetInfo(virResctrlInfo *resctrl)
if ((ret = virResctrlGetMonitorInfo(resctrl)) < 0)
return -1;
+ if ((ret = virResctrlGetPerfMonitorInfo(resctrl)) < 0)
+ return -1;
+
return 0;
}
@@ -830,6 +894,9 @@ virResctrlInfoIsEmpty(virResctrlInfo *resctrl)
if (resctrl->monitor_info)
return false;
+ if (resctrl->perf_monitor_info)
+ return false;
+
for (i = 0; i < resctrl->nlevels; i++) {
virResctrlInfoPerLevel *i_level = resctrl->levels[i];
@@ -986,13 +1053,6 @@ virResctrlInfoGetMonitorPrefix(virResctrlInfo *resctrl,
if (virResctrlInfoIsEmpty(resctrl))
return 0;
- mongrp_info = resctrl->monitor_info;
-
- if (!mongrp_info) {
- VIR_INFO("Monitor is not supported in host");
- return 0;
- }
-
for (i = 0; i < VIR_RESCTRL_MONITOR_TYPE_LAST; i++) {
if (STREQ(prefix, virResctrlMonitorPrefixTypeToString(i))) {
mon = g_new0(virResctrlInfoMon, 1);
@@ -1008,6 +1068,19 @@ virResctrlInfoGetMonitorPrefix(virResctrlInfo *resctrl,
return -1;
}
+ if (mon->type == VIR_RESCTRL_MONITOR_TYPE_ENERGY)
+ mongrp_info = resctrl->perf_monitor_info;
+ else
+ mongrp_info = resctrl->monitor_info;
+
+ if (!mongrp_info) {
+ VIR_INFO("Monitor prefix '%s' is not supported in host", prefix);
+ virResctrlInfoMonFree(*monitor);
+ *monitor = NULL;
+ ret = 0;
+ goto cleanup;
+ }
+
mon->max_monitor = mongrp_info->max_monitor;
if (mon->type == VIR_RESCTRL_MONITOR_TYPE_CACHE) {
@@ -1018,8 +1091,12 @@ virResctrlInfoGetMonitorPrefix(virResctrlInfo *resctrl,
mon->features = g_new0(char *, mongrp_info->nfeatures + 1);
for (i = 0; i < mongrp_info->nfeatures; i++) {
- if (STRPREFIX(mongrp_info->features[i], prefix))
+ if (mon->type == VIR_RESCTRL_MONITOR_TYPE_ENERGY) {
+ if (g_strv_contains(virResctrlEnergyFeatures, mongrp_info->features[i]))
+ mon->features[mon->nfeatures++] = g_strdup(mongrp_info->features[i]);
+ } else if (STRPREFIX(mongrp_info->features[i], prefix)) {
mon->features[mon->nfeatures++] = g_strdup(mongrp_info->features[i]);
+ }
}
mon->features = g_renew(char *, mon->features, mon->nfeatures + 1);
@@ -2558,7 +2635,7 @@ virResctrlMonitorStatsSorter(const void *a,
* memory bandwidth usage data.
* @nstats: A size_t pointer to hold the returned array length of @stats
*
- * Get cache or memory bandwidth utilization information.
+ * Get cache, memory bandwidth or energy utilization information.
*
* Returns 0 on success, -1 on error.
*/
@@ -2593,6 +2670,7 @@ virResctrlMonitorGetStats(virResctrlMonitor *monitor,
while (virDirRead(dirp, &ent, datapath) > 0) {
g_autofree char *filepath = NULL;
char *node_id = NULL;
+ bool is_energy = false;
/* Looking for directory that contains resource utilization
* information file. The directory name is arranged in format
@@ -2605,18 +2683,17 @@ virResctrlMonitorGetStats(virResctrlMonitor *monitor,
if (!virFileIsDir(filepath))
continue;
- /* Looking for directory has a prefix 'mon_L' */
- if (!(node_id = STRSKIP(ent->d_name, "mon_L")))
- continue;
-
- /* Looking for directory has another '_' */
- node_id = strchr(node_id, '_');
- if (!node_id)
- continue;
-
- /* Skip the character '_' */
- if (!(node_id = STRSKIP(node_id, "_")))
+ if ((node_id = STRSKIP(ent->d_name, "mon_PERF_PKG_"))) {
+ is_energy = true;
+ } else if ((node_id = STRSKIP(ent->d_name, "mon_L"))) {
+ node_id = strchr(node_id, '_');
+ if (!node_id)
+ continue;
+ if (!(node_id = STRSKIP(node_id, "_")))
+ continue;
+ } else {
continue;
+ }
stat = g_new0(virResctrlMonitorStats, 1);
stat->features = g_new0(char *, nresources + 1);
@@ -2626,21 +2703,61 @@ virResctrlMonitorGetStats(virResctrlMonitor *monitor,
goto cleanup;
for (i = 0; resources[i]; i++) {
- rv = virFileReadValueUllong(&val, "%s/%s/%s", datapath,
- ent->d_name, resources[i]);
- if (rv == -2) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("File '%1$s/%2$s/%3$s' does not exist."),
- datapath, ent->d_name, resources[i]);
+ if (is_energy) {
+ g_autofree char *valstr = NULL;
+ double dval = 0.0;
+ char *endp = NULL;
+
+ rv = virFileReadValueString(&valstr, "%s/%s/%s", datapath,
+ ent->d_name, resources[i]);
+ if (rv == -2) {
+ if (i == 0)
+ break;
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("File '%1$s/%2$s/%3$s' does not exist."),
+ datapath, ent->d_name, resources[i]);
+ goto cleanup;
+ }
+ if (rv < 0)
+ goto cleanup;
+
+ g_strstrip(valstr);
+ errno = 0;
+ dval = g_ascii_strtod(valstr, &endp);
+ if (endp == valstr || *endp != '\0' || errno != 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Cannot parse resctrl monitor value '%1$s' from '%2$s/%3$s/%4$s'"),
+ valstr, datapath, ent->d_name, resources[i]);
+ goto cleanup;
+ }
+
+ VIR_APPEND_ELEMENT(stat->dvals, stat->ndvals, dval);
+ } else {
+ rv = virFileReadValueUllong(&val, "%s/%s/%s", datapath,
+ ent->d_name, resources[i]);
+ if (rv == -2) {
+ if (i == 0)
+ break;
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("File '%1$s/%2$s/%3$s' does not exist."),
+ datapath, ent->d_name, resources[i]);
+ goto cleanup;
+ }
+ if (rv < 0)
+ goto cleanup;
+
+ VIR_APPEND_ELEMENT(stat->vals, stat->nvals, val);
}
- if (rv < 0)
- goto cleanup;
-
- VIR_APPEND_ELEMENT(stat->vals, stat->nvals, val);
stat->features[i] = g_strdup(resources[i]);
}
+ if (resources[i]) {
+ virResctrlMonitorStatsFree(stat);
+ stat = NULL;
+ continue;
+ }
+
VIR_APPEND_ELEMENT(*stats, *nstats, stat);
}
@@ -2665,5 +2782,6 @@ virResctrlMonitorStatsFree(virResctrlMonitorStats *stat)
g_strfreev(stat->features);
g_free(stat->vals);
+ g_free(stat->dvals);
g_free(stat);
}
diff --git a/src/util/virresctrl.h b/src/util/virresctrl.h
index c70b112864..0f38db47cf 100644
--- a/src/util/virresctrl.h
+++ b/src/util/virresctrl.h
@@ -38,6 +38,7 @@ typedef enum {
VIR_RESCTRL_MONITOR_TYPE_UNSUPPORT,
VIR_RESCTRL_MONITOR_TYPE_CACHE,
VIR_RESCTRL_MONITOR_TYPE_MEMBW,
+ VIR_RESCTRL_MONITOR_TYPE_ENERGY,
VIR_RESCTRL_MONITOR_TYPE_LAST
} virResctrlMonitorType;
@@ -196,11 +197,18 @@ struct _virResctrlMonitorStats {
/* @features is a NULL terminal string list tracking the statistical record
* name.*/
char **features;
- /* @vals store the statistical record values and @val[0] is the value for
- * @features[0], @val[1] for@features[1] ... respectively */
+ /* @vals store the statistical record values for integer-valued resources
+ * (cache occupancy, memory bandwidth). Entries correspond 1:1 with
+ * @features; empty when the resource reports floating-point data. */
unsigned long long *vals;
/* The length of @vals array */
size_t nvals;
+ /* @dvals store double-precision values for floating-point resources
+ * (energy in Joules). Entries correspond 1:1 with
+ * @features; empty when the resource reports integer data. */
+ double *dvals;
+ /* The length of @dvals array */
+ size_t ndvals;
};
virResctrlMonitor *
diff --git a/tests/genericxml2xmlindata/energytune-basic.xml b/tests/genericxml2xmlindata/energytune-basic.xml
new file mode 100644
index 0000000000..4ee4bedb68
--- /dev/null
+++ b/tests/genericxml2xmlindata/energytune-basic.xml
@@ -0,0 +1,32 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>4</vcpu>
+ <cputune>
+ <energytune vcpus='0-1'>
+ <monitor vcpus='0-1'/>
+ </energytune>
+ <energytune vcpus='3'>
+ <monitor vcpus='3'/>
+ </energytune>
+ </cputune>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-i386</emulator>
+ <controller type='usb' index='0'/>
+ <controller type='ide' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/genericxml2xmltest.c b/tests/genericxml2xmltest.c
index 6be694cac5..bcc9b07a13 100644
--- a/tests/genericxml2xmltest.c
+++ b/tests/genericxml2xmltest.c
@@ -210,6 +210,7 @@ mymain(void)
DO_TEST("cachetune-small");
DO_TEST("cachetune-cdp");
DO_TEST("cachetune");
+ DO_TEST("energytune-basic");
DO_TEST_DIFFERENT("cachetune-extra-tunes");
DO_TEST_FAIL_INACTIVE("cachetune-colliding-allocs");
DO_TEST_FAIL_INACTIVE("cachetune-colliding-tunes");
--
2.34.1
---------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.
Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu ustawy z dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w transakcjach handlowych.
Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.
3
2