[libvirt] [PATCH] tests: enable virpolkittest on any ELF platform
by Pino Toscano
This tests uses preload, which should work on any ELF-based platform
(and indeed it passes on Linux, GNU/kFreeBSD, and FreeBSD).
Also remove the WITH_DBUS conditional, as the test is already built
based on that conditional.
---
tests/virpolkittest.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/virpolkittest.c b/tests/virpolkittest.c
index a51dd1c..4495c7c 100644
--- a/tests/virpolkittest.c
+++ b/tests/virpolkittest.c
@@ -22,7 +22,7 @@
#include "testutils.h"
-#if defined(WITH_DBUS) && defined(__linux__)
+#if defined(__ELF__)
# include <stdlib.h>
# include <dbus/dbus.h>
@@ -352,10 +352,10 @@ mymain(void)
VIRT_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virdbusmock.so")
-#else /* ! (WITH_DBUS && __linux__) */
+#else /* ! __ELF__ */
int
main(void)
{
return EXIT_AM_SKIP;
}
-#endif /* ! WITH_DBUS */
+#endif /* ! __ELF__ */
--
2.7.4
7 years, 11 months
[libvirt] [PATCH] docs: Update docs for recently added physical adjustments
by John Ferlan
Add the description for <physical>... One is a new feature - the API
and the other is an improvement for the volume xml output.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
I'll hold off pushing as trivial for a bit just in case the grammar/format
gestapo (Andrea) would like an adjustment ;-)
docs/news.html.in | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/docs/news.html.in b/docs/news.html.in
index c06153e..36c7d3d 100644
--- a/docs/news.html.in
+++ b/docs/news.html.in
@@ -32,6 +32,13 @@
adjusted during runtime using the admin interface without the
necessity of the daemon's restart
</li>
+ <li>storage: Add virStorageVolInfoFlags API<br/>
+ Add the API to support using the VIR_STORAGE_VOL_GET_PHYSICAL
+ flag in order to return the host physical size in bytes
+ of the image container in the allocation field of the
+ _virStorageVolInfo structure. The --physical flag has been
+ added to the virsh vol-info command to access the data
+ </li>
</ul>
</li>
<li><strong>Improvements</strong>
@@ -42,6 +49,10 @@
cpu cycles, stalled backend cpu cycles, and ref cpu
cycles by applications running on the platform
</li>
+ <li>conf: Display <physical> for volume xml<br/>
+ Add a display of the <physical> size of a disk
+ volume in the output of the volume XML
+ </li>
</ul>
</li>
<li><strong>Bug fixes</strong>
--
2.7.4
7 years, 11 months
[libvirt] [PATCH] Add domain event for metadata changes
by Daniel P. Berrange
When changing the metadata via virDomainSetMetadata, we now
emit an event to notify the app of changes. This is useful
when co-ordinating different applications read/write of
custom metadata.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
daemon/remote.c | 45 +++++++++++++++++++
examples/object-events/event-test.c | 35 +++++++++++++++
include/libvirt/libvirt-domain.h | 20 +++++++++
src/bhyve/bhyve_driver.c | 7 +++
src/conf/domain_event.c | 86 +++++++++++++++++++++++++++++++++++++
src/conf/domain_event.h | 10 +++++
src/libvirt_private.syms | 2 +
src/lxc/lxc_driver.c | 6 +++
src/qemu/qemu_driver.c | 6 +++
src/remote/remote_driver.c | 33 +++++++++++++-
src/remote/remote_protocol.x | 15 ++++++-
src/remote_protocol-structs | 7 +++
src/test/test_driver.c | 6 +++
tools/virsh-domain.c | 25 +++++++++++
14 files changed, 301 insertions(+), 2 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index 23c9de4..3d837d8 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -1223,6 +1223,50 @@ remoteRelayDomainEventDeviceRemovalFailed(virConnectPtr conn,
}
+static int
+remoteRelayDomainEventMetadataChange(virConnectPtr conn,
+ virDomainPtr dom,
+ int type,
+ const char *nsuri,
+ void *opaque)
+{
+ daemonClientEventCallbackPtr callback = opaque;
+ remote_domain_event_callback_metadata_change_msg data;
+ char **nsurip;
+
+ if (callback->callbackID < 0 ||
+ !remoteRelayDomainEventCheckACL(callback->client, conn, dom))
+ return -1;
+
+ VIR_DEBUG("Relaying domain metadata change %s %d %d %s, callback %d",
+ dom->name, dom->id, type, NULLSTR(nsuri), callback->callbackID);
+
+ /* build return data */
+ memset(&data, 0, sizeof(data));
+
+ data.type = type;
+ if (nsuri) {
+ if (VIR_ALLOC(nsurip) < 0)
+ return -1;
+ if (VIR_STRDUP(*nsurip, nsuri) < 0) {
+ VIR_FREE(nsurip);
+ return -1;
+ }
+ data.nsuri = nsurip;
+ }
+
+ make_nonnull_domain(&data.dom, dom);
+ data.callbackID = callback->callbackID;
+
+ remoteDispatchObjectEventSend(callback->client, remoteProgram,
+ REMOTE_PROC_DOMAIN_EVENT_CALLBACK_METADATA_CHANGE,
+ (xdrproc_t)xdr_remote_domain_event_callback_metadata_change_msg,
+ &data);
+
+ return 0;
+}
+
+
static virConnectDomainEventGenericCallback domainEventCallbacks[] = {
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventLifecycle),
@@ -1248,6 +1292,7 @@ static virConnectDomainEventGenericCallback domainEventCallbacks[] = {
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventMigrationIteration),
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventJobCompleted),
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventDeviceRemovalFailed),
+ VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventMetadataChange),
};
verify(ARRAY_CARDINALITY(domainEventCallbacks) == VIR_DOMAIN_EVENT_ID_LAST);
diff --git a/examples/object-events/event-test.c b/examples/object-events/event-test.c
index 730cb8b..f2316d7 100644
--- a/examples/object-events/event-test.c
+++ b/examples/object-events/event-test.c
@@ -917,6 +917,40 @@ myDomainEventDeviceRemovalFailedCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
}
+static const char *
+metadataTypeToStr(int status)
+{
+ switch ((virDomainMetadataType) status) {
+ case VIR_DOMAIN_METADATA_DESCRIPTION:
+ return "description";
+
+ case VIR_DOMAIN_METADATA_TITLE:
+ return "title";
+
+ case VIR_DOMAIN_METADATA_ELEMENT:
+ return "element";
+
+ case VIR_DOMAIN_METADATA_LAST:
+ break;
+ }
+
+ return "unknown";
+}
+
+static int
+myDomainEventMetadataChangeCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
+ virDomainPtr dom,
+ int type,
+ const char *nsuri,
+ void *opaque ATTRIBUTE_UNUSED)
+{
+ const char *typestr = metadataTypeToStr(type);
+ printf("%s EVENT: Domain %s(%d) metadata type: %s (%s)\n",
+ __func__, virDomainGetName(dom), virDomainGetID(dom), typestr, nsuri ? nsuri : "n/a");
+ return 0;
+}
+
+
static void
myFreeFunc(void *opaque)
@@ -971,6 +1005,7 @@ struct domainEventData domainEvents[] = {
DOMAIN_EVENT(VIR_DOMAIN_EVENT_ID_MIGRATION_ITERATION, myDomainEventMigrationIterationCallback),
DOMAIN_EVENT(VIR_DOMAIN_EVENT_ID_JOB_COMPLETED, myDomainEventJobCompletedCallback),
DOMAIN_EVENT(VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED, myDomainEventDeviceRemovalFailedCallback),
+ DOMAIN_EVENT(VIR_DOMAIN_EVENT_ID_METADATA_CHANGE, myDomainEventMetadataChangeCallback),
};
struct storagePoolEventData {
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index 6362947..e303140 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -3770,6 +3770,25 @@ typedef void (*virConnectDomainEventDeviceRemovalFailedCallback)(virConnectPtr c
const char *devAlias,
void *opaque);
+/**
+ * virConnectDomainEventMetadataChangeCallback:
+ * @conn: connection object
+ * @dom: domain on which the event occurred
+ * @type: a value from virDomainMetadataTypea
+ * @nsuri: XML namespace URI
+ * @opaque: application specified data
+ *
+ * This callback is triggered when the domain XML metadata is changed
+ *
+ * The callback signature to use when registering for an event of type
+ * VIR_DOMAIN_EVENT_ID_METADATA_CHANGE with virConnectDomainEventRegisterAny().
+ */
+typedef void (*virConnectDomainEventMetadataChangeCallback)(virConnectPtr conn,
+ virDomainPtr dom,
+ int type,
+ const char *nsuri,
+ void *opaque);
+
/**
* virConnectDomainEventMigrationIterationCallback:
@@ -4195,6 +4214,7 @@ typedef enum {
VIR_DOMAIN_EVENT_ID_MIGRATION_ITERATION = 20, /* virConnectDomainEventMigrationIterationCallback */
VIR_DOMAIN_EVENT_ID_JOB_COMPLETED = 21, /* virConnectDomainEventJobCompletedCallback */
VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED = 22, /* virConnectDomainEventDeviceRemovalFailedCallback */
+ VIR_DOMAIN_EVENT_ID_METADATA_CHANGE = 23, /* virConnectDomainEventMetadataChangeCallback */
# ifdef VIR_ENUM_SENTINELS
VIR_DOMAIN_EVENT_ID_LAST
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index 17f8524..e42ec47 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -1124,6 +1124,13 @@ bhyveDomainSetMetadata(virDomainPtr dom,
privconn->xmlopt, BHYVE_STATE_DIR,
BHYVE_CONFIG_DIR, flags);
+ if (ret == 0) {
+ virObjectEventPtr ev = NULL;
+ ev = virDomainEventMetadataChangeNewFromObj(vm, type, uri);
+ virObjectEventStateQueue(privconn->domainEventState, ev);
+ }
+
+
cleanup:
virObjectUnref(caps);
virObjectUnlock(vm);
diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index 63ae9e1..da503f3 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
@@ -59,6 +59,7 @@ static virClassPtr virDomainEventDeviceAddedClass;
static virClassPtr virDomainEventMigrationIterationClass;
static virClassPtr virDomainEventJobCompletedClass;
static virClassPtr virDomainEventDeviceRemovalFailedClass;
+static virClassPtr virDomainEventMetadataChangeClass;
static void virDomainEventDispose(void *obj);
static void virDomainEventLifecycleDispose(void *obj);
@@ -79,6 +80,7 @@ static void virDomainEventDeviceAddedDispose(void *obj);
static void virDomainEventMigrationIterationDispose(void *obj);
static void virDomainEventJobCompletedDispose(void *obj);
static void virDomainEventDeviceRemovalFailedDispose(void *obj);
+static void virDomainEventMetadataChangeDispose(void *obj);
static void
virDomainEventDispatchDefaultFunc(virConnectPtr conn,
@@ -266,6 +268,15 @@ struct _virDomainEventDeviceRemovalFailed {
typedef struct _virDomainEventDeviceRemovalFailed virDomainEventDeviceRemovalFailed;
typedef virDomainEventDeviceRemovalFailed *virDomainEventDeviceRemovalFailedPtr;
+struct _virDomainEventMetadataCange {
+ virDomainEvent parent;
+
+ int type;
+ char *nsuri;
+};
+typedef struct _virDomainEventMetadataCange virDomainEventMetadataChange;
+typedef virDomainEventMetadataChange *virDomainEventMetadataChangePtr;
+
static int
@@ -385,6 +396,12 @@ virDomainEventsOnceInit(void)
sizeof(virDomainEventDeviceRemovalFailed),
virDomainEventDeviceRemovalFailedDispose)))
return -1;
+ if (!(virDomainEventMetadataChangeClass =
+ virClassNew(virDomainEventClass,
+ "virDomainEventMetadataChange",
+ sizeof(virDomainEventMetadataChange),
+ virDomainEventMetadataChangeDispose)))
+ return -1;
return 0;
}
@@ -573,6 +590,16 @@ virDomainEventJobCompletedDispose(void *obj)
}
+static void
+virDomainEventMetadataChangeDispose(void *obj)
+{
+ virDomainEventMetadataChangePtr event = obj;
+ VIR_DEBUG("obj=%p", event);
+
+ VIR_FREE(event->nsuri);
+}
+
+
static void *
virDomainEventNew(virClassPtr klass,
int eventID,
@@ -1600,6 +1627,53 @@ virDomainEventTunableNewFromDom(virDomainPtr dom,
}
+static virObjectEventPtr
+virDomainEventMetadataChangeNew(int id,
+ const char *name,
+ unsigned char *uuid,
+ int type,
+ const char *nsuri)
+{
+ virDomainEventMetadataChangePtr ev;
+
+ if (virDomainEventsInitialize() < 0)
+ return NULL;
+
+ if (!(ev = virDomainEventNew(virDomainEventMetadataChangeClass,
+ VIR_DOMAIN_EVENT_ID_METADATA_CHANGE,
+ id, name, uuid)))
+ return NULL;
+
+ ev->type = type;
+ if (nsuri && VIR_STRDUP(ev->nsuri, nsuri) < 0)
+ goto error;
+
+ return (virObjectEventPtr)ev;
+
+ error:
+ virObjectUnref(ev);
+ return NULL;
+}
+
+virObjectEventPtr
+virDomainEventMetadataChangeNewFromObj(virDomainObjPtr obj,
+ int type,
+ const char *nsuri)
+{
+ return virDomainEventMetadataChangeNew(obj->def->id, obj->def->name,
+ obj->def->uuid, type, nsuri);
+}
+
+virObjectEventPtr
+virDomainEventMetadataChangeNewFromDom(virDomainPtr dom,
+ int type,
+ const char *nsuri)
+{
+ return virDomainEventMetadataChangeNew(dom->id, dom->name, dom->uuid,
+ type, nsuri);
+}
+
+
static void
virDomainEventDispatchDefaultFunc(virConnectPtr conn,
virObjectEventPtr event,
@@ -1857,6 +1931,18 @@ virDomainEventDispatchDefaultFunc(virConnectPtr conn,
goto cleanup;
}
+ case VIR_DOMAIN_EVENT_ID_METADATA_CHANGE:
+ {
+ virDomainEventMetadataChangePtr metadataChangeEvent;
+
+ metadataChangeEvent = (virDomainEventMetadataChangePtr)event;
+ ((virConnectDomainEventMetadataChangeCallback)cb)(conn, dom,
+ metadataChangeEvent->type,
+ metadataChangeEvent->nsuri,
+ 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 54fa879..1933f47 100644
--- a/src/conf/domain_event.h
+++ b/src/conf/domain_event.h
@@ -234,6 +234,16 @@ virDomainEventJobCompletedNewFromDom(virDomainPtr dom,
virTypedParameterPtr params,
int nparams);
+virObjectEventPtr
+virDomainEventMetadataChangeNewFromObj(virDomainObjPtr obj,
+ int type,
+ const char *nsuri);
+
+virObjectEventPtr
+virDomainEventMetadataChangeNewFromDom(virDomainPtr dom,
+ int type,
+ const char *nsuri);
+
int
virDomainEventStateRegister(virConnectPtr conn,
virObjectEventStatePtr state,
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 2d23e46..3b8d227 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -558,6 +558,8 @@ virDomainEventLifecycleNew;
virDomainEventLifecycleNewFromDef;
virDomainEventLifecycleNewFromDom;
virDomainEventLifecycleNewFromObj;
+virDomainEventMetadataChangeNewFromDom;
+virDomainEventMetadataChangeNewFromObj;
virDomainEventMigrationIterationNewFromDom;
virDomainEventMigrationIterationNewFromObj;
virDomainEventPMSuspendDiskNewFromDom;
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index a7bc9f0..04a4b8c 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -5379,6 +5379,12 @@ lxcDomainSetMetadata(virDomainPtr dom,
driver->xmlopt, cfg->stateDir,
cfg->configDir, flags);
+ if (ret == 0) {
+ virObjectEventPtr ev = NULL;
+ ev = virDomainEventMetadataChangeNewFromObj(vm, type, uri);
+ virObjectEventStateQueue(driver->domainEventState, ev);
+ }
+
virLXCDomainObjEndJob(driver, vm);
cleanup:
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b359e77..2c9ef95 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18069,6 +18069,12 @@ qemuDomainSetMetadata(virDomainPtr dom,
driver->xmlopt, cfg->stateDir,
cfg->configDir, flags);
+ if (ret == 0) {
+ virObjectEventPtr ev = NULL;
+ ev = virDomainEventMetadataChangeNewFromObj(vm, type, uri);
+ qemuDomainEventQueue(driver, ev);
+ }
+
qemuDomainObjEndJob(driver, vm);
cleanup:
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 46da06f..c161a56 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -355,6 +355,11 @@ remoteDomainBuildEventCallbackJobCompleted(virNetClientProgramPtr prog,
void *evdata, void *opaque);
static void
+remoteDomainBuildEventCallbackMetadataChange(virNetClientProgramPtr prog,
+ virNetClientPtr client,
+ void *evdata, void *opaque);
+
+static void
remoteNetworkBuildEventLifecycle(virNetClientProgramPtr prog ATTRIBUTE_UNUSED,
virNetClientPtr client ATTRIBUTE_UNUSED,
void *evdata, void *opaque);
@@ -558,6 +563,10 @@ static virNetClientProgramEvent remoteEvents[] = {
remoteDomainBuildEventCallbackDeviceRemovalFailed,
sizeof(remote_domain_event_callback_device_removal_failed_msg),
(xdrproc_t)xdr_remote_domain_event_callback_device_removal_failed_msg },
+ { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_METADATA_CHANGE,
+ remoteDomainBuildEventCallbackMetadataChange,
+ sizeof(remote_domain_event_callback_metadata_change_msg),
+ (xdrproc_t)xdr_remote_domain_event_callback_metadata_change_msg },
{ REMOTE_PROC_STORAGE_POOL_EVENT_LIFECYCLE,
remoteStoragePoolBuildEventLifecycle,
sizeof(remote_storage_pool_event_lifecycle_msg),
@@ -5121,7 +5130,7 @@ remoteDomainBuildEventCallbackDeviceRemovalFailed(virNetClientProgramPtr prog AT
void *evdata, void *opaque)
{
virConnectPtr conn = opaque;
- remote_domain_event_callback_device_added_msg *msg = evdata;
+ remote_domain_event_callback_device_removal_failed_msg *msg = evdata;
struct private_data *priv = conn->privateData;
virDomainPtr dom;
virObjectEventPtr event = NULL;
@@ -5249,6 +5258,28 @@ remoteDomainBuildEventCallbackJobCompleted(virNetClientProgramPtr prog ATTRIBUTE
static void
+remoteDomainBuildEventCallbackMetadataChange(virNetClientProgramPtr prog ATTRIBUTE_UNUSED,
+ virNetClientPtr client ATTRIBUTE_UNUSED,
+ void *evdata, void *opaque)
+{
+ virConnectPtr conn = opaque;
+ remote_domain_event_callback_metadata_change_msg *msg = evdata;
+ struct private_data *priv = conn->privateData;
+ virDomainPtr dom;
+ virObjectEventPtr event = NULL;
+
+ if (!(dom = get_nonnull_domain(conn, msg->dom)))
+ return;
+
+ event = virDomainEventMetadataChangeNewFromDom(dom, msg->type, msg->nsuri ? *msg->nsuri : NULL);
+
+ virObjectUnref(dom);
+
+ remoteEventQueue(priv, event, msg->callbackID);
+}
+
+
+static void
remoteNetworkBuildEventLifecycle(virNetClientProgramPtr prog ATTRIBUTE_UNUSED,
virNetClientPtr client ATTRIBUTE_UNUSED,
void *evdata, void *opaque)
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index b846ef2..f268e1c 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -3353,6 +3353,13 @@ struct remote_domain_set_guest_vcpus_args {
};
+struct remote_domain_event_callback_metadata_change_msg {
+ int callbackID;
+ remote_nonnull_domain dom;
+ int type;
+ remote_string nsuri;
+};
+
/*----- Protocol. -----*/
/* Define the program number, protocol version and procedure numbers here. */
@@ -5952,5 +5959,11 @@ enum remote_procedure {
* @priority: high
* @acl: storage_vol:read
*/
- REMOTE_PROC_STORAGE_VOL_GET_INFO_FLAGS = 378
+ REMOTE_PROC_STORAGE_VOL_GET_INFO_FLAGS = 378,
+
+ /**
+ * @generate: both
+ * @acl: none
+ */
+ REMOTE_PROC_DOMAIN_EVENT_CALLBACK_METADATA_CHANGE = 379
};
diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
index 41bc3bd..2fc9e46 100644
--- a/src/remote_protocol-structs
+++ b/src/remote_protocol-structs
@@ -2800,6 +2800,12 @@ struct remote_domain_set_guest_vcpus_args {
int state;
u_int flags;
};
+struct remote_domain_event_callback_metadata_change_msg {
+ int callbackID;
+ remote_nonnull_domain dom;
+ int type;
+ remote_string nsuri
+};
enum remote_procedure {
REMOTE_PROC_CONNECT_OPEN = 1,
REMOTE_PROC_CONNECT_CLOSE = 2,
@@ -3179,4 +3185,5 @@ enum remote_procedure {
REMOTE_PROC_NODE_DEVICE_EVENT_LIFECYCLE = 376,
REMOTE_PROC_NODE_DEVICE_EVENT_UPDATE = 377,
REMOTE_PROC_STORAGE_VOL_GET_INFO_FLAGS = 378,
+ REMOTE_PROC_DOMAIN_EVENT_CALLBACK_METADATA_CHANGE = 379,
};
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index de92a01..6820298 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -2721,6 +2721,12 @@ static int testDomainSetMetadata(virDomainPtr dom,
privconn->caps, privconn->xmlopt,
NULL, NULL, flags);
+ if (ret == 0) {
+ virObjectEventPtr ev = NULL;
+ ev = virDomainEventMetadataChangeNewFromObj(privdom, type, uri);
+ testObjectEventQueue(privconn, ev);
+ }
+
virDomainObjEndAPI(&privdom);
return ret;
}
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 3a6fa5c..f8f5d9c 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -12750,6 +12750,29 @@ virshEventDeviceRemovalFailedPrint(virConnectPtr conn ATTRIBUTE_UNUSED,
virshEventPrint(opaque, &buf);
}
+VIR_ENUM_DECL(virshEventMetadataChangeType)
+VIR_ENUM_IMPL(virshEventMetadataChangeType,
+ VIR_DOMAIN_METADATA_LAST,
+ N_("description"),
+ N_("title"),
+ N_("element"))
+
+static void
+virshEventMetadataChangePrint(virConnectPtr conn ATTRIBUTE_UNUSED,
+ virDomainPtr dom,
+ int type,
+ const char *nsuri,
+ void *opaque)
+{
+ virBuffer buf = VIR_BUFFER_INITIALIZER;
+
+ virBufferAsprintf(&buf, _("event 'metdata-change' for domain %s: %s %s\n"),
+ virDomainGetName(dom),
+ UNKNOWNSTR(virshEventMetadataChangeTypeTypeToString(type)),
+ NULLSTR(nsuri));
+ virshEventPrint(opaque, &buf);
+}
+
static vshEventCallback vshEventCallbacks[] = {
{ "lifecycle",
@@ -12796,6 +12819,8 @@ static vshEventCallback vshEventCallbacks[] = {
VIR_DOMAIN_EVENT_CALLBACK(virshEventJobCompletedPrint), },
{ "device-removal-failed",
VIR_DOMAIN_EVENT_CALLBACK(virshEventDeviceRemovalFailedPrint), },
+ { "metadata-change",
+ VIR_DOMAIN_EVENT_CALLBACK(virshEventMetadataChangePrint), },
};
verify(VIR_DOMAIN_EVENT_ID_LAST == ARRAY_CARDINALITY(vshEventCallbacks));
--
2.9.3
7 years, 11 months
[libvirt] [PATCH 0/2] m4: Small cleanups
by Andrea Bolognani
Andrea Bolognani (2):
m4/virt-arg: Move LIBVIRT_ARG_* macros to their own file
m4/virt-arg: Rename LIBVIRT_ARG_WITH* macros
configure.ac | 16 ++---
m4/virt-apparmor.m4 | 4 +-
m4/virt-arg.m4 | 154 ++++++++++++++++++++++++++++++++++++++++++
m4/virt-attr.m4 | 2 +-
m4/virt-audit.m4 | 2 +-
m4/virt-avahi.m4 | 2 +-
m4/virt-blkid.m4 | 2 +-
m4/virt-capng.m4 | 2 +-
m4/virt-chrdev-lock-files.m4 | 8 +--
m4/virt-curl.m4 | 2 +-
m4/virt-dbus.m4 | 2 +-
m4/virt-default-editor.m4 | 4 +-
m4/virt-driver-bhyve.m4 | 2 +-
m4/virt-driver-esx.m4 | 2 +-
m4/virt-driver-hyperv.m4 | 2 +-
m4/virt-driver-interface.m4 | 2 +-
m4/virt-driver-libvirtd.m4 | 2 +-
m4/virt-driver-libxl.m4 | 2 +-
m4/virt-driver-lxc.m4 | 2 +-
m4/virt-driver-modules.m4 | 4 +-
m4/virt-driver-network.m4 | 2 +-
m4/virt-driver-openvz.m4 | 2 +-
m4/virt-driver-phyp.m4 | 2 +-
m4/virt-driver-qemu.m4 | 10 +--
m4/virt-driver-remote.m4 | 2 +-
m4/virt-driver-test.m4 | 2 +-
m4/virt-driver-uml.m4 | 2 +-
m4/virt-driver-vbox.m4 | 2 +-
m4/virt-driver-vmware.m4 | 2 +-
m4/virt-driver-vz.m4 | 2 +-
m4/virt-driver-xen.m4 | 4 +-
m4/virt-driver-xenapi.m4 | 2 +-
m4/virt-dtrace.m4 | 2 +-
m4/virt-firewalld.m4 | 2 +-
m4/virt-fuse.m4 | 2 +-
m4/virt-gluster.m4 | 2 +-
m4/virt-gnutls.m4 | 2 +-
m4/virt-hal.m4 | 2 +-
m4/virt-host-validate.m4 | 2 +-
m4/virt-init-script.m4 | 6 +-
m4/virt-lib.m4 | 124 ----------------------------------
m4/virt-libpcap.m4 | 2 +-
m4/virt-libssh.m4 | 2 +-
m4/virt-libxml.m4 | 2 +-
m4/virt-loader-nvram.m4 | 8 +--
m4/virt-login-shell.m4 | 2 +-
m4/virt-macvtap.m4 | 2 +-
m4/virt-netcf.m4 | 2 +-
m4/virt-nss.m4 | 6 +-
m4/virt-numactl.m4 | 2 +-
m4/virt-numad.m4 | 4 +-
m4/virt-openwsman.m4 | 2 +-
m4/virt-pciaccess.m4 | 2 +-
m4/virt-pm-utils.m4 | 2 +-
m4/virt-polkit.m4 | 4 +-
m4/virt-readline.m4 | 2 +-
m4/virt-sanlock.m4 | 2 +-
m4/virt-sasl.m4 | 2 +-
m4/virt-secdriver-apparmor.m4 | 4 +-
m4/virt-secdriver-selinux.m4 | 2 +-
m4/virt-selinux.m4 | 4 +-
m4/virt-ssh2.m4 | 2 +-
m4/virt-storage-dir.m4 | 2 +-
m4/virt-storage-disk.m4 | 4 +-
m4/virt-storage-fs.m4 | 4 +-
m4/virt-storage-gluster.m4 | 4 +-
m4/virt-storage-iscsi.m4 | 4 +-
m4/virt-storage-lvm.m4 | 2 +-
m4/virt-storage-mpath.m4 | 4 +-
m4/virt-storage-rbd.m4 | 4 +-
m4/virt-storage-scsi.m4 | 2 +-
m4/virt-storage-sheepdog.m4 | 4 +-
m4/virt-storage-zfs.m4 | 2 +-
m4/virt-sysctl.m4 | 2 +-
m4/virt-tls-priority.m4 | 6 +-
m4/virt-udev.m4 | 2 +-
m4/virt-virtualport.m4 | 2 +-
m4/virt-wireshark.m4 | 8 +--
m4/virt-xml-catalog.m4 | 6 +-
m4/virt-yajl.m4 | 2 +-
80 files changed, 275 insertions(+), 245 deletions(-)
create mode 100644 m4/virt-arg.m4
--
2.7.4
7 years, 11 months
[libvirt] [PATCH] m4/virt-gnutls: properly backup CFLAGS and LIBS for AC_CHECK_* macros
by Pavel Hrdina
Commit 943ddcb7120 partially fixed this bug in gnutls configure code.
However we also need to backup and modify CFLAGS and do if for
AC_CHECK_HEADERS as well.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
Pushed under build breaker rule.
m4/virt-gnutls.m4 | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/m4/virt-gnutls.m4 b/m4/virt-gnutls.m4
index 77122c1202..37adad85d8 100644
--- a/m4/virt-gnutls.m4
+++ b/m4/virt-gnutls.m4
@@ -54,15 +54,18 @@ AC_DEFUN([LIBVIRT_CHECK_GNUTLS],[
[set to 1 if it is known or assumed that GNUTLS uses gcrypt])
fi
+ OLD_CFLAGS="$CFLAGS"
+ OLD_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $GNUTLS_CFLAGS"
+ LIBS="$LIBS $GNUTLS_LIBS"
AC_CHECK_HEADERS([gnutls/crypto.h], [], [], [[
#include <gnutls/gnutls.h>
]])
- OLD_LIBS="$LIBS"
- LIBS="$LIBS $GNUTLS_LIBS"
AC_CHECK_FUNCS([gnutls_rnd])
AC_CHECK_FUNCS([gnutls_cipher_encrypt])
- LIBS=$OLD_LIBS
+ CFLAGS="$OLD_CFLAGS"
+ LIBS="$OLD_LIBS"
fi
])
--
2.11.0
7 years, 11 months
[libvirt] [PATCH] m4/virt-lib: use correct format of package name for AC_ARG_* macros
by Pavel Hrdina
Introduced by commit 25034b3c40 and reused by commit 4519e94b743.
This patch silences warning printed by configure:
configure: WARNING: unrecognized options: --with-qemu-user
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
m4/virt-lib.m4 | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/m4/virt-lib.m4 b/m4/virt-lib.m4
index 5c3fde258e..031f8890c0 100644
--- a/m4/virt-lib.m4
+++ b/m4/virt-lib.m4
@@ -414,7 +414,7 @@ AC_DEFUN([LIBVIRT_ARG_WITH], [
m4_pushdef([version_text], m4_ifnblank(min_version, [[ (>= ]]min_version[[)]]))
m4_divert_text([DEFAULTS], [with_var][[=]][default_action])
- AC_ARG_WITH([check_name_dash],
+ AC_ARG_WITH([check_name_lc],
[AS_HELP_STRING([[--]arg_var],
[with ]]m4_dquote(help_name)m4_dquote(version_text)[[ support @<:@default=]]m4_dquote(default_action)[[@:>@])])
@@ -456,7 +456,7 @@ AC_DEFUN([LIBVIRT_ARG_WITH_ALT], [
m4_pushdef([with_var], [with_]check_name_lc)
m4_divert_text([DEFAULTS], [with_var][[=]][default_action])
- AC_ARG_WITH([check_name_dash],
+ AC_ARG_WITH([check_name_lc],
[AS_HELP_STRING([[--]arg_var],
]m4_dquote(help_desc)[[ @<:@default=]]m4_dquote(default_action)[[@:>@])])
@@ -494,7 +494,7 @@ AC_DEFUN([LIBVIRT_ARG_ENABLE], [
m4_pushdef([enable_var], [enable_]check_name_lc)
m4_divert_text([DEFAULTS], [enable_var][[=]][default_action])
- AC_ARG_ENABLE([check_name_dash],
+ AC_ARG_ENABLE([check_name_lc],
[AS_HELP_STRING([[--]arg_var],
]m4_dquote(help_desc)[[ @<:@default=]]m4_dquote(default_action)[[@:>@])])
--
2.11.0
7 years, 11 months
[libvirt] [PATCH] NEWS: Update after virtio console on ppc64 fix
by Andrea Bolognani
---
docs/news.html.in | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/docs/news.html.in b/docs/news.html.in
index 5a34674..5eea24f 100644
--- a/docs/news.html.in
+++ b/docs/news.html.in
@@ -52,6 +52,10 @@
for a qcow2 file backed storage that hasn't yet been opened on
the domain
</li>
+ <li>qemu: Make virtio console usable on ppc64 guests<br/>
+ The chardev detection code has been improved and can now handle this
+ configuration properly.
+ </li>
</ul>
</li>
</ul>
--
2.7.4
7 years, 11 months
[libvirt] [PATCH] domain_conf: set ifname for ovs vhostuser ifname
by Mehdi Abaakouk
Hi,
This is the followup of '[PATCH v3 4/4] domain_conf: autodetect vhostuser
ifname'.
I have rewritten a better version that shouldn't have the same concern as
before.
I have isolated the code that detects the ifname in util/virnetdevopenvswitch.c
in a new helper function virNetDevOpenvswitchGetVhostuserIfname(). Unlike the
previous version, it returns a ifname only if the vhostuser interface is
handled by openswitch. So, if the vhostuser is not handled by openvswitch, the
ifname stay NULL.
Now, virDomainNetDefParseXML() only calls this function, it does nothing else now.
Cheers,
Mehdi Abaakouk (1):
domain_conf: set ifname for ovs vhostuser ifname
src/conf/domain_conf.c | 5 +++++
src/libvirt_private.syms | 1 +
src/util/virnetdevopenvswitch.c | 41 +++++++++++++++++++++++++++++++++++++++++
src/util/virnetdevopenvswitch.h | 3 +++
4 files changed, 50 insertions(+)
--
2.10.2
7 years, 11 months
[libvirt] [PATCH] m4/virt-gnutls: use AC_CHECK_FUNCS to detect availability of functions
by Pavel Hrdina
Sigh, autoconf has AC_CHECK_FUNC and AC_CHECK_FUNCS and both check
whether some function exists or not. However in addition to the obvious
difference that the later is able to check multiple functions it also
defines HAVE_FUNCTION_NAME for each function.
Commit 680d2f49da moved the code to separate file, but also blindly
changed the macro to AC_CHECK_FUNC without confronting the
documentation.
Reported-by: John Ferlan <jferlan(a)redhat.com>
<https://www.redhat.com/archives/libvir-list/2016-December/msg01086.html>
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
m4/virt-gnutls.m4 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/m4/virt-gnutls.m4 b/m4/virt-gnutls.m4
index bd861eec5f..77122c1202 100644
--- a/m4/virt-gnutls.m4
+++ b/m4/virt-gnutls.m4
@@ -60,8 +60,8 @@ AC_DEFUN([LIBVIRT_CHECK_GNUTLS],[
OLD_LIBS="$LIBS"
LIBS="$LIBS $GNUTLS_LIBS"
- AC_CHECK_FUNC([gnutls_rnd])
- AC_CHECK_FUNC([gnutls_cipher_encrypt])
+ AC_CHECK_FUNCS([gnutls_rnd])
+ AC_CHECK_FUNCS([gnutls_cipher_encrypt])
LIBS=$OLD_LIBS
fi
])
--
2.11.0
7 years, 11 months
[libvirt] [PATCH 0/2] configure gnutls cleanup
by Pavel Hrdina
Pavel Hrdina (2):
configure: move gnutls check into virt-gnutls.m4
m4/virt-gnutls: remove code for gnutls < 2.2.0
configure.ac | 109 +-----------------------------------------------------
m4/virt-gnutls.m4 | 62 +++++++++++++++++++++++++++++++
2 files changed, 64 insertions(+), 107 deletions(-)
create mode 100644 m4/virt-gnutls.m4
--
2.10.1
7 years, 11 months