[libvirt] [PATCH 0/3] Drop some useless CPU code
by Jiri Denemark
Jiri Denemark (3):
cpu: Consolidate ARM drivers
cpu: Drop generic driver
cpu: Drop NR_DRIVERS macro
po/POTFILES.in | 1 -
src/Makefile.am | 2 -
src/cpu/cpu.c | 16 ++--
src/cpu/cpu_aarch64.c | 133 -----------------------------
src/cpu/cpu_aarch64.h | 31 -------
src/cpu/cpu_arm.c | 37 +++++----
src/cpu/cpu_generic.c | 226 --------------------------------------------------
src/cpu/cpu_generic.h | 32 -------
8 files changed, 26 insertions(+), 452 deletions(-)
delete mode 100644 src/cpu/cpu_aarch64.c
delete mode 100644 src/cpu/cpu_aarch64.h
delete mode 100644 src/cpu/cpu_generic.c
delete mode 100644 src/cpu/cpu_generic.h
--
2.9.0
8 years, 6 months
[libvirt] [PATCH v2 1/1] cpu_map.xml: add cmt/mbm feature to x86
by Qiaowei Ren
Some Intel processor families (e.g. the Intel Xeon processor E5 v3
family) introduced some PQos (Platform Qos) features, including CMT
(Cache Monitoring technology) and MBM (Memory Bandwidth Monitoring),
to monitor or control shared resource. This patch add them into x86
part of cpu_map.xml to be used for applications based on libvirt to
get cpu capabilities. For example, Nova in OpenStack schedules guests
based on the CPU features that the host has.
Signed-off-by: Qiaowei Ren <qiaowei.ren(a)intel.com>
---
src/cpu/cpu_map.xml | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
index bf2dfc6..6da8321 100644
--- a/src/cpu/cpu_map.xml
+++ b/src/cpu/cpu_map.xml
@@ -224,6 +224,9 @@
<feature name='rtm'>
<cpuid eax_in='0x07' ebx='0x00000800'/>
</feature>
+ <feature name='cmt'>
+ <cpuid eax_in='0x07' ebx='0x00001000'/>
+ </feature>
<feature name='mpx'>
<cpuid eax_in='0x07' ebx='0x00004000'/>
</feature>
@@ -266,6 +269,14 @@
<cpuid eax_in='0x0d' ecx_in='0x01' eax='0x00000008'/>
</feature>
+ <!-- cpuid level 0x0000000f:1 (edx) -->
+ <feature name='mbm_total'> <!-- LLC Total MBM monitoring -->
+ <cpuid eax_in='0x0f' ecx_in='0x01' edx='0x00000002'/>
+ </feature>
+ <feature name='mbm_local'> <!-- LLC Local MBM monitoring -->
+ <cpuid eax_in='0x0f' ecx_in='0x01' edx='0x00000004'/>
+ </feature>
+
<!-- extended features, EDX -->
<feature name='syscall'> <!-- CPUID_EXT2_SYSCALL -->
<cpuid eax_in='0x80000001' edx='0x00000800'/>
--
1.9.1
8 years, 6 months
[libvirt] Plans for next release 2.0.0
by Daniel Veillard
So based on the new numbering scheme we should push 2.0.0 at the
end of the month. Due to travel and move, I am tempted to enter the
freeze on next Sunday (or Monday) to try to push for the release on
Friday 1st or the week-end.
Hope this works for everyone,
Daniel
--
Daniel Veillard | Open Source and Standards, Red Hat
veillard(a)redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | virtualization library http://libvirt.org/
8 years, 6 months
[libvirt] [PATCH] util: fix build in virNetDevTapGetRealDeviceName
by Roman Bogorodskiy
Commit e81de04c switched virNetDevTapGetRealDeviceName() to use
virDirOpen() instead of opendir(), however it mistakenly dropped
DIR *dirp declaration, so restore that to fix build.
---
Pushed under the build-breaker rule.
src/util/virnetdevtap.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c
index 98e27bb..7488a4c 100644
--- a/src/util/virnetdevtap.c
+++ b/src/util/virnetdevtap.c
@@ -95,6 +95,7 @@ virNetDevTapGetRealDeviceName(char *ifname ATTRIBUTE_UNUSED)
#ifdef TAPGIFNAME
char *ret = NULL;
struct dirent *dp;
+ DIR *dirp = NULL;
char *devpath = NULL;
int fd;
--
2.7.4
8 years, 6 months
[libvirt] [PATCH python] Add support for storage pool refesh callback
by Daniel P. Berrange
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
examples/event-test.py | 6 ++++-
libvirt-override-virConnect.py | 10 ++++++++
libvirt-override.c | 54 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 69 insertions(+), 1 deletion(-)
diff --git a/examples/event-test.py b/examples/event-test.py
index 241369b..f0341b5 100755
--- a/examples/event-test.py
+++ b/examples/event-test.py
@@ -572,7 +572,6 @@ def storageEventToString(event):
"Undefined",
"Started",
"Stopped",
- "Refreshed",
)
return storageEventStrings[event]
@@ -581,6 +580,9 @@ def myStoragePoolEventLifecycleCallback(conn, pool, event, detail, opaque):
storageEventToString(event),
detail))
+def myStoragePoolEventRefreshCallback(conn, pool, event, detail, opaque):
+ print("myStoragePoolEventRefreshCallback: Storage pool %s" % pool.name())
+
##########################################################################
# Set up and run the program
##########################################################################
@@ -672,7 +674,9 @@ def main():
vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED, myDomainEventDeviceRemovalFailedCallback, None)
vc.networkEventRegisterAny(None, libvirt.VIR_NETWORK_EVENT_ID_LIFECYCLE, myNetworkEventLifecycleCallback, None)
+
vc.storagePoolEventRegisterAny(None, libvirt.VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE, myStoragePoolEventLifecycleCallback, None)
+ vc.storagePoolEventRegisterAny(None, libvirt.VIR_STORAGE_POOL_EVENT_ID_REFRESH, myStoragePoolEventRefreshCallback, None)
vc.setKeepAlive(5, 3)
diff --git a/libvirt-override-virConnect.py b/libvirt-override-virConnect.py
index 1aaa586..b085b07 100644
--- a/libvirt-override-virConnect.py
+++ b/libvirt-override-virConnect.py
@@ -312,6 +312,16 @@
cb(self, virStoragePool(self, _obj=pool), event, detail, opaque)
return 0
+ def _dispatchStoragePoolEventGenericCallback(self, pool, cbData):
+ """Dispatches events to python user storage pool
+ generic event callbacks
+ """
+ cb = cbData["cb"]
+ opaque = cbData["opaque"]
+
+ cb(self, virStoragePool(self, _obj=pool), opaque)
+ return 0
+
def storagePoolEventDeregisterAny(self, callbackID):
"""Removes a Storage Pool Event Callback. De-registering for a
storage pool callback will disable delivery of this event type"""
diff --git a/libvirt-override.c b/libvirt-override.c
index 4734b7e..79e3d30 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -8832,6 +8832,56 @@ libvirt_virConnectStoragePoolEventLifecycleCallback(virConnectPtr conn ATTRIBUTE
return ret;
}
+static int
+libvirt_virConnectStoragePoolEventGenericCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
+ virStoragePoolPtr pool,
+ void *opaque)
+{
+ PyObject *pyobj_cbData = (PyObject*)opaque;
+ PyObject *pyobj_pool;
+ PyObject *pyobj_ret = NULL;
+ PyObject *pyobj_conn;
+ PyObject *dictKey;
+ int ret = -1;
+
+ LIBVIRT_ENSURE_THREAD_STATE;
+
+ if (!(dictKey = libvirt_constcharPtrWrap("conn")))
+ goto cleanup;
+ pyobj_conn = PyDict_GetItem(pyobj_cbData, dictKey);
+ Py_DECREF(dictKey);
+
+ /* Create a python instance of this virNetworkPtr */
+ virStoragePoolRef(pool);
+ if (!(pyobj_pool = libvirt_virStoragePoolPtrWrap(pool))) {
+ virStoragePoolFree(pool);
+ goto cleanup;
+ }
+ Py_INCREF(pyobj_cbData);
+
+ /* Call the Callback Dispatcher */
+ pyobj_ret = PyObject_CallMethod(pyobj_conn,
+ (char*)"_dispatchStoragePoolEventGenericCallback",
+ (char*)"OiiO",
+ pyobj_pool,
+ pyobj_cbData);
+
+ Py_DECREF(pyobj_cbData);
+ Py_DECREF(pyobj_pool);
+
+ cleanup:
+ if (!pyobj_ret) {
+ DEBUG("%s - ret:%p\n", __FUNCTION__, pyobj_ret);
+ PyErr_Print();
+ } else {
+ Py_DECREF(pyobj_ret);
+ ret = 0;
+ }
+
+ LIBVIRT_RELEASE_THREAD_STATE;
+ return ret;
+}
+
static PyObject *
libvirt_virConnectStoragePoolEventRegisterAny(PyObject *self ATTRIBUTE_UNUSED,
PyObject *args)
@@ -8863,6 +8913,10 @@ libvirt_virConnectStoragePoolEventRegisterAny(PyObject *self ATTRIBUTE_UNUSED,
cb = VIR_STORAGE_POOL_EVENT_CALLBACK(libvirt_virConnectStoragePoolEventLifecycleCallback);
break;
+ case VIR_STORAGE_POOL_EVENT_ID_REFRESH:
+ cb = VIR_STORAGE_POOL_EVENT_CALLBACK(libvirt_virConnectStoragePoolEventGenericCallback);
+ break;
+
case VIR_STORAGE_POOL_EVENT_ID_LAST:
break;
}
--
2.7.4
8 years, 6 months
[libvirt] [PATCH] Promote storage pool refresh lifecycle event to top level event
by Daniel P. Berrange
The VIR_STORAGE_POOL_EVENT_REFRESHED constant does not
reflect any change in the lifecycle of the storage pool.
It should thus not be part of the storage pool lifecycle
event set, but rather be a top level event in its own
right. Thus we introduce VIR_STORAGE_POOL_EVENT_ID_REFRESH
to replace it.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
NB this breaks API and wire protocol, so we *must*
include this before 2.0.0. Ideally we should get it
into before we cut any rc release too.
daemon/remote.c | 29 +++++++++++++++++
examples/object-events/event-test.c | 14 ++++++--
include/libvirt/libvirt-storage.h | 2 +-
src/conf/storage_event.c | 57 +++++++++++++++++++++++++++++++++
src/conf/storage_event.h | 4 +++
src/libvirt_private.syms | 1 +
src/remote/remote_driver.c | 30 +++++++++++++++++
src/remote/remote_protocol.x | 13 +++++++-
src/remote_protocol-structs | 5 +++
src/storage/storage_driver.c | 12 +++----
src/test/test_driver.c | 4 +--
tests/objecteventtest.c | 29 ++++++++++++-----
tools/virsh-pool.c | 64 +++++++++++++++++++++++++++++++------
13 files changed, 232 insertions(+), 32 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index 5ee82bb..4aa43c2 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -1294,8 +1294,37 @@ remoteRelayStoragePoolEventLifecycle(virConnectPtr conn,
return 0;
}
+static int
+remoteRelayStoragePoolEventRefresh(virConnectPtr conn,
+ virStoragePoolPtr pool,
+ void *opaque)
+{
+ daemonClientEventCallbackPtr callback = opaque;
+ remote_storage_pool_event_refresh_msg data;
+
+ if (callback->callbackID < 0 ||
+ !remoteRelayStoragePoolEventCheckACL(callback->client, conn, pool))
+ return -1;
+
+ VIR_DEBUG("Relaying storage pool refresh event callback %d",
+ callback->callbackID);
+
+ /* build return data */
+ memset(&data, 0, sizeof(data));
+ make_nonnull_storage_pool(&data.pool, pool);
+ data.callbackID = callback->callbackID;
+
+ remoteDispatchObjectEventSend(callback->client, remoteProgram,
+ REMOTE_PROC_STORAGE_POOL_EVENT_REFRESH,
+ (xdrproc_t)xdr_remote_storage_pool_event_refresh_msg,
+ &data);
+
+ return 0;
+}
+
static virConnectStoragePoolEventGenericCallback storageEventCallbacks[] = {
VIR_STORAGE_POOL_EVENT_CALLBACK(remoteRelayStoragePoolEventLifecycle),
+ VIR_STORAGE_POOL_EVENT_CALLBACK(remoteRelayStoragePoolEventRefresh),
};
verify(ARRAY_CARDINALITY(storageEventCallbacks) == VIR_STORAGE_POOL_EVENT_ID_LAST);
diff --git a/examples/object-events/event-test.c b/examples/object-events/event-test.c
index 215e026..f2f71cc 100644
--- a/examples/object-events/event-test.c
+++ b/examples/object-events/event-test.c
@@ -349,8 +349,6 @@ storagePoolEventToString(int event)
return "Started";
case VIR_STORAGE_POOL_EVENT_STOPPED:
return "Stopped";
- case VIR_STORAGE_POOL_EVENT_REFRESHED:
- return "Refreshed";
case VIR_STORAGE_POOL_EVENT_LAST:
break;
}
@@ -679,6 +677,17 @@ myStoragePoolEventCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
}
+static int
+myStoragePoolEventRefreshCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
+ virStoragePoolPtr pool,
+ void *opaque ATTRIBUTE_UNUSED)
+{
+ printf("%s EVENT: Storage pool %s refresh\n", __func__,
+ virStoragePoolGetName(pool));
+ return 0;
+}
+
+
static void
eventTypedParamsPrint(virTypedParameterPtr params,
int nparams)
@@ -936,6 +945,7 @@ struct storagePoolEventData {
struct storagePoolEventData storagePoolEvents[] = {
STORAGE_POOL_EVENT(VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE, myStoragePoolEventCallback),
+ STORAGE_POOL_EVENT(VIR_STORAGE_POOL_EVENT_ID_REFRESH, myStoragePoolEventRefreshCallback),
};
/* make sure that the events are kept in sync */
diff --git a/include/libvirt/libvirt-storage.h b/include/libvirt/libvirt-storage.h
index a67a97f..0974f6e 100644
--- a/include/libvirt/libvirt-storage.h
+++ b/include/libvirt/libvirt-storage.h
@@ -394,6 +394,7 @@ int virStoragePoolIsPersistent(virStoragePoolPtr pool);
*/
typedef enum {
VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE = 0, /* virConnectStoragePoolEventLifecycleCallback */
+ VIR_STORAGE_POOL_EVENT_ID_REFRESH = 1, /* virConnectStoragePoolEventGenericCallback */
# ifdef VIR_ENUM_SENTINELS
VIR_STORAGE_POOL_EVENT_ID_LAST
@@ -443,7 +444,6 @@ typedef enum {
VIR_STORAGE_POOL_EVENT_UNDEFINED = 1,
VIR_STORAGE_POOL_EVENT_STARTED = 2,
VIR_STORAGE_POOL_EVENT_STOPPED = 3,
- VIR_STORAGE_POOL_EVENT_REFRESHED = 4,
# ifdef VIR_ENUM_SENTINELS
VIR_STORAGE_POOL_EVENT_LAST
diff --git a/src/conf/storage_event.c b/src/conf/storage_event.c
index c5688be..5768bab 100644
--- a/src/conf/storage_event.c
+++ b/src/conf/storage_event.c
@@ -48,10 +48,20 @@ struct _virStoragePoolEventLifecycle {
typedef struct _virStoragePoolEventLifecycle virStoragePoolEventLifecycle;
typedef virStoragePoolEventLifecycle *virStoragePoolEventLifecyclePtr;
+struct _virStoragePoolEventRefresh {
+ virStoragePoolEvent parent;
+
+ bool dummy;
+};
+typedef struct _virStoragePoolEventRefresh virStoragePoolEventRefresh;
+typedef virStoragePoolEventRefresh *virStoragePoolEventRefreshPtr;
+
static virClassPtr virStoragePoolEventClass;
static virClassPtr virStoragePoolEventLifecycleClass;
+static virClassPtr virStoragePoolEventRefreshClass;
static void virStoragePoolEventDispose(void *obj);
static void virStoragePoolEventLifecycleDispose(void *obj);
+static void virStoragePoolEventRefreshDispose(void *obj);
static int
virStoragePoolEventsOnceInit(void)
@@ -68,6 +78,12 @@ virStoragePoolEventsOnceInit(void)
sizeof(virStoragePoolEventLifecycle),
virStoragePoolEventLifecycleDispose)))
return -1;
+ if (!(virStoragePoolEventRefreshClass =
+ virClassNew(virStoragePoolEventClass,
+ "virStoragePoolEventRefresh",
+ sizeof(virStoragePoolEventRefresh),
+ virStoragePoolEventRefreshDispose)))
+ return -1;
return 0;
}
@@ -90,6 +106,14 @@ virStoragePoolEventLifecycleDispose(void *obj)
static void
+virStoragePoolEventRefreshDispose(void *obj)
+{
+ virStoragePoolEventRefreshPtr event = obj;
+ VIR_DEBUG("obj=%p", event);
+}
+
+
+static void
virStoragePoolEventDispatchDefaultFunc(virConnectPtr conn,
virObjectEventPtr event,
virConnectObjectEventGenericCallback cb,
@@ -115,6 +139,13 @@ virStoragePoolEventDispatchDefaultFunc(virConnectPtr conn,
goto cleanup;
}
+ case VIR_STORAGE_POOL_EVENT_ID_REFRESH:
+ {
+ ((virConnectStoragePoolEventGenericCallback)cb)(conn, pool,
+ cbopaque);
+ goto cleanup;
+ }
+
case VIR_STORAGE_POOL_EVENT_ID_LAST:
break;
}
@@ -235,3 +266,29 @@ virStoragePoolEventLifecycleNew(const char *name,
return (virObjectEventPtr)event;
}
+
+
+/**
+ * virStoragePoolEventRefreshNew:
+ * @name: name of the storage pool object the event describes
+ * @uuid: uuid of the storage pool object the event describes
+ *
+ * Create a new storage pool refresh event.
+ */
+virObjectEventPtr
+virStoragePoolEventRefreshNew(const char *name,
+ const unsigned char *uuid)
+{
+ virStoragePoolEventRefreshPtr event;
+
+ if (virStoragePoolEventsInitialize() < 0)
+ return NULL;
+
+ if (!(event = virObjectEventNew(virStoragePoolEventRefreshClass,
+ virStoragePoolEventDispatchDefaultFunc,
+ VIR_STORAGE_POOL_EVENT_ID_REFRESH,
+ 0, name, uuid)))
+ return NULL;
+
+ return (virObjectEventPtr)event;
+}
diff --git a/src/conf/storage_event.h b/src/conf/storage_event.h
index 7c8ccb7..ea72691 100644
--- a/src/conf/storage_event.h
+++ b/src/conf/storage_event.h
@@ -57,4 +57,8 @@ virStoragePoolEventLifecycleNew(const char *name,
int type,
int detail);
+virObjectEventPtr
+virStoragePoolEventRefreshNew(const char *name,
+ const unsigned char *uuid);
+
#endif
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index ef30f7f..0009f89 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -881,6 +881,7 @@ virStorageVolTypeToString;
# conf/storage_event.h
virStoragePoolEventLifecycleNew;
+virStoragePoolEventRefreshNew;
virStoragePoolEventStateRegisterID;
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 1f81f03..e9904f8 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -362,6 +362,11 @@ remoteStoragePoolBuildEventLifecycle(virNetClientProgramPtr prog ATTRIBUTE_UNUSE
void *evdata, void *opaque);
static void
+remoteStoragePoolBuildEventRefresh(virNetClientProgramPtr prog ATTRIBUTE_UNUSED,
+ virNetClientPtr client ATTRIBUTE_UNUSED,
+ void *evdata, void *opaque);
+
+static void
remoteConnectNotifyEventConnectionClosed(virNetClientProgramPtr prog ATTRIBUTE_UNUSED,
virNetClientPtr client ATTRIBUTE_UNUSED,
void *evdata, void *opaque);
@@ -544,6 +549,10 @@ static virNetClientProgramEvent remoteEvents[] = {
remoteStoragePoolBuildEventLifecycle,
sizeof(remote_storage_pool_event_lifecycle_msg),
(xdrproc_t)xdr_remote_storage_pool_event_lifecycle_msg },
+ { REMOTE_PROC_STORAGE_POOL_EVENT_REFRESH,
+ remoteStoragePoolBuildEventRefresh,
+ sizeof(remote_storage_pool_event_refresh_msg),
+ (xdrproc_t)xdr_remote_storage_pool_event_refresh_msg },
};
static void
@@ -5134,6 +5143,27 @@ remoteStoragePoolBuildEventLifecycle(virNetClientProgramPtr prog ATTRIBUTE_UNUSE
}
static void
+remoteStoragePoolBuildEventRefresh(virNetClientProgramPtr prog ATTRIBUTE_UNUSED,
+ virNetClientPtr client ATTRIBUTE_UNUSED,
+ void *evdata, void *opaque)
+{
+ virConnectPtr conn = opaque;
+ struct private_data *priv = conn->privateData;
+ remote_storage_pool_event_refresh_msg *msg = evdata;
+ virStoragePoolPtr pool;
+ virObjectEventPtr event = NULL;
+
+ pool = get_nonnull_storage_pool(conn, msg->pool);
+ if (!pool)
+ return;
+
+ event = virStoragePoolEventRefreshNew(pool->name, pool->uuid);
+ virObjectUnref(pool);
+
+ remoteEventQueue(priv, event, msg->callbackID);
+}
+
+static void
remoteDomainBuildQemuMonitorEvent(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 d11bfdf..4403714 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -3126,6 +3126,11 @@ struct remote_storage_pool_event_lifecycle_msg {
int detail;
};
+struct remote_storage_pool_event_refresh_msg {
+ int callbackID;
+ remote_nonnull_storage_pool pool;
+};
+
struct remote_domain_fsfreeze_args {
remote_nonnull_domain dom;
remote_nonnull_string mountpoints<REMOTE_DOMAIN_FSFREEZE_MOUNTPOINTS_MAX>; /* (const char **) */
@@ -5871,5 +5876,11 @@ enum remote_procedure {
* @generate: both
* @acl: domain:write
*/
- REMOTE_PROC_DOMAIN_SET_GUEST_VCPUS = 372
+ REMOTE_PROC_DOMAIN_SET_GUEST_VCPUS = 372,
+
+ /**
+ * @generate: both
+ * @acl: none
+ */
+ REMOTE_PROC_STORAGE_POOL_EVENT_REFRESH = 373
};
diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
index 0d89b15..46e798b 100644
--- a/src/remote_protocol-structs
+++ b/src/remote_protocol-structs
@@ -2567,6 +2567,10 @@ struct remote_storage_pool_event_lifecycle_msg {
int event;
int detail;
};
+struct remote_storage_pool_event_refresh_msg {
+ int callbackID;
+ remote_nonnull_storage_pool pool;
+};
struct remote_domain_fsfreeze_args {
remote_nonnull_domain dom;
struct {
@@ -3140,4 +3144,5 @@ enum remote_procedure {
REMOTE_PROC_STORAGE_POOL_EVENT_LIFECYCLE = 370,
REMOTE_PROC_DOMAIN_GET_GUEST_VCPUS = 371,
REMOTE_PROC_DOMAIN_SET_GUEST_VCPUS = 372,
+ REMOTE_PROC_STORAGE_POOL_EVENT_REFRESH = 373,
};
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index d75c5aa..cef2124 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -1206,10 +1206,8 @@ storagePoolRefresh(virStoragePoolPtr obj,
goto cleanup;
}
- event = virStoragePoolEventLifecycleNew(pool->def->name,
- pool->def->uuid,
- VIR_STORAGE_POOL_EVENT_REFRESHED,
- 0);
+ event = virStoragePoolEventRefreshNew(pool->def->name,
+ pool->def->uuid);
ret = 0;
cleanup:
@@ -2342,10 +2340,8 @@ virStorageVolPoolRefreshThread(void *opaque)
if (backend->refreshPool(NULL, pool) < 0)
VIR_DEBUG("Failed to refresh storage pool");
- event = virStoragePoolEventLifecycleNew(pool->def->name,
- pool->def->uuid,
- VIR_STORAGE_POOL_EVENT_REFRESHED,
- 0);
+ event = virStoragePoolEventRefreshNew(pool->def->name,
+ pool->def->uuid);
cleanup:
if (event)
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 2622335..baff085 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -4480,9 +4480,7 @@ testStoragePoolRefresh(virStoragePoolPtr pool,
goto cleanup;
}
- event = virStoragePoolEventLifecycleNew(pool->name, pool->uuid,
- VIR_STORAGE_POOL_EVENT_REFRESHED,
- 0);
+ event = virStoragePoolEventRefreshNew(pool->name, pool->uuid);
ret = 0;
cleanup:
diff --git a/tests/objecteventtest.c b/tests/objecteventtest.c
index ac8cce3..5e8087b 100644
--- a/tests/objecteventtest.c
+++ b/tests/objecteventtest.c
@@ -67,7 +67,6 @@ typedef struct {
int defineEvents;
int undefineEvents;
int unexpectedEvents;
- int refreshEvents;
} lifecycleEventCounter;
static void
@@ -78,7 +77,6 @@ lifecycleEventCounter_reset(lifecycleEventCounter *counter)
counter->defineEvents = 0;
counter->undefineEvents = 0;
counter->unexpectedEvents = 0;
- counter->refreshEvents = 0;
}
typedef struct {
@@ -153,8 +151,16 @@ storagePoolLifecycleCb(virConnectPtr conn ATTRIBUTE_UNUSED,
counter->defineEvents++;
else if (event == VIR_STORAGE_POOL_EVENT_UNDEFINED)
counter->undefineEvents++;
- else if (event == VIR_STORAGE_POOL_EVENT_REFRESHED)
- counter->refreshEvents++;
+}
+
+static void
+storagePoolRefreshCb(virConnectPtr conn ATTRIBUTE_UNUSED,
+ virStoragePoolPtr pool ATTRIBUTE_UNUSED,
+ void* opaque)
+{
+ int *counter = opaque;
+
+ (*counter)++;
}
static int
@@ -646,18 +652,24 @@ testStoragePoolStartStopEvent(const void *data)
{
const objecteventTest *test = data;
lifecycleEventCounter counter;
- int id;
+ int refreshCounter;
+ int id1, id2;
int ret = 0;
if (!test->pool)
return -1;
lifecycleEventCounter_reset(&counter);
+ refreshCounter = 0;
- id = virConnectStoragePoolEventRegisterAny(test->conn, test->pool,
+ id1 = virConnectStoragePoolEventRegisterAny(test->conn, test->pool,
VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE,
VIR_STORAGE_POOL_EVENT_CALLBACK(&storagePoolLifecycleCb),
&counter, NULL);
+ id2 = virConnectStoragePoolEventRegisterAny(test->conn, test->pool,
+ VIR_STORAGE_POOL_EVENT_ID_REFRESH,
+ VIR_STORAGE_POOL_EVENT_CALLBACK(&storagePoolRefreshCb),
+ &refreshCounter, NULL);
virStoragePoolCreate(test->pool, 0);
virStoragePoolRefresh(test->pool, 0);
virStoragePoolDestroy(test->pool);
@@ -668,13 +680,14 @@ testStoragePoolStartStopEvent(const void *data)
}
if (counter.startEvents != 1 || counter.stopEvents != 1 ||
- counter.refreshEvents != 1 || counter.unexpectedEvents > 0) {
+ refreshCounter != 1 || counter.unexpectedEvents > 0) {
ret = -1;
goto cleanup;
}
cleanup:
- virConnectStoragePoolEventDeregisterAny(test->conn, id);
+ virConnectStoragePoolEventDeregisterAny(test->conn, id1);
+ virConnectStoragePoolEventDeregisterAny(test->conn, id2);
return ret;
}
diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c
index 18e218c..6045331 100644
--- a/tools/virsh-pool.c
+++ b/tools/virsh-pool.c
@@ -1899,8 +1899,7 @@ VIR_ENUM_IMPL(virshPoolEvent,
N_("Defined"),
N_("Undefined"),
N_("Started"),
- N_("Stopped"),
- N_("Refreshed"))
+ N_("Stopped"))
static const char *
virshPoolEventToString(int event)
@@ -1909,18 +1908,21 @@ virshPoolEventToString(int event)
return str ? _(str) : _("unknown");
}
+struct vshEventCallback {
+ const char *name;
+ virConnectStoragePoolEventGenericCallback cb;
+};
+typedef struct vshEventCallback vshEventCallback;
+
struct virshPoolEventData {
vshControl *ctl;
bool loop;
bool timestamp;
int count;
+ vshEventCallback *cb;
};
typedef struct virshPoolEventData virshPoolEventData;
-VIR_ENUM_DECL(virshPoolEventId)
-VIR_ENUM_IMPL(virshPoolEventId,
- VIR_STORAGE_POOL_EVENT_ID_LAST,
- "lifecycle")
static void
vshEventLifecyclePrint(virConnectPtr conn ATTRIBUTE_UNUSED,
@@ -1955,6 +1957,45 @@ vshEventLifecyclePrint(virConnectPtr conn ATTRIBUTE_UNUSED,
vshEventDone(data->ctl);
}
+static void
+vshEventGenericPrint(virConnectPtr conn ATTRIBUTE_UNUSED,
+ virStoragePoolPtr pool,
+ void *opaque)
+{
+ virshPoolEventData *data = opaque;
+
+ if (!data->loop && data->count)
+ return;
+
+ if (data->timestamp) {
+ char timestamp[VIR_TIME_STRING_BUFLEN];
+
+ if (virTimeStringNowRaw(timestamp) < 0)
+ timestamp[0] = '\0';
+
+ vshPrint(data->ctl, _("%s: event '%s'' for storage pool %s\n"),
+ timestamp,
+ data->cb->name,
+ virStoragePoolGetName(pool));
+ } else {
+ vshPrint(data->ctl, _("event '%s' for storage pool %s\n"),
+ data->cb->name,
+ virStoragePoolGetName(pool));
+ }
+
+ data->count++;
+ if (!data->loop)
+ vshEventDone(data->ctl);
+}
+
+static vshEventCallback vshEventCallbacks[] = {
+ { "lifecycle",
+ VIR_STORAGE_POOL_EVENT_CALLBACK(vshEventLifecyclePrint), },
+ { "refresh", vshEventGenericPrint, }
+};
+verify(VIR_STORAGE_POOL_EVENT_ID_LAST == ARRAY_CARDINALITY(vshEventCallbacks));
+
+
static const vshCmdInfo info_pool_event[] = {
{.name = "help",
.data = N_("Storage Pool Events")
@@ -2009,7 +2050,7 @@ cmdPoolEvent(vshControl *ctl, const vshCmd *cmd)
size_t i;
for (i = 0; i < VIR_STORAGE_POOL_EVENT_ID_LAST; i++)
- vshPrint(ctl, "%s\n", virshPoolEventIdTypeToString(i));
+ vshPrint(ctl, "%s\n", vshEventCallbacks[i].name);
return true;
}
@@ -2019,7 +2060,11 @@ cmdPoolEvent(vshControl *ctl, const vshCmd *cmd)
vshError(ctl, "%s", _("either --list or event type is required"));
return false;
}
- if ((event = virshPoolEventIdTypeFromString(eventName)) < 0) {
+
+ for (event = 0; event < VIR_STORAGE_POOL_EVENT_ID_LAST; event++)
+ if (STREQ(eventName, vshEventCallbacks[event].name))
+ break;
+ if (event == VIR_STORAGE_POOL_EVENT_ID_LAST) {
vshError(ctl, _("unknown event type %s"), eventName);
return false;
}
@@ -2028,6 +2073,7 @@ cmdPoolEvent(vshControl *ctl, const vshCmd *cmd)
data.loop = vshCommandOptBool(cmd, "loop");
data.timestamp = vshCommandOptBool(cmd, "timestamp");
data.count = 0;
+ data.cb = &vshEventCallbacks[event];
if (vshCommandOptTimeoutToMs(ctl, cmd, &timeout) < 0)
return false;
@@ -2037,7 +2083,7 @@ cmdPoolEvent(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
if ((eventId = virConnectStoragePoolEventRegisterAny(priv->conn, pool, event,
- VIR_STORAGE_POOL_EVENT_CALLBACK(vshEventLifecyclePrint),
+ data.cb->cb,
&data, NULL)) < 0)
goto cleanup;
switch (vshEventWait(ctl)) {
--
2.7.4
8 years, 6 months
[libvirt] [PATCH v2 0/3] Fix the domain capabilities wrt maxvcpus
by Shivaprasad G Bhat
This series drops the suggested cpu in the domcapabilties output which was
implemented in previous version. So, this has just the fix for the
domcapabililties output wrt maxvcpus.
I'll follow up this series with suggested cpus and the virsh maxvcpus fix.
The previous version is available here.
http://www.redhat.com/archives/libvir-list/2016-June/msg00947.html
---
Shivaprasad G Bhat (3):
Rename kvmGetMaxVCPUs() to virHostCPUGetKVMMaxVCPUs()
Check the kvm host cpu max limits in virConnectGetDomainCapabilities
Document to not rely on virConnectGetMaxVcpus API
src/libvirt-host.c | 5 +++-
src/libvirt_private.syms | 1 +
src/qemu/qemu_capabilities.c | 11 ++++++---
src/qemu/qemu_capabilities.h | 3 ++
src/qemu/qemu_driver.c | 54 ++----------------------------------------
src/util/virhostcpu.c | 36 ++++++++++++++++++++++++++++
src/util/virhostcpu.h | 2 ++
tests/domaincapstest.c | 3 ++
8 files changed, 57 insertions(+), 58 deletions(-)
--
Signature
8 years, 6 months
[libvirt] [PATCH python v4 0/7] Introducing storage pool lifecycle event APIs
by Jovanka Gulicoska
Introducing implementation of storage pool event APIs. Code changes
follow network event APIs.
Implemented functions: virStoragePoolEventRegisterAny(),
virStoragePoolEventDeregisterAny(), virStoragePoolLifeCycleEventNew(),
introduced STARTED, STOPPED, DEFINE, UNDEFINE and REFRESHED.
STARTED signal is emiited in storagePoolCreateXML() and storagePoolCreate()
DEFINED signal is emitted in storagePoolDefineXML()
UNDEFINED signal is emitted in storagePoolUndefine()
STOPPED signal is emitted in storagePoolDestroy() and storagePoolRefresh()
REFRESHED signal is emitted in storagePoolRefresh()
There are also test as well as unittests for the new functions and signals.
This is part of a GSOC project: Asynchronous lifecycle events for storage objects
As part of the project there should also be implementation for
storage volume events.
For now there's no signal when volumes are created or deleted,
they can also be implemented, but probably the easiest way is to have
apps watch for REFRESH signal, and later extend storage driver code to
refresh a pool after volume APIs are called.
Changes since v1: small changes following comments
Changes since v2: #1 - fix broken alignment in datatypes and fix typos in
docstring
#2 - rename STORAGE_POOL_EVENT_SOURCES to
STORAGE_EVENT_SOURCES, change copyright
#3 - fixed spacing issue in comments in test driver
#4 - fix comment formating, change in comment,
move REMOTE_PROC_STORAGE_POOL_EVENT_LIFECYCLE to buttom of list
#5 - include storageEventState pointer, change version
from 1.3.6 to 2.0.0, use callbackID insted of ret in
storageConnectStoragePoolEventRegisterAny()
#6 - use domain like lifecycle event callback
Changes since v3: moved storage_conf.h from patch #2 to #6, indentation
in remote_protocol-stucts (Martin's suggestion)
Jovanka Gulicoska (7):
Introduce storage lifecycle event APIs
conf: add storage_event handling
test: implement storage lifecycle event APIs
remote: implement storage lifecycle event APIs
storage: implement storage lifecycle event APIs
event-test: support storage lifecycle event APIs
virsh: Introduce virsh-pool command
daemon/libvirtd.h | 2 +
daemon/remote.c | 207 ++++++++++++++++++++++++++++++-
examples/object-events/event-test.c | 73 +++++++++++
include/libvirt/libvirt-storage.h | 93 ++++++++++++++
src/Makefile.am | 5 +
src/conf/storage_conf.h | 4 +
src/conf/storage_event.c | 237 ++++++++++++++++++++++++++++++++++++
src/conf/storage_event.h | 60 +++++++++
src/datatypes.h | 13 ++
src/driver-storage.h | 13 ++
src/libvirt-storage.c | 125 +++++++++++++++++++
src/libvirt_private.syms | 5 +
src/libvirt_public.syms | 6 +
src/remote/remote_driver.c | 128 +++++++++++++++++++
src/remote/remote_protocol.x | 43 ++++++-
src/remote_protocol-structs | 19 +++
src/storage/storage_driver.c | 110 +++++++++++++++++
src/test/test_driver.c | 71 +++++++++++
tests/objecteventtest.c | 177 +++++++++++++++++++++++++++
tools/virsh-pool.c | 184 ++++++++++++++++++++++++++++
20 files changed, 1571 insertions(+), 4 deletions(-)
create mode 100644 src/conf/storage_event.c
create mode 100644 src/conf/storage_event.h
--
2.5.5
8 years, 6 months
[libvirt] [PATCH] daemon: Drop dependency on libvirt-admin.so
by Michal Privoznik
Currently, the daemon requires libvirt-admin.so because the
functions encoding/decoding RPC messages for admin APIs live
there. But this makes it very hard to split admin API into its
own separate package: if libvirt-admin.so is going to live in a
separate package than the daemon, either both packages must be
installed or none.
Solve this by statically linking the RPC message handling
functions with the daemon.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
I'm a bit torn. I'm tempted to rewrite some parts of admin API so
that it follows the driver architecture we have for other areas,
e.g. domain drivers. Until then, this patch is needed.
daemon/Makefile.am | 2 +-
src/Makefile.am | 15 +++++++++++++--
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 927d16f..3b6aafe 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -152,7 +152,7 @@ libvirtd_admin_la_LDFLAGS = \
$(NO_INDIRECT_LDFLAGS) \
$(NULL)
libvirtd_admin_la_LIBADD = \
- ../src/libvirt-admin.la
+ ../src/libvirt-admin-rpc.la
man8_MANS = libvirtd.8
diff --git a/src/Makefile.am b/src/Makefile.am
index 9f8b638..7c3cef6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -592,7 +592,7 @@ $(srcdir)/lock_protocol-struct: \
$(srcdir)/%-struct: locking/lockd_la-%.lo
$(PDWTAGS)
$(srcdir)/admin_protocol-struct: \
- $(srcdir)/%-struct: admin/libvirt_admin_la-%.lo
+ $(srcdir)/%-struct: admin/%.lo
$(PDWTAGS)
else !WITH_REMOTE
@@ -2165,10 +2165,20 @@ libvirt_admin.syms: libvirt_admin_public.syms $(ADMIN_SYM_FILES) \
# need to include it in the dist
EXTRA_DIST += admin/admin_remote.c
+noinst_LTLIBRARIES += \
+ libvirt-admin-rpc.la
+
+libvirt_admin_rpc_la_SOURCES = \
+ $(ADMIN_PROTOCOL_GENERATED)
+
+libvirt_admin_rpc_la_LDFLAGS = \
+ $(AM_LDFLAGS) \
+ $(CYGWIN_EXTRA_LDFLAGS) \
+ $(MINGW_EXTRA_LDFLAGS)
+
lib_LTLIBRARIES += libvirt-admin.la
libvirt_admin_la_SOURCES = \
libvirt-admin.c \
- $(ADMIN_PROTOCOL_GENERATED) \
$(DATATYPES_SOURCES)
libvirt_admin_la_LDFLAGS = \
@@ -2180,6 +2190,7 @@ libvirt_admin_la_LDFLAGS = \
libvirt_admin_la_LIBADD = \
libvirt.la \
+ libvirt-admin-rpc.la \
$(CYGWIN_EXTRA_LIBADD)
libvirt_admin_la_CFLAGS = \
--
2.8.4
8 years, 6 months
[libvirt] [PATCH] sasl auth:add default mapping of credentials to machines
by longguang.yue
hi,all:
in production environment, it is important to keep safe. libvirt does automatic validation, but it needs to set up mapping for each machine.
this patch is to add default certificate mapping , make it easy in lange scale environment.
maybe another way is using regex to do exact match, if this idea is helpful, i can continue
thanks
8 years, 6 months