Devel
Threads by month
- ----- 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
October 2012
- 85 participants
- 373 discussions
This patch adds support for SUSPEND_DISK event; both lifecycle and
separated. The support is added for QEMU, machines are changed to
PMSUSPENDED, but as QEMU sends SHUTDOWN afterwards, the state changes
to shut-off. This and much more needs to be done in order for libvirt
to work with transient devices, wake-ups etc. This patch is not
aiming for that functionality.
---
daemon/remote.c | 25 +++++++++++
examples/domain-events/events-c/event-test.c | 22 +++++++++-
examples/domain-events/events-python/event-test.py | 3 +-
include/libvirt/libvirt.h.in | 29 +++++++++++++
python/libvirt-override-virConnect.py | 9 ++++
python/libvirt-override.c | 50 ++++++++++++++++++++++
src/conf/domain_event.c | 32 +++++++++++++-
src/conf/domain_event.h | 4 ++
src/libvirt_private.syms | 2 +
src/qemu/qemu_monitor.c | 10 +++++
src/qemu/qemu_monitor.h | 3 ++
src/qemu/qemu_monitor_json.c | 9 ++++
src/qemu/qemu_process.c | 47 ++++++++++++++++++++
src/remote/remote_driver.c | 31 ++++++++++++++
src/remote/remote_protocol.x | 7 ++-
src/remote_protocol-structs | 4 ++
16 files changed, 282 insertions(+), 5 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index e7fe128..58017e5 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -608,6 +608,30 @@ remoteRelayDomainEventBalloonChange(virConnectPtr conn ATTRIBUTE_UNUSED,
}
+static int remoteRelayDomainEventSuspendDisk(virConnectPtr conn ATTRIBUTE_UNUSED,
+ virDomainPtr dom,
+ int reason ATTRIBUTE_UNUSED,
+ void *opaque) {
+ virNetServerClientPtr client = opaque;
+ remote_domain_event_suspend_disk_msg data;
+
+ if (!client)
+ return -1;
+
+ VIR_DEBUG("Relaying domain %s %d system suspend-disk", dom->name, dom->id);
+
+ /* build return data */
+ memset(&data, 0, sizeof(data));
+ make_nonnull_domain(&data.dom, dom);
+
+ remoteDispatchDomainEventSend(client, remoteProgram,
+ REMOTE_PROC_DOMAIN_EVENT_SUSPEND_DISK,
+ (xdrproc_t)xdr_remote_domain_event_suspend_disk_msg, &data);
+
+ return 0;
+}
+
+
static virConnectDomainEventGenericCallback domainEventCallbacks[] = {
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventLifecycle),
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventReboot),
@@ -623,6 +647,7 @@ static virConnectDomainEventGenericCallback domainEventCallbacks[] = {
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventPMWakeup),
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventPMSuspend),
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventBalloonChange),
+ VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventSuspendDisk),
};
verify(ARRAY_CARDINALITY(domainEventCallbacks) == VIR_DOMAIN_EVENT_ID_LAST);
diff --git a/examples/domain-events/events-c/event-test.c b/examples/domain-events/events-c/event-test.c
index cde60fb..856eb4f 100644
--- a/examples/domain-events/events-c/event-test.c
+++ b/examples/domain-events/events-c/event-test.c
@@ -201,6 +201,9 @@ static const char *eventDetailToString(int event, int detail) {
case VIR_DOMAIN_EVENT_PMSUSPENDED_MEMORY:
ret = "Memory";
break;
+ case VIR_DOMAIN_EVENT_PMSUSPENDED_DISK:
+ ret = "Disk";
+ break;
}
break;
}
@@ -402,6 +405,16 @@ static int myDomainEventPMSuspendCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
return 0;
}
+static int myDomainEventSuspendDiskCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
+ virDomainPtr dom,
+ int reason ATTRIBUTE_UNUSED,
+ void *opaque ATTRIBUTE_UNUSED)
+{
+ printf("%s EVENT: Domain %s(%d) system suspend-disk\n",
+ __func__, virDomainGetName(dom), virDomainGetID(dom));
+ return 0;
+}
+
static void myFreeFunc(void *opaque)
{
char *str = opaque;
@@ -440,6 +453,7 @@ int main(int argc, char **argv)
int callback11ret = -1;
int callback12ret = -1;
int callback13ret = -1;
+ int callback14ret = -1;
struct sigaction action_stop;
memset(&action_stop, 0, sizeof(action_stop));
@@ -533,6 +547,11 @@ int main(int argc, char **argv)
VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE,
VIR_DOMAIN_EVENT_CALLBACK(myDomainEventBalloonChangeCallback),
strdup("callback balloonchange"), myFreeFunc);
+ callback14ret = virConnectDomainEventRegisterAny(dconn,
+ NULL,
+ VIR_DOMAIN_EVENT_ID_SUSPEND_DISK,
+ VIR_DOMAIN_EVENT_CALLBACK(myDomainEventSuspendDiskCallback),
+ strdup("suspend-disk"), myFreeFunc);
if ((callback1ret != -1) &&
(callback2ret != -1) &&
(callback3ret != -1) &&
@@ -544,7 +563,8 @@ int main(int argc, char **argv)
(callback10ret != -1) &&
(callback11ret != -1) &&
(callback12ret != -1) &&
- (callback13ret != -1)) {
+ (callback13ret != -1) &&
+ (callback14ret != -1)) {
if (virConnectSetKeepAlive(dconn, 5, 3) < 0) {
virErrorPtr err = virGetLastError();
fprintf(stderr, "Failed to start keepalive protocol: %s\n",
diff --git a/examples/domain-events/events-python/event-test.py b/examples/domain-events/events-python/event-test.py
index 27e74c4..bf11fb9 100644
--- a/examples/domain-events/events-python/event-test.py
+++ b/examples/domain-events/events-python/event-test.py
@@ -449,7 +449,7 @@ def detailToString(event, detail):
( "Unpaused", "Migrated", "Snapshot" ),
( "Shutdown", "Destroyed", "Crashed", "Migrated", "Saved", "Failed", "Snapshot"),
( "Finished", ),
- ( "Memory", )
+ ( "Memory", "Disk" )
)
return eventStrings[event][detail]
@@ -554,6 +554,7 @@ def main():
vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_PMWAKEUP, myDomainEventPMWakeupCallback, None)
vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_PMSUSPEND, myDomainEventPMSuspendCallback, None)
vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE, myDomainEventBalloonChangeCallback, None)
+ vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_SUSPEND_DISK, myDomainEventSuspendDiskCallback, None)
vc.setKeepAlive(5, 3)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index a4e8ca9..422819c 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -225,6 +225,14 @@ typedef enum {
#endif
} virDomainPMSuspendedReason;
+typedef enum {
+ VIR_DOMAIN_SUSPENDED_DISK_UNKNOWN = 0,
+
+#ifdef VIR_ENUM_SENTINELS
+ VIR_DOMAIN_SUSPENDED_DISK_LAST
+#endif
+} virDomainSuspendedDiskReason;
+
/**
* virDomainControlState:
*
@@ -3114,6 +3122,7 @@ typedef enum {
*/
typedef enum {
VIR_DOMAIN_EVENT_PMSUSPENDED_MEMORY = 0, /* Guest was PM suspended to memory */
+ VIR_DOMAIN_EVENT_PMSUSPENDED_DISK = 1, /* Guest was PM suspended to disk */
#ifdef VIR_ENUM_SENTINELS
VIR_DOMAIN_EVENT_PMSUSPENDED_LAST
@@ -4164,6 +4173,25 @@ typedef void (*virConnectDomainEventBalloonChangeCallback)(virConnectPtr conn,
void *opaque);
/**
+ * virConnectDomainEventSuspendDiskCallback:
+ * @conn: connection object
+ * @dom: domain on which the event occurred
+ * @reason: reason why the callback was called, unused currently,
+ * always passes 0
+ * @opaque: application specified data
+ *
+ * This callback occurs when the guest is suspended to disk.
+ *
+ * The callback signature to use when registering for an event of type
+ * VIR_DOMAIN_EVENT_ID_SUSPEND_DISK with virConnectDomainEventRegisterAny()
+ */
+typedef void (*virConnectDomainEventSuspendDiskCallback)(virConnectPtr conn,
+ virDomainPtr dom,
+ int reason,
+ void *opaque);
+
+
+/**
* VIR_DOMAIN_EVENT_CALLBACK:
*
* Used to cast the event specific callback into the generic one
@@ -4187,6 +4215,7 @@ typedef enum {
VIR_DOMAIN_EVENT_ID_PMWAKEUP = 11, /* virConnectDomainEventPMWakeupCallback */
VIR_DOMAIN_EVENT_ID_PMSUSPEND = 12, /* virConnectDomainEventPMSuspendCallback */
VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE = 13, /* virConnectDomainEventBalloonChangeCallback */
+ VIR_DOMAIN_EVENT_ID_SUSPEND_DISK = 14, /* virConnectDomainEventSuspendDiskCallback */
#ifdef VIR_ENUM_SENTINELS
/*
diff --git a/python/libvirt-override-virConnect.py b/python/libvirt-override-virConnect.py
index 6bec66d..3136841 100644
--- a/python/libvirt-override-virConnect.py
+++ b/python/libvirt-override-virConnect.py
@@ -170,6 +170,15 @@
cb(self, virDomain(self, _obj=dom), actual, opaque)
return 0
+ def _dispatchDomainEventSuspendDiskCallback(self, dom, reason, cbData):
+ """Dispatches event to python user domain suspend-disk event callbacks
+ """
+ cb = cbData["cb"]
+ opaque = cbData["opaque"]
+
+ cb(self, virDomain(self, _obj=dom), reason, opaque)
+ return 0;
+
def domainEventDeregisterAny(self, callbackID):
"""Removes a Domain Event Callback. De-registering for a
domain callback will disable delivery of this event type """
diff --git a/python/libvirt-override.c b/python/libvirt-override.c
index 81099b1..bc73ad0 100644
--- a/python/libvirt-override.c
+++ b/python/libvirt-override.c
@@ -5812,6 +5812,53 @@ libvirt_virConnectDomainEventBalloonChangeCallback(virConnectPtr conn ATTRIBUTE_
return ret;
}
+static int
+libvirt_virConnectDomainEventSuspendDiskCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
+ virDomainPtr dom,
+ int reason,
+ void *opaque)
+{
+ PyObject *pyobj_cbData = (PyObject*)opaque;
+ PyObject *pyobj_dom;
+ PyObject *pyobj_ret;
+ PyObject *pyobj_conn;
+ PyObject *dictKey;
+ int ret = -1;
+
+ LIBVIRT_ENSURE_THREAD_STATE;
+ /* Create a python instance of this virDomainPtr */
+ virDomainRef(dom);
+
+ pyobj_dom = libvirt_virDomainPtrWrap(dom);
+ Py_INCREF(pyobj_cbData);
+
+ dictKey = libvirt_constcharPtrWrap("conn");
+ pyobj_conn = PyDict_GetItem(pyobj_cbData, dictKey);
+ Py_DECREF(dictKey);
+
+ /* Call the Callback Dispatcher */
+ pyobj_ret = PyObject_CallMethod(pyobj_conn,
+ (char*)"_dispatchDomainEventSuspendDiskCallback",
+ (char*)"OiO",
+ pyobj_dom,
+ reason,
+ pyobj_cbData);
+
+ Py_DECREF(pyobj_cbData);
+ Py_DECREF(pyobj_dom);
+
+ 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_virConnectDomainEventRegisterAny(ATTRIBUTE_UNUSED PyObject * self,
PyObject * args)
@@ -5884,6 +5931,9 @@ libvirt_virConnectDomainEventRegisterAny(ATTRIBUTE_UNUSED PyObject * self,
case VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE:
cb = VIR_DOMAIN_EVENT_CALLBACK(libvirt_virConnectDomainEventBalloonChangeCallback);
break;
+ case VIR_DOMAIN_EVENT_ID_SUSPEND_DISK:
+ cb = VIR_DOMAIN_EVENT_CALLBACK(libvirt_virConnectDomainEventSuspendDiskCallback);
+ break;
}
if (!cb) {
diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index 7da4a1e..c7010c8 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
@@ -1,7 +1,7 @@
/*
* domain_event.c: domain event queue processing helpers
*
- * Copyright (C) 2010-2011 Red Hat, Inc.
+ * Copyright (C) 2010-2012 Red Hat, Inc.
* Copyright (C) 2008 VirtualIron
*
* This library is free software; you can redistribute it and/or
@@ -1107,10 +1107,10 @@ virDomainEventPMSuspendNew(int id, const char *name,
virDomainEventPtr ev =
virDomainEventNewInternal(VIR_DOMAIN_EVENT_ID_PMSUSPEND,
id, name, uuid);
-
return ev;
}
+
virDomainEventPtr
virDomainEventPMSuspendNewFromObj(virDomainObjPtr obj)
{
@@ -1125,6 +1125,30 @@ virDomainEventPMSuspendNewFromDom(virDomainPtr dom)
return virDomainEventPMSuspendNew(dom->id, dom->name, dom->uuid);
}
+static virDomainEventPtr
+virDomainEventSuspendDiskNew(int id, const char *name,
+ unsigned char *uuid)
+{
+ virDomainEventPtr ev =
+ virDomainEventNewInternal(VIR_DOMAIN_EVENT_ID_SUSPEND_DISK,
+ id, name, uuid);
+ return ev;
+}
+
+virDomainEventPtr
+virDomainEventSuspendDiskNewFromObj(virDomainObjPtr obj)
+{
+ return virDomainEventSuspendDiskNew(obj->def->id,
+ obj->def->name,
+ obj->def->uuid);
+}
+
+virDomainEventPtr
+virDomainEventSuspendDiskNewFromDom(virDomainPtr dom)
+{
+ return virDomainEventSuspendDiskNew(dom->id, dom->name, dom->uuid);
+}
+
virDomainEventPtr virDomainEventBalloonChangeNewFromDom(virDomainPtr dom,
unsigned long long actual)
{
@@ -1294,6 +1318,10 @@ virDomainEventDispatchDefaultFunc(virConnectPtr conn,
cbopaque);
break;
+ case VIR_DOMAIN_EVENT_ID_SUSPEND_DISK:
+ ((virConnectDomainEventSuspendDiskCallback)cb)(conn, dom, 0, cbopaque);
+ break;
+
default:
VIR_WARN("Unexpected event ID %d", event->eventID);
break;
diff --git a/src/conf/domain_event.h b/src/conf/domain_event.h
index 995b655..173eba8 100644
--- a/src/conf/domain_event.h
+++ b/src/conf/domain_event.h
@@ -1,6 +1,7 @@
/*
* domain_event.h: domain event queue processing helpers
*
+ * Copyright (C) 2012 Red Hat, Inc.
* Copyright (C) 2008 VirtualIron
*
* This library is free software; you can redistribute it and/or
@@ -128,6 +129,9 @@ virDomainEventPtr virDomainEventPMSuspendNewFromDom(virDomainPtr dom);
virDomainEventPtr virDomainEventBalloonChangeNewFromDom(virDomainPtr dom, unsigned long long actual);
virDomainEventPtr virDomainEventBalloonChangeNewFromObj(virDomainObjPtr obj, unsigned long long actual);
+virDomainEventPtr virDomainEventSuspendDiskNewFromObj(virDomainObjPtr obj);
+virDomainEventPtr virDomainEventSuspendDiskNewFromDom(virDomainPtr dom);
+
void virDomainEventFree(virDomainEventPtr event);
void virDomainEventStateFree(virDomainEventStatePtr state);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index fe31bbe..c1f08e0 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -585,6 +585,8 @@ virDomainEventStateRegisterID;
virDomainEventStateFree;
virDomainEventStateNew;
virDomainEventStateQueue;
+virDomainEventSuspendDiskNewFromDom;
+virDomainEventSuspendDiskNewFromObj;
virDomainEventTrayChangeNewFromDom;
virDomainEventTrayChangeNewFromObj;
virDomainEventWatchdogNewFromDom;
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 85b0bc2..b0fa682 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -1111,6 +1111,16 @@ int qemuMonitorEmitPMSuspend(qemuMonitorPtr mon)
return ret;
}
+int qemuMonitorEmitSuspendDisk(qemuMonitorPtr mon)
+{
+ int ret = -1;
+ VIR_DEBUG("mon=%p", mon);
+
+ QEMU_MONITOR_CALLBACK(mon, ret, domainSuspendDisk, mon->vm);
+
+ return ret;
+}
+
int qemuMonitorEmitBlockJob(qemuMonitorPtr mon,
const char *diskAlias,
int type,
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 54b3a99..f4dc94f 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -136,6 +136,8 @@ struct _qemuMonitorCallbacks {
int (*domainBalloonChange)(qemuMonitorPtr mon,
virDomainObjPtr vm,
unsigned long long actual);
+ int (*domainSuspendDisk)(qemuMonitorPtr mon,
+ virDomainObjPtr vm);
};
char *qemuMonitorEscapeArg(const char *in);
@@ -213,6 +215,7 @@ int qemuMonitorEmitBlockJob(qemuMonitorPtr mon,
int status);
int qemuMonitorEmitBalloonChange(qemuMonitorPtr mon,
unsigned long long actual);
+int qemuMonitorEmitSuspendDisk(qemuMonitorPtr mon);
int qemuMonitorStartCPUs(qemuMonitorPtr mon,
virConnectPtr conn);
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index bd52ce4..d0fd23a 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -70,6 +70,7 @@ static void qemuMonitorJSONHandlePMSuspend(qemuMonitorPtr mon, virJSONValuePtr d
static void qemuMonitorJSONHandleBlockJobCompleted(qemuMonitorPtr mon, virJSONValuePtr data);
static void qemuMonitorJSONHandleBlockJobCanceled(qemuMonitorPtr mon, virJSONValuePtr data);
static void qemuMonitorJSONHandleBalloonChange(qemuMonitorPtr mon, virJSONValuePtr data);
+static void qemuMonitorJSONHandleSuspendDisk(qemuMonitorPtr mon, virJSONValuePtr data);
typedef struct {
const char *type;
@@ -91,6 +92,7 @@ static qemuEventHandler eventHandlers[] = {
{ "SPICE_INITIALIZED", qemuMonitorJSONHandleSPICEInitialize, },
{ "STOP", qemuMonitorJSONHandleStop, },
{ "SUSPEND", qemuMonitorJSONHandlePMSuspend, },
+ { "SUSPEND_DISK", qemuMonitorJSONHandleSuspendDisk, },
{ "VNC_CONNECTED", qemuMonitorJSONHandleVNCConnect, },
{ "VNC_DISCONNECTED", qemuMonitorJSONHandleVNCDisconnect, },
{ "VNC_INITIALIZED", qemuMonitorJSONHandleVNCInitialize, },
@@ -891,6 +893,13 @@ qemuMonitorJSONHandleBalloonChange(qemuMonitorPtr mon,
qemuMonitorEmitBalloonChange(mon, actual);
}
+static void
+qemuMonitorJSONHandleSuspendDisk(qemuMonitorPtr mon,
+ virJSONValuePtr data ATTRIBUTE_UNUSED)
+{
+ qemuMonitorEmitSuspendDisk(mon);
+}
+
int
qemuMonitorJSONHumanCommandWithFd(qemuMonitorPtr mon,
const char *cmd_str,
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index f8a2bfd..02beb5d 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1178,6 +1178,52 @@ qemuProcessHandleBalloonChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
return 0;
}
+static int
+qemuProcessHandleSuspendDisk(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
+ virDomainObjPtr vm)
+{
+ struct qemud_driver *driver = qemu_driver;
+ virDomainEventPtr event = NULL;
+ virDomainEventPtr lifecycleEvent = NULL;
+
+ virDomainObjLock(vm);
+ event = virDomainEventSuspendDiskNewFromObj(vm);
+
+ if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) {
+ qemuDomainObjPrivatePtr priv = vm->privateData;
+ VIR_DEBUG("Transitioned guest %s to pmsuspended state due to "
+ "QMP suspend_disk event", vm->def->name);
+
+ virDomainObjSetState(vm, VIR_DOMAIN_PMSUSPENDED,
+ VIR_DOMAIN_PMSUSPENDED_UNKNOWN);
+ lifecycleEvent =
+ virDomainEventNewFromObj(vm,
+ VIR_DOMAIN_EVENT_PMSUSPENDED,
+ VIR_DOMAIN_EVENT_PMSUSPENDED_DISK);
+
+ if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0) {
+ VIR_WARN("Unable to save status on vm %s after suspend event",
+ vm->def->name);
+ }
+
+ if (priv->agent)
+ qemuAgentNotifyEvent(priv->agent, QEMU_AGENT_EVENT_SUSPEND);
+ }
+
+ virDomainObjUnlock(vm);
+
+ if (event || lifecycleEvent) {
+ qemuDriverLock(driver);
+ if (event)
+ qemuDomainEventQueue(driver, event);
+ if (lifecycleEvent)
+ qemuDomainEventQueue(driver, lifecycleEvent);
+ qemuDriverUnlock(driver);
+ }
+
+ return 0;
+}
+
static qemuMonitorCallbacks monitorCallbacks = {
.destroy = qemuProcessHandleMonitorDestroy,
@@ -1196,6 +1242,7 @@ static qemuMonitorCallbacks monitorCallbacks = {
.domainPMWakeup = qemuProcessHandlePMWakeup,
.domainPMSuspend = qemuProcessHandlePMSuspend,
.domainBalloonChange = qemuProcessHandleBalloonChange,
+ .domainSuspendDisk = qemuProcessHandleSuspendDisk,
};
static int
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index fc4c696..741c159 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -253,6 +253,10 @@ static void
remoteDomainBuildEventBalloonChange(virNetClientProgramPtr prog,
virNetClientPtr client,
void *evdata, void *opaque);
+static void
+remoteDomainBuildEventSuspendDisk(virNetClientProgramPtr prog,
+ virNetClientPtr client,
+ void *evdata, void *opaque);
static virNetClientProgramEvent remoteDomainEvents[] = {
{ REMOTE_PROC_DOMAIN_EVENT_RTC_CHANGE,
@@ -311,6 +315,10 @@ static virNetClientProgramEvent remoteDomainEvents[] = {
remoteDomainBuildEventBalloonChange,
sizeof(remote_domain_event_balloon_change_msg),
(xdrproc_t)xdr_remote_domain_event_balloon_change_msg },
+ { REMOTE_PROC_DOMAIN_EVENT_SUSPEND_DISK,
+ remoteDomainBuildEventSuspendDisk,
+ sizeof(remote_domain_event_suspend_disk_msg),
+ (xdrproc_t)xdr_remote_domain_event_suspend_disk_msg },
};
enum virDrvOpenRemoteFlags {
@@ -4575,6 +4583,29 @@ remoteDomainBuildEventBalloonChange(virNetClientProgramPtr prog ATTRIBUTE_UNUSED
}
+static void
+remoteDomainBuildEventSuspendDisk(virNetClientProgramPtr prog ATTRIBUTE_UNUSED,
+ virNetClientPtr client ATTRIBUTE_UNUSED,
+ void *evdata, void *opaque)
+{
+ virConnectPtr conn = opaque;
+ struct private_data *priv = conn->privateData;
+ remote_domain_event_suspend_disk_msg *msg = evdata;
+ virDomainPtr dom;
+ virDomainEventPtr event = NULL;
+
+ dom = get_nonnull_domain(conn, msg->dom);
+ if (!dom)
+ return;
+
+ event = virDomainEventSuspendDiskNewFromDom(dom);
+
+ virDomainFree(dom);
+
+ remoteDomainEventQueue(priv, event);
+}
+
+
static virDrvOpenStatus ATTRIBUTE_NONNULL (1)
remoteSecretOpen(virConnectPtr conn, virConnectAuthPtr auth,
unsigned int flags)
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index b0b530c..94ea947 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -2259,6 +2259,10 @@ struct remote_domain_event_balloon_change_msg {
unsigned hyper actual;
};
+struct remote_domain_event_suspend_disk_msg {
+ remote_nonnull_domain dom;
+};
+
struct remote_domain_managed_save_args {
remote_nonnull_domain dom;
unsigned int flags;
@@ -3008,7 +3012,8 @@ enum remote_procedure {
REMOTE_PROC_NODE_GET_MEMORY_PARAMETERS = 289, /* skipgen skipgen */
REMOTE_PROC_DOMAIN_BLOCK_COMMIT = 290, /* autogen autogen */
- REMOTE_PROC_NETWORK_UPDATE = 291 /* autogen autogen priority:high */
+ REMOTE_PROC_NETWORK_UPDATE = 291, /* autogen autogen priority:high */
+ REMOTE_PROC_DOMAIN_EVENT_SUSPEND_DISK = 292 /* autogen autogen */
/*
* Notice how the entries are grouped in sets of 10 ?
diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
index 4d2627a..cbdd27c 100644
--- a/src/remote_protocol-structs
+++ b/src/remote_protocol-structs
@@ -1718,6 +1718,9 @@ struct remote_domain_event_balloon_change_msg {
remote_nonnull_domain dom;
uint64_t actual;
};
+struct remote_domain_event_suspend_disk_msg {
+ remote_nonnull_domain dom;
+};
struct remote_domain_managed_save_args {
remote_nonnull_domain dom;
u_int flags;
@@ -2415,4 +2418,5 @@ enum remote_procedure {
REMOTE_PROC_NODE_GET_MEMORY_PARAMETERS = 289,
REMOTE_PROC_DOMAIN_BLOCK_COMMIT = 290,
REMOTE_PROC_NETWORK_UPDATE = 291,
+ REMOTE_PROC_DOMAIN_EVENT_SUSPEND_DISK = 292,
};
--
1.7.12.3
3
3
We add a helper python script build-aux/make-authors.py The .mailmap
is expanded to give output as close to the original AUTHORS file as
possible. Drop the syntax-check that validated AUTHORS is up to date.
AUTHORS.in tracks the maintainers, as well as some folks who were
previously in AUTHORS but don't have a git commit with proper
attribution.
---
.gitignore | 1 +
.mailmap | 13 +++
AUTHORS | 279 ----------------------------------------------
AUTHORS.in | 86 ++++++++++++++
Makefile.am | 12 +-
bootstrap.conf | 3 +-
build-aux/make-authors.py | 44 ++++++++
cfg.mk | 15 ---
8 files changed, 157 insertions(+), 296 deletions(-)
delete mode 100644 AUTHORS
create mode 100644 AUTHORS.in
create mode 100644 build-aux/make-authors.py
If someone wants to suggest a perl or shell script replacement I'm all ears.
Or we could just commit to sorting AUTHORS alphabetically and let sort +
uniq do all the work.
diff --git a/.gitignore b/.gitignore
index 1cd2d45..004bc76 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,6 +26,7 @@
.memdump
.sc-start-sc_*
/ABOUT-NLS
+/AUTHORS
/COPYING
/ChangeLog
/GNUmakefile
diff --git a/.mailmap b/.mailmap
index 76e6513..924c501 100644
--- a/.mailmap
+++ b/.mailmap
@@ -34,6 +34,8 @@
<gerd(a)egidy.de> <lists(a)egidy.de>
<gerd(a)egidy.de> <gerd.von.egidy(a)intra2net.com>
<benoar(a)dolka.fr> <benjamin.cama(a)telecom-bretagne.eu>
+<serge.hallyn(a)canonical.com> <serue(a)us.ibm.com>
+<pritesh.kothari(a)sun.com> <Pritesh.Kothari(a)Sun.COM>
# Name consolidation:
# Preferred author spelling <preferred email>
@@ -42,3 +44,14 @@ Royce Lv <lvroyce(a)linux.vnet.ibm.com>
Daniel J Walsh <dwalsh(a)redhat.com>
Ján Tomko <jtomko(a)redhat.com>
Gerd von Egidy <gerd(a)egidy.de>
+MATSUDA Daiki <matsudadik(a)intellilink.co.jp>
+Tang Chen <tangchen(a)cn.fujitsu.com>
+Peng Zhou <ailvpeng25(a)gmail.com>
+Dirk Herrendoerfer <d.herrendoerfer(a)herrendoerfer.name>
+Thibault VINCENT <thibault.vincent(a)smartjog.com>
+Aurelien Rougemont <beorn(a)binaries.fr>
+Serge E. Hallyn <serge.hallyn(a)canonical.com>
+Henrik Persson E <henrik.e.persson(a)ericsson.com>
+Philipp Hahn <hahn(a)univention.de>
+Marco Bozzolan <bozzolan(a)gmail.com>
+Pritesh Kothari <pritesh.kothari(a)sun.com>
diff --git a/AUTHORS b/AUTHORS
deleted file mode 100644
index 27c4eda..0000000
--- a/AUTHORS
+++ /dev/null
@@ -1,279 +0,0 @@
- libvirt Authors
- ===============
-
-The libvirt project was initiated by:
-
- Daniel Veillard <veillard(a)redhat.com> or <daniel(a)veillard.com>
-
-The primary maintainers and people with commit access rights:
-
- Daniel Veillard <veillard(a)redhat.com>
- Daniel Berrange <berrange(a)redhat.com>
- Richard W.M. Jones <rjones(a)redhat.com>
- Mark McLoughlin <markmc(a)redhat.com>
- Anthony Liguori <aliguori(a)us.ibm.com>
- Jim Meyering <meyering(a)redhat.com>
- Jim Fehlig <jfehlig(a)suse.com>
- Chris Lalancette <clalance(a)redhat.com>
- Cole Robinson <crobinso(a)redhat.com>
- Guido Günther <agx(a)sigxcpu.org>
- John Levon <john.levon(a)sun.com>
- Matthias Bolte <matthias.bolte(a)googlemail.com>
- Jiří Denemark <jdenemar(a)redhat.com>
- Dave Allan <dallan(a)redhat.com>
- Laine Stump <laine(a)redhat.com>
- Stefan Berger <stefanb(a)us.ibm.com>
- Eric Blake <eblake(a)redhat.com>
- Justin Clift <jclift(a)redhat.com>
- Osier Yang <jyang(a)redhat.com>
- Wen Congyang <wency(a)cn.fujitsu.com>
- Michal Prívozník <mprivozn(a)redhat.com>
- Peter Krempa <pkrempa(a)redhat.com>
- Christophe Fergeau <cfergeau(a)redhat.com>
- Alex Jia <ajia(a)redhat.com>
- Martin Kletzander <mkletzan(a)redhat.com>
-
-Previous maintainers:
- Karel Zak <kzak(a)redhat.com>
- Atsushi SAKAI <sakaia(a)jp.fujitsu.com>
- Dave Leskovec <dlesko(a)linux.vnet.ibm.com>
- Dan Smith <danms(a)us.ibm.com>
-
-Patches have also been contributed by:
-
- David Lutterkort <dlutter(a)redhat.com>
- Andrew Puch <apuch(a)redhat.com>
- Philippe Berthault <philippe.berthault(a)Bull.net>
- Hugh Brock <hbrock(a)redhat.com>
- Michel Ponceau <michel.ponceau(a)bull.net>
- Jeremy Katz <katzj(a)redhat.com>
- Pete Vetere <pvetere(a)redhat.com>
- Kazuki Mizushima <mizushima.kazuk(a)jp.fujitsu.com>
- Saori Fukuta <fukuta.saori(a)jp.fujitsu.com>
- Tatsuro Enokura <fj7716hz(a)aa.jp.fujitsu.com>
- Takahashi Tomohiro <takatom(a)jp.fujitsu.com>
- Nobuhiro Itou <fj0873gn(a)aa.jp.fujitsu.com>
- Masayuki Sunou <fj1826dm(a)aa.jp.fujitsu.com>
- Mark Johnson <johnson.nh(a)gmail.com>
- Christian Ehrhardt <ehrhardt(a)linux.vnet.ibm.com>
- Shuveb Hussain <shuveb(a)binarykarma.com>
- Jim Paris <jim(a)jtan.com>
- Daniel Hokka Zakrisson <daniel(a)hozac.com>
- Mads Chr. Olesen <shiyee(a)shiyee.dk>
- Anton Protopopov <aspsk2(a)gmail.com>
- Stefan de Konink <dekonink(a)kinkrsoftware.nl>
- Kaitlin Rupert <kaitlin(a)linux.vnet.ibm.com>
- Evgeniy Sokolov <evg(a)openvz.org>
- David Lively <dlively(a)virtualiron.com>
- Charles Duffy <Charles_Duffy(a)messageone.com>
- Nguyen Anh Quynh <aquynh(a)gmail.com>
- James Morris <jmorris(a)namei.org>
- Chris Wright <chrisw(a)redhat.com>
- Ben Guthro <ben.guthro(a)gmail.com>
- Shigeki Sakamoto <fj0588di(a)aa.jp.fujitsu.com>
- Gerd von Egidy <gerd(a)egidy.de>
- Itamar Heim <iheim(a)redhat.com>
- Markus Armbruster <armbru(a)redhat.com>
- Ryota Ozaki <ozaki.ryota(a)gmail.com>
- Daniel J Walsh <dwalsh(a)redhat.com>
- Maximilian Wilhelm <max(a)rfc2324.org>
- Pritesh Kothari <Pritesh.Kothari(a)Sun.COM>
- Amit Shah <amit.shah(a)redhat.com>
- Florian Vichot <florian.vichot(a)diateam.net>
- Serge E. Hallyn <serue(a)us.ibm.com>
- Soren Hansen <soren(a)linux2go.dk>
- Abel Míguez Rodríguez<amiguezr(a)pdi.ucm.es>
- Doug Goldstein <cardoe(a)cardoe.com>
- Javier Fontan <jfontan(a)gmail.com>
- Federico Simoncelli <fsimonce(a)redhat.com>
- Amy Griffis <amy.griffis(a)hp.com>
- Henrik Persson E <henrik.e.persson(a)ericsson.com>
- Satoru SATOH <satoru.satoh(a)gmail.com>
- Paolo Bonzini <pbonzini(a)redhat.com>
- Miloslav Trmač <mitr(a)redhat.com>
- Jamie Strandboge <jamie(a)canonical.com>
- Gerhard Stenzel <gerhard.stenzel(a)de.ibm.com>
- Matthew Booth <mbooth(a)redhat.com>
- Diego Elio Pettenò <flameeyes(a)gmail.com>
- Adam Litke <agl(a)us.ibm.com>
- Steve Yarmie <steve.yarmie(a)gmail.com>
- Dan Kenigsberg <danken(a)redhat.com>
- Yuji NISHIDA <nishidy(a)nict.go.jp>
- Dustin Xiong <x_k_123(a)hotmail.com>
- Rolf Eike Beer <eike(a)sf-mail.de>
- Wolfgang Mauerer <wolfgang.mauerer(a)siemens.com>
- Philipp Hahn <hahn(a)univention.de>
- Ed Swierk <eswierk(a)aristanetworks.com>
- Paolo Smiraglia <paolo.smiraglia(a)gmail.com>
- Sharadha Prabhakar <sharadha.prabhakar(a)citrix.com>
- Chris Wong <wongc-redhat(a)hoku.net>
- Daniel Berteaud <daniel(a)firewall-services.com>
- Dustin Kirkland <kirkland(a)canonical.com>
- Luiz Capitulino <lcapitulino(a)redhat.com>
- Ryan Harper <ryanh(a)us.ibm.com>
- Spencer Shimko <sshimko(a)tresys.com>
- Marco Bozzolan <bozzolan(a)gmail.com>
- Alex Williamson <alex.williamson(a)redhat.com>
- Ersek Laszlo <lacos(a)caesar.elte.hu>
- Kenneth Nagin <NAGIN(a)il.ibm.com>
- Klaus Ethgen <Klaus(a)Ethgen.de>
- Bryan Kearney <bkearney(a)redhat.com>
- Darry L. Pierce <dpierce(a)redhat.com>
- David Jorm <dfj(a)redhat.com>
- Eduardo Otubo <otubo(a)linux.vnet.ibm.com>
- Garry Dolley <gdolley(a)arpnetworks.com>
- Harshavardhana <harsha(a)gluster.com>
- Jonas Eriksson <jonas.j.eriksson(a)ericsson.com>
- Jun Koi <junkoi2004(a)gmail.com>
- Olivier Fourdan <ofourdan(a)redhat.com>
- Ron Yorston <rmy(a)tigress.co.uk>
- Shahar Klein <shaharklein(a)yahoo.com>
- Taizo ITO <taizo.ito(a)hde.co.jp>
- Thomas Treutner <thomas(a)scripty.at>
- Jean-Baptiste Rouault <jean-baptiste.rouault(a)diateam.net>
- Марк Коренберг <socketpair(a)gmail.com>
- Alan Pevec <apevec(a)redhat.com>
- Aurelien Rougemont <beorn(a)binaries.fr>
- Patrick Dignan <pat_dignan(a)dell.com>
- Serge Hallyn <serge.hallyn(a)canonical.com>
- Nikunj A. Dadhania <nikunj(a)linux.vnet.ibm.com>
- Lai Jiangshan <laijs(a)cn.fujitsu.com>
- Harsh Prateek Bora <harsh(a)linux.vnet.ibm.com>
- John Morrissey <jwm(a)horde.net>
- KAMEZAWA Hiroyuki <kamezawa.hiroyu(a)jp.fujitsu.com>
- Hu Tao <hutao(a)cn.fujitsu.com>
- Laurent Léonard <laurent(a)open-minds.org>
- MORITA Kazutaka <morita.kazutaka(a)lab.ntt.co.jp>
- Josh Durgin <josh.durgin(a)inktank.com>
- Roopa Prabhu <roprabhu(a)cisco.com>
- Paweł Krześniak <pawel.krzesniak(a)gmail.com>
- Kay Schubert <kayegypt(a)web.de>
- Marc-André Lureau <marcandre.lureau(a)redhat.com>
- Juerg Haefliger <juerg.haefliger(a)hp.com>
- Matthias Dahl <mdvirt(a)designassembly.de>
- Niels de Vos <ndevos(a)redhat.com>
- Davidlohr Bueso <dave(a)gnu.org>
- Alon Levy <alevy(a)redhat.com>
- Hero Phương <herophuong93(a)gmail.com>
- Zdenek Styblik <stybla(a)turnovfree.net>
- Gui Jianfeng <guijianfeng(a)cn.fujitsu.com>
- Michal Novotny <minovotn(a)redhat.com>
- Markus Groß <gross(a)univention.de>
- Phil Petty <phpetty(a)cisco.com>
- Taku Izumi <izumi.taku(a)jp.fujitsu.com>
- Minoru Usui <usui(a)mxm.nes.nec.co.jp>
- Tiziano Mueller <dev-zero(a)gentoo.org>
- Thibault VINCENT <thibault.vincent(a)smartjog.com>
- Naoya Horiguchi <n-horiguchi(a)ah.jp.nec.com>
- Jesse Cook <code.crashenx(a)gmail.com>
- Alexander Todorov <atodorov(a)otb.bg>
- Richard Laager <rlaager(a)wiktel.com>
- Mark Wu <dwu(a)redhat.com>
- Yufang Zhang <yuzhang(a)redhat.com>
- Supriya Kannery <supriyak(a)linux.vnet.ibm.com>
- Dirk Herrendoerfer <d.herrendoerfer(a)herrendoerfer.name>
- Taisuke Yamada <tai(a)rakugaki.org>
- Heath Petersen <HeathPetersen(a)Kandre.com>
- Neil Wilson <neil(a)aldur.co.uk>
- Ohad Levy <ohadlevy(a)gmail.com>
- Michael Chapman <mike(a)very.puzzling.org>
- Daniel Gollub <gollub(a)b1-systems.de>
- David S. Wang <dwang2(a)cisco.com>
- Ruben Kerkhof <ruben(a)rubenkerkhof.com>
- Scott Moser <smoser(a)ubuntu.com>
- Guannan Ren <gren(a)redhat.com>
- John Williams <john.williams(a)petalogix.com>
- Michael Santos <michael.santos(a)gmail.com>
- Oskari Saarenmaa <os(a)ohmu.fi>
- Nan Zhang <nzhang(a)redhat.com>
- Wieland Hoffmann <themineo(a)googlemail.com>
- Douglas Schilling Landgraf <dougsland(a)redhat.com>
- Tom Vijlbrief <tom.vijlbrief(a)xs4all.nl>
- Shradha Shah <sshah(a)solarflare.com>
- Steve Hodgson <shodgson(a)solarflare.com>
- Xu He Jie <xuhj(a)linux.vnet.ibm.com>
- Lei Li <lilei(a)linux.vnet.ibm.com>
- Matthias Witte <witte(a)netzquadrat.de>
- Tang Chen <tangchen(a)cn.fujitsu.com>
- Dan Horák <dan(a)danny.cz>
- Sage Weil <sage(a)newdream.net>
- David L Stevens <dlstevens(a)us.ibm.com>
- Tyler Coumbes <coumbes(a)gmail.com>
- Royce Lv <lvroyce(a)linux.vnet.ibm.com>
- Patrice LACHANCE <patlachance(a)gmail.com>
- Eli Qiao <taget(a)linux.vnet.ibm.com>
- Michael Wood <esiotrot(a)gmail.com>
- Bharata B Rao <bharata(a)linux.vnet.ibm.com>
- Srivatsa S. Bhat <srivatsa.bhat(a)linux.vnet.ibm.com>
- Chang Liu <lingjiao.lc(a)taobao.com>
- Lorin Hochstein <lorin(a)isi.edu>
- Christian Franke <nobody(a)nowhere.ws>
- Prerna Saxena <prerna(a)linux.vnet.ibm.com>
- Michael Ellerman <michael(a)ellerman.id.au>
- Rommer <rommer(a)active.by>
- Yuri Chornoivan <yurchor(a)ukr.net>
- Deepak C Shetty <deepakcs(a)linux.vnet.ibm.com>
- Laszlo Ersek <lersek(a)redhat.com>
- Zeeshan Ali (Khattak) <zeeshanak(a)gnome.org>
- Marcelo Cerri <mhcerri(a)linux.vnet.ibm.com>
- Hendrik Schwartke <hendrik(a)os-t.de>
- Ansis Atteka <aatteka(a)nicira.com>
- Dan Wendlandt <dan(a)nicira.com>
- Kyle Mestery <kmestery(a)cisco.com>
- Lincoln Myers <lincoln_myers(a)yahoo.com>
- Peter Robinson <pbrobinson(a)gmail.com>
- Benjamin Cama <benoar(a)dolka.fr>
- Duncan Rance <libvirt(a)dunquino.com>
- Peng Zhou <ailvpeng25(a)gmail.com>
- Li Zhang <zhlcindy(a)linux.vnet.ibm.com>
- Stef Walter <stefw(a)gnome.org>
- Christian Benvenuti <benve(a)cisco.com>
- Ilja Livenson <ilja.livenson(a)gmail.com>
- Stefan Bader <stefan.bader(a)canonical.com>
- MATSUDA Daiki <matsudadik(a)intellilink.co.jp>
- Jan Kiszka <jan.kiszka(a)siemens.com>
- Ryan Woodsmall <rwoodsmall(a)gmail.com>
- Wido den Hollander <wido(a)widodh.nl>
- Eugen Feller <eugen.feller(a)inria.fr>
- Dmitry Guryanov <dguryanov(a)parallels.com>
- William Jon McCann <william.jon.mccann(a)gmail.com>
- David Weber <wb(a)munzinger.de>
- Marti Raudsepp <marti(a)juffo.org>
- Radu Caragea <dmns_serp(a)yahoo.com>
- Beat Jörg <Beat.Joerg(a)ssatr.ch>
- Gao feng <gaofeng(a)cn.fujitsu.com>
- Dipankar Sarma <dipankar(a)in.ibm.com>
- Gerd Hoffmann <kraxel(a)redhat.com>
- Viktor Mihajlovski <mihajlov(a)linux.vnet.ibm.com>
- Thang Pham <thang.pham(a)us.ibm.com>
- Eiichi Tsukata <eiichi.tsukata.xh(a)hitachi.com>
- Sascha Peilicke <saschpe(a)suse.de>
- Chuck Short <chuck.short(a)canonical.com>
- Sebastian Wiedenroth <wiedi(a)frubar.net>
- Ata E Husain Bohra <ata.husain(a)hotmail.com>
- Ján Tomko <jtomko(a)redhat.com>
- Richa Marwaha <rmarwah(a)linux.vnet.ibm.com>
- Peter Feiner <peter(a)gridcentric.ca>
- Frido Roose <frido.roose(a)gmail.com>
- Asad Saeed <asad.saeed(a)acidseed.com>
- Sukadev Bhattiprolu <sukadev(a)linux.vnet.ibm.com>
- Thomas Woerner <twoerner(a)redhat.com>
- J.B. Joret <jb(a)linux.vnet.ibm.com>
- Stefan Hajnoczi <stefanha(a)linux.vnet.ibm.com>
- Gene Czarcinski <gene(a)czarc.net>
- Nishank Trivedi <nistrive(a)cisco.com>
- Jasper Lievisse Adriaanse <jasper(a)humppa.nl>
- Paul Eggert <eggert(a)cs.ucla.edu>
- Dwight Engen <dwight.engen(a)oracle.com>
- liguang <lig.fnst(a)cn.fujitsu.com>
- Chuck Short <zulcss(a)gmail.com>
- Alexander Larsson <alexl(a)redhat.com>
-
- [....send patches to get your name here....]
-
-The libvirt Logo was designed by Diana Fong
-
--- End
-;; Local Variables:
-;; coding: utf-8
-;; End:
diff --git a/AUTHORS.in b/AUTHORS.in
new file mode 100644
index 0000000..849badf
--- /dev/null
+++ b/AUTHORS.in
@@ -0,0 +1,86 @@
+ libvirt Authors
+ ===============
+
+The libvirt project was initiated by:
+
+ Daniel Veillard <veillard(a)redhat.com> or <daniel(a)veillard.com>
+
+The primary maintainers and people with commit access rights:
+
+ Daniel Veillard <veillard(a)redhat.com>
+ Daniel Berrange <berrange(a)redhat.com>
+ Richard W.M. Jones <rjones(a)redhat.com>
+ Mark McLoughlin <markmc(a)redhat.com>
+ Anthony Liguori <aliguori(a)us.ibm.com>
+ Jim Meyering <meyering(a)redhat.com>
+ Jim Fehlig <jfehlig(a)suse.com>
+ Chris Lalancette <clalance(a)redhat.com>
+ Cole Robinson <crobinso(a)redhat.com>
+ Guido Günther <agx(a)sigxcpu.org>
+ John Levon <john.levon(a)sun.com>
+ Matthias Bolte <matthias.bolte(a)googlemail.com>
+ Jiří Denemark <jdenemar(a)redhat.com>
+ Dave Allan <dallan(a)redhat.com>
+ Laine Stump <laine(a)redhat.com>
+ Stefan Berger <stefanb(a)us.ibm.com>
+ Eric Blake <eblake(a)redhat.com>
+ Justin Clift <jclift(a)redhat.com>
+ Osier Yang <jyang(a)redhat.com>
+ Wen Congyang <wency(a)cn.fujitsu.com>
+ Michal Prívozník <mprivozn(a)redhat.com>
+ Peter Krempa <pkrempa(a)redhat.com>
+ Christophe Fergeau <cfergeau(a)redhat.com>
+ Alex Jia <ajia(a)redhat.com>
+ Martin Kletzander <mkletzan(a)redhat.com>
+
+Previous maintainers:
+ Karel Zak <kzak(a)redhat.com>
+ Atsushi SAKAI <sakaia(a)jp.fujitsu.com>
+ Dave Leskovec <dlesko(a)linux.vnet.ibm.com>
+ Dan Smith <danms(a)us.ibm.com>
+
+Patches have also been contributed by:
+
+ David Lutterkort <dlutter(a)redhat.com>
+ Andrew Puch <apuch(a)redhat.com>
+ Philippe Berthault <philippe.berthault(a)Bull.net>
+ Hugh Brock <hbrock(a)redhat.com>
+ Michel Ponceau <michel.ponceau(a)bull.net>
+ Jeremy Katz <katzj(a)redhat.com>
+ Pete Vetere <pvetere(a)redhat.com>
+ Kazuki Mizushima <mizushima.kazuk(a)jp.fujitsu.com>
+ Saori Fukuta <fukuta.saori(a)jp.fujitsu.com>
+ Tatsuro Enokura <fj7716hz(a)aa.jp.fujitsu.com>
+ Takahashi Tomohiro <takatom(a)jp.fujitsu.com>
+ Nobuhiro Itou <fj0873gn(a)aa.jp.fujitsu.com>
+ Masayuki Sunou <fj1826dm(a)aa.jp.fujitsu.com>
+ Mark Johnson <johnson.nh(a)gmail.com>
+ Christian Ehrhardt <ehrhardt(a)linux.vnet.ibm.com>
+ Shuveb Hussain <shuveb(a)binarykarma.com>
+ Daniel Hokka Zakrisson <daniel(a)hozac.com>
+ Mads Chr. Olesen <shiyee(a)shiyee.dk>
+ Anton Protopopov <aspsk2(a)gmail.com>
+ Stefan de Konink <dekonink(a)kinkrsoftware.nl>
+ Kaitlin Rupert <kaitlin(a)linux.vnet.ibm.com>
+ Evgeniy Sokolov <evg(a)openvz.org>
+ David Lively <dlively(a)virtualiron.com>
+ James Morris <jmorris(a)namei.org>
+ Ben Guthro <ben.guthro(a)gmail.com>
+ Shigeki Sakamoto <fj0588di(a)aa.jp.fujitsu.com>
+ Amit Shah <amit.shah(a)redhat.com>
+ Itamar Heim <iheim(a)redhat.com>
+ Markus Armbruster <armbru(a)redhat.com>
+ Abel Míguez Rodríguez<amiguezr(a)pdi.ucm.es>
+ Javier Fontan <jfontan(a)gmail.com>
+ Matthias Witte <witte(a)netzquadrat.de>
+ Dan Wendlandt <dan(a)nicira.com>
+@authorlist@
+
+ [....send patches to get your name here....]
+
+The libvirt Logo was designed by Diana Fong
+
+-- End
+;; Local Variables:
+;; coding: utf-8
+;; End:
diff --git a/Makefile.am b/Makefile.am
index 333e300..73d6a00 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -28,6 +28,7 @@ EXTRA_DIST = \
cfg.mk \
examples/domain-events/events-python \
run.in \
+ AUTHORS.in \
$(XML_EXAMPLES)
pkgconfigdir = $(libdir)/pkgconfig
@@ -78,7 +79,7 @@ MAINTAINERCLEANFILES = .git-module-status
# disable this check
distuninstallcheck:
-dist-hook: gen-ChangeLog
+dist-hook: gen-ChangeLog gen-AUTHORS
# Generate the ChangeLog file (with all entries since the switch to git)
# and insert it into the directory we're about to use to create a tarball.
@@ -91,3 +92,12 @@ gen-ChangeLog:
rm -f $(distdir)/ChangeLog; \
mv $(distdir)/cl-t $(distdir)/ChangeLog; \
fi
+
+.PHONY: gen-AUTHORS
+gen-AUTHORS:
+ if test -d .git; then \
+ git log --pretty=format:"%aN@@@%aE" | \
+ python $(top_srcdir)/build-aux/make-authors.py > \
+ $(distdir)/AUTHORS-tmp && \
+ mv -f $(distdir)/AUTHORS-tmp $(distdir)/AUTHORS ; \
+ fi
diff --git a/bootstrap.conf b/bootstrap.conf
index f8b7c4d..c40db3d 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -223,7 +223,8 @@ if `(${PYTHON_CONFIG-python-config} --version;
PYTHON_CONFIG=true
fi
-# Automake requires that ChangeLog exist.
+# Automake requires that ChangeLog and AUTHORS exist.
+touch AUTHORS || exit 1
touch ChangeLog || exit 1
# Override bootstrap's list - we don't use mdate-sh or texinfo.tex.
diff --git a/build-aux/make-authors.py b/build-aux/make-authors.py
new file mode 100644
index 0000000..f1df62f
--- /dev/null
+++ b/build-aux/make-authors.py
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+
+#
+# make-authors.py: Generate AUTHORS file from AUTHORS.in and git
+# log output on stdin
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library. If not, see
+# <http://www.gnu.org/licenses/>.
+#
+
+import sys
+
+lines = sys.stdin.read().splitlines()
+lines.reverse()
+template = file("AUTHORS.in").read()
+
+authlist = ""
+authlist = []
+for line in lines:
+ name, email = line.split("@@@")
+ if email in template:
+ continue
+
+ entry = " %-20s <%s>" % (name.decode("utf-8"), email)
+ if entry in authlist:
+ continue
+ authlist.append(entry)
+
+template = template.split("@authorlist@")
+output = "%s%s%s" % (template[0],
+ "\n".join(authlist).encode("utf-8"),
+ template[1])
+sys.stdout.write(output)
diff --git a/cfg.mk b/cfg.mk
index e1fbf4f..eed7fd8 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -43,7 +43,6 @@ _test_script_regex = \<\(init\|test-lib\)\.sh\>
# Tests not to run as part of "make distcheck".
local-checks-to-skip = \
changelog-check \
- check-AUTHORS \
makefile-check \
makefile_path_separator_check \
patch-check \
@@ -711,20 +710,6 @@ _autogen:
$(srcdir)/autogen.sh
./config.status
-# Give credit where due:
-# Ensure that each commit author email address (possibly mapped via
-# git log's .mailmap) appears in our AUTHORS file.
-sc_check_author_list:
- @fail=0; \
- for i in $$(git log --pretty=format:%aE%n|sort -u|grep -v '^$$'); do \
- sanitized=$$(echo "$$i"|LC_ALL=C sed 's/\([^a-zA-Z0-9_@-]\)/\\\1/g'); \
- grep -iq "<$$sanitized>" $(srcdir)/AUTHORS \
- || { printf '%s\n' "$$i" >&2; fail=1; }; \
- done; \
- test $$fail = 1 \
- && echo '$(ME): committer(s) not listed in AUTHORS' >&2; \
- test $$fail = 0
-
# regenerate HACKING as part of the syntax-check
syntax-check: $(top_srcdir)/HACKING
--
1.7.11.4
5
8
Just tweak it at build time depending on what polkit version we are
building for.
---
.gitignore | 1 +
daemon/Makefile.am | 16 +++++++++++-----
daemon/libvirtd.policy-0 | 42 ------------------------------------------
daemon/libvirtd.policy-1 | 42 ------------------------------------------
daemon/libvirtd.policy.in | 42 ++++++++++++++++++++++++++++++++++++++++++
5 files changed, 54 insertions(+), 89 deletions(-)
delete mode 100644 daemon/libvirtd.policy-0
delete mode 100644 daemon/libvirtd.policy-1
create mode 100644 daemon/libvirtd.policy.in
diff --git a/.gitignore b/.gitignore
index 1cd2d45..1b22b92 100644
--- a/.gitignore
+++ b/.gitignore
@@ -55,6 +55,7 @@
/daemon/libvirtd.init
/daemon/libvirtd.pod
/daemon/libvirtd.service
+/daemon/libvirtd.policy
/daemon/test_libvirtd.aug
/docs/apibuild.py.stamp
/docs/devhelp/libvirt.devhelp
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 3405c67..f747c48 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -35,8 +35,7 @@ EXTRA_DIST = \
libvirtd.conf \
libvirtd.init.in \
libvirtd.upstart \
- libvirtd.policy-0 \
- libvirtd.policy-1 \
+ libvirtd.policy.in \
libvirtd.sasl \
libvirtd.sysconf \
libvirtd.sysctl \
@@ -173,13 +172,20 @@ libvirtd_LDADD += ../src/libvirt.la
if HAVE_POLKIT
if HAVE_POLKIT0
policydir = $(datadir)/PolicyKit/policy
-policyfile = libvirtd.policy-0
+policyauth = auth_admin_keep_session
else
policydir = $(datadir)/polkit-1/actions
-policyfile = libvirtd.policy-1
+policyauth = auth_admin_keep
endif
endif
+libvirtd.policy: libvirtd.policy.in $(top_builddir)/config.status
+ $(AM_V_GEN) sed \
+ -e 's![@]authaction[@]!$(policyauth)!g' \
+ < $< > $@-t && \
+ mv $@-t $@
+BUILT_SOURCES += libvirtd.policy
+
install-data-local: install-init-redhat install-init-systemd install-init-upstart \
install-data-sasl install-data-polkit \
install-logrotate install-sysctl
@@ -197,7 +203,7 @@ uninstall-local:: uninstall-init-redhat uninstall-init-systemd uninstall-init-up
if HAVE_POLKIT
install-data-polkit::
$(MKDIR_P) $(DESTDIR)$(policydir)
- $(INSTALL_DATA) $(srcdir)/$(policyfile) $(DESTDIR)$(policydir)/org.libvirt.unix.policy
+ $(INSTALL_DATA) $(srcdir)/libvirtd.policy $(DESTDIR)$(policydir)/org.libvirt.unix.policy
uninstall-data-polkit::
rm -f $(DESTDIR)$(policydir)/org.libvirt.unix.policy
rmdir $(DESTDIR)$(policydir) || :
diff --git a/daemon/libvirtd.policy-0 b/daemon/libvirtd.policy-0
deleted file mode 100644
index 5d6845c..0000000
--- a/daemon/libvirtd.policy-0
+++ /dev/null
@@ -1,42 +0,0 @@
-<!DOCTYPE policyconfig PUBLIC
- "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd">
-
-<!--
-Policy definitions for libvirt daemon
-
-Copyright (c) 2007 Daniel P. Berrange <berrange redhat com>
-
-libvirt is licensed to you under the GNU Lesser General Public License
-version 2. See COPYING for details.
-
-NOTE: If you make changes to this file, make sure to validate the file
-using the polkit-policy-file-validate(1) tool. Changes made to this
-file are instantly applied.
--->
-
-<policyconfig>
- <action id="org.libvirt.unix.monitor">
- <description>Monitor local virtualized systems</description>
- <message>System policy prevents monitoring of local virtualized systems</message>
- <defaults>
- <!-- Any program can use libvirt in read-only mode for monitoring,
- even if not part of a session -->
- <allow_any>yes</allow_any>
- <allow_inactive>yes</allow_inactive>
- <allow_active>yes</allow_active>
- </defaults>
- </action>
-
- <action id="org.libvirt.unix.manage">
- <description>Manage local virtualized systems</description>
- <message>System policy prevents management of local virtualized systems</message>
- <defaults>
- <!-- Only a program in the active host session can use libvirt in
- read-write mode for management, and we require user password -->
- <allow_any>auth_admin</allow_any>
- <allow_inactive>auth_admin</allow_inactive>
- <allow_active>auth_admin_keep_session</allow_active>
- </defaults>
- </action>
-</policyconfig>
diff --git a/daemon/libvirtd.policy-1 b/daemon/libvirtd.policy-1
deleted file mode 100644
index c2bec1f..0000000
--- a/daemon/libvirtd.policy-1
+++ /dev/null
@@ -1,42 +0,0 @@
-<!DOCTYPE policyconfig PUBLIC
- "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd">
-
-<!--
-Policy definitions for libvirt daemon
-
-Copyright (c) 2007 Daniel P. Berrange <berrange redhat com>
-
-libvirt is licensed to you under the GNU Lesser General Public License
-version 2. See COPYING for details.
-
-NOTE: If you make changes to this file, make sure to validate the file
-using the polkit-policy-file-validate(1) tool. Changes made to this
-file are instantly applied.
--->
-
-<policyconfig>
- <action id="org.libvirt.unix.monitor">
- <description>Monitor local virtualized systems</description>
- <message>System policy prevents monitoring of local virtualized systems</message>
- <defaults>
- <!-- Any program can use libvirt in read-only mode for monitoring,
- even if not part of a session -->
- <allow_any>yes</allow_any>
- <allow_inactive>yes</allow_inactive>
- <allow_active>yes</allow_active>
- </defaults>
- </action>
-
- <action id="org.libvirt.unix.manage">
- <description>Manage local virtualized systems</description>
- <message>System policy prevents management of local virtualized systems</message>
- <defaults>
- <!-- Only a program in the active host session can use libvirt in
- read-write mode for management, and we require user password -->
- <allow_any>auth_admin</allow_any>
- <allow_inactive>auth_admin</allow_inactive>
- <allow_active>auth_admin_keep</allow_active>
- </defaults>
- </action>
-</policyconfig>
diff --git a/daemon/libvirtd.policy.in b/daemon/libvirtd.policy.in
new file mode 100644
index 0000000..45b0d79
--- /dev/null
+++ b/daemon/libvirtd.policy.in
@@ -0,0 +1,42 @@
+<!DOCTYPE policyconfig PUBLIC
+ "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd">
+
+<!--
+Policy definitions for libvirt daemon
+
+Copyright (c) 2007 Daniel P. Berrange <berrange redhat com>
+
+libvirt is licensed to you under the GNU Lesser General Public License
+version 2. See COPYING for details.
+
+NOTE: If you make changes to this file, make sure to validate the file
+using the polkit-policy-file-validate(1) tool. Changes made to this
+file are instantly applied.
+-->
+
+<policyconfig>
+ <action id="org.libvirt.unix.monitor">
+ <description>Monitor local virtualized systems</description>
+ <message>System policy prevents monitoring of local virtualized systems</message>
+ <defaults>
+ <!-- Any program can use libvirt in read-only mode for monitoring,
+ even if not part of a session -->
+ <allow_any>yes</allow_any>
+ <allow_inactive>yes</allow_inactive>
+ <allow_active>yes</allow_active>
+ </defaults>
+ </action>
+
+ <action id="org.libvirt.unix.manage">
+ <description>Manage local virtualized systems</description>
+ <message>System policy prevents management of local virtualized systems</message>
+ <defaults>
+ <!-- Only a program in the active host session can use libvirt in
+ read-write mode for management, and we require user password -->
+ <allow_any>auth_admin</allow_any>
+ <allow_inactive>auth_admin</allow_inactive>
+ <allow_active>@authaction@</allow_active>
+ </defaults>
+ </action>
+</policyconfig>
--
1.7.11.4
3
5
Commit e8fd8757c89abbd38571092bbb987650b7658aec changed 'const char *'
category to virLogSource enum. This changes it in virLogEatParams as
well, thus fixing the build with --disable-debug.
--
Hopefully moving the enum declarations is less ugly than using int.
---
src/util/logging.h | 60 ++++++++++++++++++++++++++--------------------------
1 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/src/util/logging.h b/src/util/logging.h
index 4fe0c8e..c67377f 100644
--- a/src/util/logging.h
+++ b/src/util/logging.h
@@ -26,6 +26,35 @@
# include "buf.h"
/*
+ * To be made public
+ */
+typedef enum {
+ VIR_LOG_DEBUG = 1,
+ VIR_LOG_INFO,
+ VIR_LOG_WARN,
+ VIR_LOG_ERROR,
+} virLogPriority;
+
+# define VIR_LOG_DEFAULT VIR_LOG_WARN
+
+typedef enum {
+ VIR_LOG_TO_STDERR = 1,
+ VIR_LOG_TO_SYSLOG,
+ VIR_LOG_TO_FILE,
+ VIR_LOG_TO_JOURNALD,
+} virLogDestination;
+
+typedef enum {
+ VIR_LOG_FROM_FILE,
+ VIR_LOG_FROM_ERROR,
+ VIR_LOG_FROM_AUDIT,
+ VIR_LOG_FROM_TRACE,
+ VIR_LOG_FROM_LIBRARY,
+
+ VIR_LOG_FROM_LAST,
+} virLogSource;
+
+/*
* If configured with --enable-debug=yes then library calls
* are printed to stderr for debugging or to an appropriate channel
* defined at runtime from the libvirt daemon configuration file
@@ -39,7 +68,7 @@
*
* Do nothing but eat parameters.
*/
-static inline void virLogEatParams(const char *unused, ...)
+static inline void virLogEatParams(virLogSource unused, ...)
{
/* Silence gcc */
unused = unused;
@@ -64,35 +93,6 @@ static inline void virLogEatParams(const char *unused, ...)
# define VIR_ERROR(...) \
VIR_ERROR_INT(VIR_LOG_FROM_FILE, __FILE__, __LINE__, __func__, __VA_ARGS__)
-/*
- * To be made public
- */
-typedef enum {
- VIR_LOG_DEBUG = 1,
- VIR_LOG_INFO,
- VIR_LOG_WARN,
- VIR_LOG_ERROR,
-} virLogPriority;
-
-# define VIR_LOG_DEFAULT VIR_LOG_WARN
-
-typedef enum {
- VIR_LOG_TO_STDERR = 1,
- VIR_LOG_TO_SYSLOG,
- VIR_LOG_TO_FILE,
- VIR_LOG_TO_JOURNALD,
-} virLogDestination;
-
-typedef enum {
- VIR_LOG_FROM_FILE,
- VIR_LOG_FROM_ERROR,
- VIR_LOG_FROM_AUDIT,
- VIR_LOG_FROM_TRACE,
- VIR_LOG_FROM_LIBRARY,
-
- VIR_LOG_FROM_LAST,
-} virLogSource;
-
/**
* virLogOutputFunc:
* @src: the src for the message
--
1.7.8.6
3
2
[libvirt] [PATCH] node_memory: Add new parameter field to tune the new sysfs knob
by Osier Yang 15 Oct '12
by Osier Yang 15 Oct '12
15 Oct '12
Upstream kernel introduced new sysfs knob "merge_across_nodes" to
specify if pages from different numa nodes can be merged. When set
to 0, only pages which physically reside in the memory area of
same NUMA node can be merged. When set to 1, pages from all nodes
can be merged.
This patch supports the tuning by adding new param field
"shm-merge-across-nodes".
---
Perhaps two bool options like "--disable-shm-merge-across-nodes",
and "--enable-shm-merge-across-nodes" are good, but could the
kernel sysfs knob have other values beyond 0 and 1 in future?
---
include/libvirt/libvirt.h.in | 10 ++++++++++
src/nodeinfo.c | 26 +++++++++++++++++++++++---
tools/virsh-host.c | 20 ++++++++++++++++++++
tools/virsh.pod | 5 ++++-
4 files changed, 57 insertions(+), 4 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 81f12a4..56ee2f5 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -4489,6 +4489,16 @@ typedef virMemoryParameter *virMemoryParameterPtr;
*/
# define VIR_NODE_MEMORY_SHARED_FULL_SCANS "shm_full_scans"
+/* VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES:
+ *
+ * Macro for typed parameter that represents whether pages from
+ * different NUMA nodes can be merged, when its value is 0, only
+ * pages which physically reside in the memory area of same NUMA
+ * node are merged, otherwise pages from all nodes can be merged.
+ */
+# define VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES "shm_merge_across_nodes"
+
+
int virNodeGetMemoryParameters(virConnectPtr conn,
virTypedParameterPtr params,
int *nparams,
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 021eb05..6002789 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -1004,6 +1004,13 @@ nodeSetMemoryParameters(virConnectPtr conn ATTRIBUTE_UNUSED,
/* Out of memory */
if (ret == -2)
return -1;
+ } else if (STREQ(param->field,
+ VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES)) {
+ ret = nodeSetMemoryParameterValue("merge_across_nodes", param);
+
+ /* Out of memory */
+ if (ret == -2)
+ return -1;
}
}
@@ -1039,8 +1046,9 @@ nodeGetMemoryParameterValue(const char *field,
if ((tmp = strchr(buf, '\n')))
*tmp = '\0';
- if (STREQ(field, "pages_to_scan") ||
- STREQ(field, "sleep_millisecs"))
+ if (STREQ(field, "pages_to_scan") ||
+ STREQ(field, "sleep_millisecs") ||
+ STREQ(field, "merge_across_nodes"))
rc = virStrToLong_ui(buf, NULL, 10, (unsigned int *)value);
else if (STREQ(field, "pages_shared") ||
STREQ(field, "pages_sharing") ||
@@ -1063,7 +1071,7 @@ cleanup:
}
#endif
-#define NODE_MEMORY_PARAMETERS_NUM 7
+#define NODE_MEMORY_PARAMETERS_NUM 8
int
nodeGetMemoryParameters(virConnectPtr conn ATTRIBUTE_UNUSED,
virTypedParameterPtr params ATTRIBUTE_UNUSED,
@@ -1075,6 +1083,7 @@ nodeGetMemoryParameters(virConnectPtr conn ATTRIBUTE_UNUSED,
#ifdef __linux__
unsigned int pages_to_scan;
unsigned int sleep_millisecs;
+ unsigned int merge_across_nodes;
unsigned long long pages_shared;
unsigned long long pages_sharing;
unsigned long long pages_unshared;
@@ -1168,6 +1177,17 @@ nodeGetMemoryParameters(virConnectPtr conn ATTRIBUTE_UNUSED,
break;
+ case 7:
+ if (nodeGetMemoryParameterValue("merge_across_nodes",
+ &merge_across_nodes) < 0)
+ return -1;
+
+ if (virTypedParameterAssign(param, VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES,
+ VIR_TYPED_PARAM_UINT, merge_across_nodes) < 0)
+ return -1;
+
+ break;
+
default:
break;
}
diff --git a/tools/virsh-host.c b/tools/virsh-host.c
index 2c46336..62ecafc 100644
--- a/tools/virsh-host.c
+++ b/tools/virsh-host.c
@@ -900,6 +900,8 @@ static const vshCmdOptDef opts_node_memory_tune[] = {
{"shm-sleep-millisecs", VSH_OT_INT, VSH_OFLAG_NONE,
N_("number of millisecs the shared memory service should "
"sleep before next scan")},
+ {"shm-merge-across-nodes", VSH_OT_INT, VSH_OFLAG_NONE,
+ N_("Specifies if pages from different numa nodes can be merged")},
{NULL, 0, 0, NULL}
};
@@ -911,6 +913,7 @@ cmdNodeMemoryTune(vshControl *ctl, const vshCmd *cmd)
unsigned int flags = 0;
unsigned int shm_pages_to_scan = 0;
unsigned int shm_sleep_millisecs = 0;
+ unsigned int shm_merge_across_nodes = 0;
bool ret = false;
int i = 0;
@@ -926,12 +929,21 @@ cmdNodeMemoryTune(vshControl *ctl, const vshCmd *cmd)
return false;
}
+ if (vshCommandOptUInt(cmd, "shm-merge-across-nodes",
+ &shm_merge_across_nodes) < 0) {
+ vshError(ctl, "%s", _("invalid shm-merge-across-nodes number"));
+ return false;
+ }
+
if (shm_pages_to_scan)
nparams++;
if (shm_sleep_millisecs)
nparams++;
+ if (shm_merge_across_nodes)
+ nparams++;
+
if (nparams == 0) {
/* Get the number of memory parameters */
if (virNodeGetMemoryParameters(ctl->conn, NULL, &nparams, flags) != 0) {
@@ -983,6 +995,14 @@ cmdNodeMemoryTune(vshControl *ctl, const vshCmd *cmd)
goto error;
}
+ if (i < nparams && shm_merge_across_nodes) {
+ if (virTypedParameterAssign(¶ms[i++],
+ VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES,
+ VIR_TYPED_PARAM_UINT,
+ shm_merge_across_nodes) < 0)
+ goto error;
+ }
+
if (virNodeSetMemoryParameters(ctl->conn, params, nparams, flags) != 0)
goto error;
else
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 2120429..d975f06 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -299,7 +299,10 @@ Allows you to display or set the node memory parameters.
I<shm-pages-to-scan> can be used to set the number of pages to scan
before the shared memory service goes to sleep; I<shm-sleep-millisecs>
can be used to set the number of millisecs the shared memory service should
-sleep before next scan.
+sleep before next scan; I<shm-merge-across-nodes> specifies if pages from
+different numa nodes can be merged. When set to 0, only pages which physically
+reside in the memory area of same NUMA node can be merged. When set to 1,
+pages from all nodes can be merged. Default to 1.
=item B<capabilities>
--
1.7.7.3
3
6
I've pushed that one already under the build breaker rule:
that broke "make syntax-check"
found by http://honk.sigxcpu.org:8001/job/libvirt-syntax-check/157/
Pushed under the build breaker rule.
---
src/qemu/qemu_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b3e8424..b380d2d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3731,7 +3731,7 @@ static int qemudDomainHotplugVcpus(struct qemud_driver *driver,
}
virCgroupFree(&cgroup_vcpu);
- }
+ }
} else {
for (i = oldvcpus - 1; i >= nvcpus; i--) {
virDomainVcpuPinDefPtr vcpupin = NULL;
--
1.7.10.4
2
2
by using the same condition as for the <cpuset>.
Fixes "make check" found by
http://honk.sigxcpu.org:8001/job/libvirt-check/160/
---
src/conf/domain_conf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index cb80f09..83d7742 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -13663,8 +13663,8 @@ virDomainDefFormatInternal(virDomainDefPtr def,
virBufferAsprintf(buf, "cpuset='%s'/>\n", cpumask);
VIR_FREE(cpumask);
}
-
- if (def->cputune.shares || def->cputune.vcpupin ||
+ if (def->cputune.shares ||
+ (def->cputune.vcpupin && !virDomainIsAllVcpupinInherited(def)) ||
def->cputune.period || def->cputune.quota ||
def->cputune.emulatorpin ||
def->cputune.emulator_period || def->cputune.emulator_quota)
--
1.7.10.4
3
3
(V1 of this patch is in the following thread:
https://www.redhat.com/archives/libvir-list/2012-October/msg00542.html
I'm posting it because PATCH 4/4 of that series attempts to use
apparently non-existent/non-working functionality in qemu; modifying
PATCH 3/4 slightly gives back some of the functionality lost by not
having 4/4. Once this is ACKed, I will push 1-3 only, and leave 4/4
untilits problem is discovered/resolved)
****
This patch resolves:
https://bugzilla.redhat.com/show_bug.cgi?id=805071
to the extent that it can be resolved with current qemu functionality.
It attempts to detect as many situations as possible when the simple
operation of disconnecting an existing tap device from one bridge and
attaching it to another will satisfy the change requested in
virDomainUpdateDeviceFlags() for a network device. Before this patch,
that situation could only be detected if the pre-change interface
*and* the post-change interface definition were both "type='bridge'".
After this patch, it can also be detected if the before or after
interfaces are any combination of type='bridge' and type='network'
(the networks can be <forward mode='nat|route|bridge'>, as long as
they use a Linux host bridge and not macvtap connections).
This extra effort is especially useful since the recent discovery that
a netdev_del+netdev_add combo (to reconnect the network device with
completely different hostside configuration) doesn't work properly
with current qemu (1.2) unless it is accompanied by the matching
device_del+device_add - see this mailing list message for details:
http://lists.nongnu.org/archive/html/qemu-devel/2012-10/msg02355.html
(A slight modification of the patch referenced there has been prepared
to apply on top of this patch, but won't be pushed until qemu can be
made to work with it.)
* qemuDomainChangeNet needs access to the virDomainDeviceDef that
holds the new netdef (so that it can clear out the virDomainDeviceDef
if it ends up using the NetDef to replace the original), so the
virDomainNetDefPtr arg is replaced with a virDomainDeviceDefPtr.
* qemuDomainChangeNet previously checked for *some* changes to the
interface config, but this check was by no means complete. It was also
a bit disorganized.
This refactoring of the code is (I believe) complete in its check of
all NetDef attributes that might be changed, and either returns a
failure (for changes that are simply impossible), or sets one of three
flags:
needLinkStateChange - if the device link state needs to go up/down
needBridgeChange - if everything else is the same, but it needs
to be connected to a difference linux host
bridge
needReconnect - if the entire host side of the device needs
to be torn down and reconstructed (currently
non-working, as mentioned above)
Note that this function will refuse to make any change that requires
the *guest* side of the device to be detached (e.g. changing the PCI
address or mac address). Those would be disruptive enough to the guest
that it's reasonable to require an explicit detach/attach sequence
from the management application.
* As mentioned above, qemuDomainChangeNet also does its best to
understand when a simple change in attached bridge for the existing
tap device will work vs. the need to completely tear down/reconstruct
the host side of the device (including tap device).
This patch *does not* implement the "reconnect" code anyway - there is
a placeholder that turns that into an error. Rather, the purpose of
this patch is to replicate existing behavior with code that is ready
to have that functionality plugged in in a later patch.
* The expanded uses for qemuDomainChangeNetBridge meant that it needed
to be enhanced as well - it no longer replaces the original brname
string in olddev with the new brname; instead, it relies on the
caller to replace the *entire* olddev with newdev (since we've gone
to great lengths to assure they are functionally identical other
than the name of the bridge, this is now not only safe, but more
correct). Additionally, qemuDomainNetChangeBridge can now set the
bridge for type='network' interfaces as well as plain type='bridge'
interfaces. (Note that I had to make this change simultaneous to the
reorganization of qemuDomainChangeNet because the two are too
closely intertwined to separate).
---
src/qemu/qemu_driver.c | 2 +-
src/qemu/qemu_hotplug.c | 502 ++++++++++++++++++++++++++++++++++++++----------
src/qemu/qemu_hotplug.h | 4 +-
3 files changed, 401 insertions(+), 107 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 0787039..3a78465 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5987,7 +5987,7 @@ qemuDomainUpdateDeviceLive(virDomainObjPtr vm,
ret = qemuDomainChangeGraphics(driver, vm, dev->data.graphics);
break;
case VIR_DOMAIN_DEVICE_NET:
- ret = qemuDomainChangeNet(driver, vm, dom, dev->data.net)
+ ret = qemuDomainChangeNet(driver, vm, dom, dev);
break;
default:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 78f1278..0fe236f 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -33,6 +33,7 @@
#include "domain_audit.h"
#include "domain_nwfilter.h"
#include "logging.h"
+#include "datatypes.h"
#include "virterror_internal.h"
#include "memory.h"
#include "pci.h"
@@ -1209,27 +1210,88 @@ cleanup:
return -1;
}
-static virDomainNetDefPtr qemuDomainFindNet(virDomainObjPtr vm,
- virDomainNetDefPtr dev)
+static virDomainNetDefPtr *qemuDomainFindNet(virDomainObjPtr vm,
+ virDomainNetDefPtr dev)
{
int i;
for (i = 0; i < vm->def->nnets; i++) {
if (virMacAddrCmp(&vm->def->nets[i]->mac, &dev->mac) == 0)
- return vm->def->nets[i];
+ return &vm->def->nets[i];
}
return NULL;
}
-static
-int qemuDomainChangeNetBridge(virDomainObjPtr vm,
- virDomainNetDefPtr olddev,
- virDomainNetDefPtr newdev)
+static char *
+qemuDomainNetGetBridgeName(virConnectPtr conn, virDomainNetDefPtr net)
+{
+ char *brname = NULL;
+ int actualType = virDomainNetGetActualType(net);
+
+ if (actualType == VIR_DOMAIN_NET_TYPE_BRIDGE) {
+ const char *tmpbr = virDomainNetGetActualBridgeName(net);
+ if (!tmpbr) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("interface is missing bridge name"));
+ goto cleanup;
+ }
+ /* we need a copy, not just a pointer to the original */
+ if (!(brname = strdup(tmpbr))) {
+ virReportOOMError();
+ goto cleanup;
+ }
+ } else if (actualType == VIR_DOMAIN_NET_TYPE_NETWORK) {
+ int active;
+ virErrorPtr errobj;
+ virNetworkPtr network;
+
+ if (!(network = virNetworkLookupByName(conn, net->data.network.name))) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Couldn't find network '%s'"),
+ net->data.network.name);
+ goto cleanup;
+ }
+
+ active = virNetworkIsActive(network);
+ if (active == 1) {
+ brname = virNetworkGetBridgeName(network);
+ } else if (active == 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Network '%s' is not active."),
+ net->data.network.name);
+ }
+
+ /* Make sure any above failure is preserved */
+ errobj = virSaveLastError();
+ virNetworkFree(network);
+ virSetError(errobj);
+ virFreeError(errobj);
+ goto cleanup;
+
+ }
+
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Network type %d is not supported"),
+ virDomainNetGetActualType(net));
+cleanup:
+ return brname;
+}
+
+static int
+qemuDomainChangeNetBridge(virConnectPtr conn,
+ virDomainObjPtr vm,
+ virDomainNetDefPtr olddev,
+ virDomainNetDefPtr newdev)
{
int ret = -1;
- char *oldbridge = olddev->data.bridge.brname;
- char *newbridge = newdev->data.bridge.brname;
+ char *oldbridge = NULL, *newbridge = NULL;
+
+ if (!(oldbridge = qemuDomainNetGetBridgeName(conn, olddev)))
+ goto cleanup;
+
+ if (!(newbridge = qemuDomainNetGetBridgeName(conn, newdev)))
+ goto cleanup;
VIR_DEBUG("Change bridge for interface %s: %s -> %s",
olddev->ifname, oldbridge, newbridge);
@@ -1237,23 +1299,19 @@ int qemuDomainChangeNetBridge(virDomainObjPtr vm,
if (virNetDevExists(newbridge) != 1) {
virReportError(VIR_ERR_OPERATION_FAILED,
_("bridge %s doesn't exist"), newbridge);
- return -1;
+ goto cleanup;
}
if (oldbridge) {
ret = virNetDevBridgeRemovePort(oldbridge, olddev->ifname);
virDomainAuditNet(vm, olddev, NULL, "detach", ret == 0);
if (ret < 0)
- return -1;
+ goto cleanup;
}
- /* move newbridge into olddev now so Audit log is correct */
- olddev->data.bridge.brname = newbridge;
ret = virNetDevBridgeAddPort(newbridge, olddev->ifname);
- virDomainAuditNet(vm, NULL, olddev, "attach", ret == 0);
+ virDomainAuditNet(vm, NULL, newdev, "attach", ret == 0);
if (ret < 0) {
- /* restore oldbridge to olddev */
- olddev->data.bridge.brname = oldbridge;
ret = virNetDevBridgeAddPort(oldbridge, olddev->ifname);
virDomainAuditNet(vm, NULL, olddev, "attach", ret == 0);
if (ret < 0) {
@@ -1261,12 +1319,14 @@ int qemuDomainChangeNetBridge(virDomainObjPtr vm,
_("unable to recover former state by adding port "
"to bridge %s"), oldbridge);
}
- return -1;
+ goto cleanup;
}
- /* oldbridge no longer needed, and newbridge moved to olddev */
+ /* caller will replace entire olddev with newdev in domain nets list */
+ ret = 0;
+cleanup:
VIR_FREE(oldbridge);
- newdev->data.bridge.brname = NULL;
- return 0;
+ VIR_FREE(newbridge);
+ return ret;
}
int qemuDomainChangeNetLinkState(struct qemud_driver *driver,
@@ -1300,124 +1360,358 @@ cleanup:
return ret;
}
-int qemuDomainChangeNet(struct qemud_driver *driver,
- virDomainObjPtr vm,
- virDomainPtr dom ATTRIBUTE_UNUSED,
- virDomainNetDefPtr dev)
-
+int
+qemuDomainChangeNet(struct qemud_driver *driver,
+ virDomainObjPtr vm,
+ virDomainPtr dom,
+ virDomainDeviceDefPtr dev)
{
- virDomainNetDefPtr olddev = qemuDomainFindNet(vm, dev);
- int ret = 0;
+ virDomainNetDefPtr newdev = dev->data.net;
+ virDomainNetDefPtr *devslot = qemuDomainFindNet(vm, newdev);
+ virDomainNetDefPtr olddev;
+ int oldType, newType;
+ bool needReconnect = false;
+ bool needBridgeChange = false;
+ bool needLinkStateChange = false;
+ bool needReplaceDevDef = false;
+ int ret = -1;
- if (!olddev) {
+ if (!devslot || !(olddev = *devslot)) {
virReportError(VIR_ERR_NO_SUPPORT, "%s",
_("cannot find existing network device to modify"));
- return -1;
+ goto cleanup;
+ }
+
+ oldType = virDomainNetGetActualType(olddev);
+ if (oldType == VIR_DOMAIN_NET_TYPE_HOSTDEV) {
+ /* no changes are possible to a type='hostdev' interface */
+ virReportError(VIR_ERR_NO_SUPPORT,
+ _("cannot change config of '%s' network type"),
+ virDomainNetTypeToString(oldType));
+ goto cleanup;
}
- if (olddev->type != dev->type) {
+ /* Check individual attributes for changes that can't be done to a
+ * live netdev. These checks *mostly* go in order of the
+ * declarations in virDomainNetDef in order to assure nothing is
+ * omitted. (exceptiong where noted in comments - in particular,
+ * some things require that a new "actual device" be allocated
+ * from the network driver first, but we delay doing that until
+ * after we've made as many other checks as possible)
+ */
+
+ /* type: this can change (with some restrictions), but the actual
+ * type of the new device connection isn't known until after we
+ * allocate the "actual" device.
+ */
+
+ if (virMacAddrCmp(&olddev->mac, &newdev->mac)) {
+ char oldmac[VIR_MAC_STRING_BUFLEN], newmac[VIR_MAC_STRING_BUFLEN];
+
+ virReportError(VIR_ERR_NO_SUPPORT,
+ _("cannot change network interface mac address "
+ "from %s to %s"),
+ virMacAddrFormat(&olddev->mac, oldmac),
+ virMacAddrFormat(&newdev->mac, newmac));
+ goto cleanup;
+ }
+
+ if (STRNEQ_NULLABLE(olddev->model, newdev->model)) {
+ virReportError(VIR_ERR_NO_SUPPORT,
+ _("cannot modify network device model from %s to %s"),
+ olddev->model ? olddev->model : "(default)",
+ newdev->model ? newdev->model : "(default)");
+ goto cleanup;
+ }
+
+ if (olddev->model && STREQ(olddev->model, "virtio") &&
+ (olddev->driver.virtio.name != newdev->driver.virtio.name ||
+ olddev->driver.virtio.txmode != newdev->driver.virtio.txmode ||
+ olddev->driver.virtio.ioeventfd != newdev->driver.virtio.ioeventfd ||
+ olddev->driver.virtio.event_idx != newdev->driver.virtio.event_idx)) {
virReportError(VIR_ERR_NO_SUPPORT, "%s",
- _("cannot change network interface type"));
- return -1;
+ _("cannot modify virtio network device driver attributes"));
+ goto cleanup;
}
- if (!virNetDevVPortProfileEqual(olddev->virtPortProfile, dev->virtPortProfile)) {
+ /* data: this union will be examined later, after allocating new actualdev */
+ /* virtPortProfile: will be examined later, after allocating new actualdev */
+
+ if (olddev->tune.sndbuf_specified != newdev->tune.sndbuf_specified ||
+ olddev->tune.sndbuf != newdev->tune.sndbuf) {
+ needReconnect = true;
+ }
+
+ if (STRNEQ_NULLABLE(olddev->script, newdev->script)) {
virReportError(VIR_ERR_NO_SUPPORT, "%s",
- _("cannot change <virtualport> settings"));
+ _("cannot modify network device script attribute"));
+ goto cleanup;
}
- switch (olddev->type) {
- case VIR_DOMAIN_NET_TYPE_USER:
- break;
+ /* ifname: check if it's set in newdev. If not, retain the autogenerated one */
+ if (!(newdev->ifname ||
+ (newdev->ifname = strdup(olddev->ifname)))) {
+ virReportOOMError();
+ goto cleanup;
+ }
+ if (STRNEQ_NULLABLE(olddev->ifname, newdev->ifname)) {
+ virReportError(VIR_ERR_NO_SUPPORT, "%s",
+ _("cannot modify network device tap name"));
+ goto cleanup;
+ }
- case VIR_DOMAIN_NET_TYPE_ETHERNET:
- if (STRNEQ_NULLABLE(olddev->data.ethernet.dev, dev->data.ethernet.dev) ||
- STRNEQ_NULLABLE(olddev->script, dev->script) ||
- STRNEQ_NULLABLE(olddev->data.ethernet.ipaddr, dev->data.ethernet.ipaddr)) {
- virReportError(VIR_ERR_NO_SUPPORT, "%s",
- _("cannot modify ethernet network device configuration"));
- return -1;
- }
- break;
+ /* info: if newdev->info is empty, fill it in from olddev,
+ * otherwise verify that it matches - nothing is allowed to
+ * change. (There is no helper function to do this, so
+ * individually check the few feidls of virDomainDeviceInfo that
+ * are relevant in this case).
+ */
+ if (!virDomainDeviceAddressIsValid(&newdev->info,
+ VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) &&
+ virDomainDeviceInfoCopy(&newdev->info, &olddev->info) < 0) {
+ goto cleanup;
+ }
+ if (!virDevicePCIAddressEqual(&olddev->info.addr.pci,
+ &newdev->info.addr.pci)) {
+ virReportError(VIR_ERR_NO_SUPPORT, "%s",
+ _("cannot modify network device guest PCI address"));
+ goto cleanup;
+ }
+ /* grab alias from olddev if not set in newdev */
+ if (!(newdev->info.alias ||
+ (newdev->info.alias = strdup(olddev->info.alias)))) {
+ virReportOOMError();
+ goto cleanup;
+ }
+ if (STRNEQ_NULLABLE(olddev->info.alias, newdev->info.alias)) {
+ virReportError(VIR_ERR_NO_SUPPORT, "%s",
+ _("cannot modify network device alias"));
+ goto cleanup;
+ }
+ if (olddev->info.rombar != newdev->info.rombar) {
+ virReportError(VIR_ERR_NO_SUPPORT, "%s",
+ _("cannot modify network device rom bar setting"));
+ goto cleanup;
+ }
+ if (STRNEQ_NULLABLE(olddev->info.romfile, newdev->info.romfile)) {
+ virReportError(VIR_ERR_NO_SUPPORT, "%s",
+ _("cannot modify network rom file"));
+ goto cleanup;
+ }
+ if (olddev->info.bootIndex != newdev->info.bootIndex) {
+ virReportError(VIR_ERR_NO_SUPPORT, "%s",
+ _("cannot modify network device boot index setting"));
+ goto cleanup;
+ }
+ /* (end of device info checks) */
- case VIR_DOMAIN_NET_TYPE_SERVER:
- case VIR_DOMAIN_NET_TYPE_CLIENT:
- case VIR_DOMAIN_NET_TYPE_MCAST:
- if (STRNEQ_NULLABLE(olddev->data.socket.address, dev->data.socket.address) ||
- olddev->data.socket.port != dev->data.socket.port) {
- virReportError(VIR_ERR_NO_SUPPORT, "%s",
- _("cannot modify network socket device configuration"));
- return -1;
- }
- break;
+ if (STRNEQ_NULLABLE(olddev->filter, newdev->filter))
+ needReconnect = true;
- case VIR_DOMAIN_NET_TYPE_NETWORK:
- if (STRNEQ_NULLABLE(olddev->data.network.name, dev->data.network.name) ||
- STRNEQ_NULLABLE(olddev->data.network.portgroup, dev->data.network.portgroup)) {
- virReportError(VIR_ERR_NO_SUPPORT, "%s",
- _("cannot modify network device configuration"));
- return -1;
- }
+ /* bandwidth can be modified, and will be checked later */
+ /* vlan can be modified, and will be checked later */
+ /* linkstate can be modified */
+
+ /* allocate new actual device to compare to old - we will need to
+ * free it if we fail for any reason
+ */
+ if (newdev->type == VIR_DOMAIN_NET_TYPE_NETWORK &&
+ networkAllocateActualDevice(newdev) < 0) {
+ goto cleanup;
+ }
+
+ newType = virDomainNetGetActualType(newdev);
+
+ if (newType == VIR_DOMAIN_NET_TYPE_HOSTDEV) {
+ /* can't turn it into a type='hostdev' interface */
+ virReportError(VIR_ERR_NO_SUPPORT,
+ _("cannot change network interface type to '%s'"),
+ virDomainNetTypeToString(newType));
+ goto cleanup;
+ }
+
+ if (olddev->type == newdev->type && oldType == newType) {
+ /* if type hasn't changed, check the relevant fields for the type */
+ switch (newdev->type) {
+ case VIR_DOMAIN_NET_TYPE_USER:
+ break;
+
+ case VIR_DOMAIN_NET_TYPE_ETHERNET:
+ if (STRNEQ_NULLABLE(olddev->data.ethernet.dev,
+ newdev->data.ethernet.dev) ||
+ STRNEQ_NULLABLE(olddev->script, newdev->script) ||
+ STRNEQ_NULLABLE(olddev->data.ethernet.ipaddr,
+ newdev->data.ethernet.ipaddr)) {
+ needReconnect = true;
+ }
break;
- case VIR_DOMAIN_NET_TYPE_BRIDGE:
- /* allow changing brname */
- break;
+ case VIR_DOMAIN_NET_TYPE_SERVER:
+ case VIR_DOMAIN_NET_TYPE_CLIENT:
+ case VIR_DOMAIN_NET_TYPE_MCAST:
+ if (STRNEQ_NULLABLE(olddev->data.socket.address,
+ newdev->data.socket.address) ||
+ olddev->data.socket.port != newdev->data.socket.port) {
+ needReconnect = true;
+ }
+ break;
+
+ case VIR_DOMAIN_NET_TYPE_NETWORK:
+ if (STRNEQ(olddev->data.network.name, newdev->data.network.name)) {
+ if (virDomainNetGetActualVirtPortProfile(newdev))
+ needReconnect = true;
+ else
+ needBridgeChange = true;
+ }
+ /* other things handled in common code directly below this switch */
+ break;
+
+ case VIR_DOMAIN_NET_TYPE_BRIDGE:
+ /* all handled in bridge name checked in common code below */
+ break;
+
+ case VIR_DOMAIN_NET_TYPE_INTERNAL:
+ if (STRNEQ_NULLABLE(olddev->data.internal.name,
+ newdev->data.internal.name)) {
+ needReconnect = true;
+ }
+ break;
+
+ case VIR_DOMAIN_NET_TYPE_DIRECT:
+ /* all handled in common code directly below this switch */
+ break;
+
+ default:
+ virReportError(VIR_ERR_NO_SUPPORT,
+ _("unable to change config on '%s' network type"),
+ virDomainNetTypeToString(newdev->type));
+ break;
- case VIR_DOMAIN_NET_TYPE_INTERNAL:
- if (STRNEQ_NULLABLE(olddev->data.internal.name, dev->data.internal.name)) {
- virReportError(VIR_ERR_NO_SUPPORT, "%s",
- _("cannot modify internal network device configuration"));
- return -1;
}
- break;
+ } else {
+ /* interface type has changed. There are a few special cases
+ * where this can only require a minor (or even no) change,
+ * but in most cases we need to do a full reconnection.
+ *
+ * If we switch (in either direction) between type='bridge'
+ * and type='network' (for a traditional managed virtual
+ * network that uses a host bridge, i.e. forward
+ * mode='route|nat'), we just need to change the bridge.
+ */
+ if ((oldType == VIR_DOMAIN_NET_TYPE_NETWORK &&
+ newType == VIR_DOMAIN_NET_TYPE_BRIDGE) ||
+ (oldType == VIR_DOMAIN_NET_TYPE_BRIDGE &&
+ newType == VIR_DOMAIN_NET_TYPE_NETWORK)) {
+
+ needBridgeChange = true;
+
+ } else if (oldType == VIR_DOMAIN_NET_TYPE_DIRECT &&
+ newType == VIR_DOMAIN_NET_TYPE_DIRECT) {
+
+ /* this is the case of switching from type='direct' to
+ * type='network' for a network that itself uses direct
+ * (macvtap) devices. If the physical device and mode are
+ * the same, this doesn't require any actual setup
+ * change. If the physical device or mode *does* change,
+ * that will be caught in the common section below */
+
+ } else {
+
+ /* for all other combinations, we'll need a full reconnect */
+ needReconnect = true;
- case VIR_DOMAIN_NET_TYPE_DIRECT:
- if (STRNEQ_NULLABLE(olddev->data.direct.linkdev, dev->data.direct.linkdev) ||
- olddev->data.direct.mode != dev->data.direct.mode) {
- virReportError(VIR_ERR_NO_SUPPORT, "%s",
- _("cannot modify direct network device configuration"));
- return -1;
}
- break;
+ }
- default:
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("unable to change config on '%s' network type"),
- virDomainNetTypeToString(dev->type));
- break;
+ /* now several things that are in multiple (but not all)
+ * different types, and can be safely compared even for those
+ * cases where they don't apply to a particular type.
+ */
+ if (STRNEQ_NULLABLE(virDomainNetGetActualBridgeName(olddev),
+ virDomainNetGetActualBridgeName(newdev))) {
+ if (virDomainNetGetActualVirtPortProfile(newdev))
+ needReconnect = true;
+ else
+ needBridgeChange = true;
+ }
+ if (STRNEQ_NULLABLE(virDomainNetGetActualDirectDev(olddev),
+ virDomainNetGetActualDirectDev(newdev)) ||
+ virDomainNetGetActualDirectMode(olddev) != virDomainNetGetActualDirectMode(olddev) ||
+ !virNetDevVPortProfileEqual(virDomainNetGetActualVirtPortProfile(olddev),
+ virDomainNetGetActualVirtPortProfile(newdev)) ||
+ !virNetDevBandwidthEqual(virDomainNetGetActualBandwidth(olddev),
+ virDomainNetGetActualBandwidth(newdev)) ||
+ !virNetDevVlanEqual(virDomainNetGetActualVlan(olddev),
+ virDomainNetGetActualVlan(newdev))) {
+ needReconnect = true;
}
- /* all other unmodifiable parameters */
- if (STRNEQ_NULLABLE(olddev->model, dev->model) ||
- STRNEQ_NULLABLE(olddev->filter, dev->filter)) {
- virReportError(VIR_ERR_NO_SUPPORT, "%s",
- _("cannot modify network device configuration"));
- return -1;
+ if (olddev->linkstate != newdev->linkstate)
+ needLinkStateChange = true;
+
+ /* FINALLY - actually perform the required actions */
+
+ if (needReconnect) {
+ virReportError(VIR_ERR_NO_SUPPORT,
+ _("unable to change config on '%s' network type"),
+ virDomainNetTypeToString(newdev->type));
+ goto cleanup;
}
- /* check if device name has been set, if no, retain the autogenerated one */
- if (dev->ifname &&
- STRNEQ_NULLABLE(olddev->ifname, dev->ifname)) {
- virReportError(VIR_ERR_NO_SUPPORT, "%s",
- _("cannot modify network device configuration"));
- return -1;
+ if (needBridgeChange) {
+ if (qemuDomainChangeNetBridge(dom->conn, vm, olddev, newdev) < 0)
+ goto cleanup;
+ /* we successfully switched to the new bridge, and we've
+ * determined that the rest of newdev is equivalent to olddev,
+ * so move newdev into place, so that the */
+ needReplaceDevDef = true;
}
- if (olddev->type == VIR_DOMAIN_NET_TYPE_BRIDGE
- && STRNEQ_NULLABLE(olddev->data.bridge.brname,
- dev->data.bridge.brname)) {
- if ((ret = qemuDomainChangeNetBridge(vm, olddev, dev)) < 0)
- return ret;
+ if (needLinkStateChange &&
+ qemuDomainChangeNetLinkState(driver, vm, olddev, newdev->linkstate) < 0) {
+ goto cleanup;
}
- if (olddev->linkstate != dev->linkstate) {
- if ((ret = qemuDomainChangeNetLinkState(driver, vm, olddev, dev->linkstate)) < 0)
- return ret;
+ if (needReplaceDevDef) {
+ /* the changes above warrant replacing olddev with newdev in
+ * the domain's nets list.
+ */
+ networkReleaseActualDevice(olddev);
+ virDomainNetDefFree(olddev);
+ /* move newdev into the nets list, and NULL it out from the
+ * virDomainDeviceDef that we were given so that the caller
+ * won't delete it on return.
+ */
+ *devslot = newdev;
+ newdev = dev->data.net = NULL;
+ dev->type = VIR_DOMAIN_DEVICE_NONE;
}
+ ret = 0;
+cleanup:
+ /* When we get here, we will be in one of these two states:
+ *
+ * 1) newdev has been moved into the domain's list of nets and
+ * newdev set to NULL, and dev->data.net will be NULL (and
+ * dev->type is NONE). olddev will have been completely
+ * released and freed. (aka success) In this case no extra
+ * cleanup is needed.
+ *
+ * 2) newdev has *not* been moved into the domain's list of nets,
+ * and dev->data.net == newdev (and dev->type == NET). In this *
+ * case, we need to at least release the "actual device" from *
+ * newdev (the caller will free dev->data.net a.k.a. newdev, and
+ * the original olddev is still in used)
+ *
+ * Note that case (2) isn't necessarily a failure. It may just be
+ * that the changes were minor enough that we didn't need to
+ * replace the entire device object.
+ */
+ if (newdev)
+ networkReleaseActualDevice(newdev);
+
return ret;
}
diff --git a/src/qemu/qemu_hotplug.h b/src/qemu/qemu_hotplug.h
index 36c0580..a7864c3 100644
--- a/src/qemu/qemu_hotplug.h
+++ b/src/qemu/qemu_hotplug.h
@@ -1,7 +1,7 @@
/*
* qemu_hotplug.h: QEMU device hotplug management
*
- * Copyright (C) 2006-2007, 2009-2011 Red Hat, Inc.
+ * Copyright (C) 2006-2007, 2009-2012 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -77,7 +77,7 @@ int qemuDomainChangeGraphicsPasswords(struct qemud_driver *driver,
int qemuDomainChangeNet(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainPtr dom,
- virDomainNetDefPtr dev);
+ virDomainDeviceDefPtr dev);
int qemuDomainChangeNetLinkState(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainNetDefPtr dev,
--
1.7.11.7
2
1
Hi,
Currently virInitialize() method defined in libvirt.c has the following code:
int
virInitialize(void)
{
if (initialized)
return 0;
initialized = 1;
if (virThreadInitialize() < 0 ||
virErrorInitialize() < 0 ||
virRandomInitialize(time(NULL) ^ getpid()) ||
virNodeSuspendInit() < 0)
return -1;
......
}
When two threads access virInitialize method, there is no lock for the "initialized" parameter. If the first thread enters this method and set "initialized" to 1,
the second thread could see that "initialized" is 1(Because initialized is not volatiled, I say could). In some situation, before the first thread finishes all the initialization,
the second thread could use some resources which should be initialized in Initialize method.
If you have any comments, please let me know. Thanks!
B.R.
Benjamin Wang
4
7
1.my libvirtd version is 0.9.10. i rebuild qemu with --enable-rbd.
it seems not work if guest-os has a rbd disk.
-----rbd disk info ----
<disk type='network' device='disk'>
<driver name='qemu' type='raw'/>
<auth username='cloud'>
<secret type='ceph' uuid='7a91dc24-b072-43c4-98fb-4b2415322b0f'/>
</auth>
<source protocol='rbd' name='cloud/testrbd'>
<host name='192.168.10.4' port='6789'/>
</source>
<target dev='vdb' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</disk>
2.-----------------------error log---------
LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin HOME=/root USER=root LOGNAME=root QEMU_AUDIO_DRV=none /usr/libexec/qemu-kvm -S -M rhel6.2.0 -enable-kvm -m 512 -smp 1,sockets=1,cores=1,threads=1 -name xpSP3 -uuid b45bd66a-6700-4905-c5f4-4c799413d7b7 -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/xpSP3.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=localtime,driftfix=slew -no-shutdown -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive file=/var/lib/libvirt/images/xpSP3.img,if=none,id=drive-ide0-0-0,format=raw,cache=none -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 -drive file=rbd:cloud/testrbd:id=cloud:key=AQCGbGRQ+M+NGBAATtylZNiSxqCTQ4uaApd+9w==:auth_supported=cephx none:mon_host=192.168.10.4\:6789,if=none,id=drive-virtio-disk1,format=raw -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x6,drive=drive-virtio-disk1,id=virtio-disk1 -netdev tap,fd=26,id=hostnet0 -device e!
1000,netdev=hostnet0,id=net0,mac=52:54:00:2a:8c:48,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -device usb-tablet,id=input0 -vnc 0.0.0.0:0 -vga std -device intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5
Domain id=6 is tainted: high-privileges
char device redirected to /dev/pts/4
qemu-kvm: -drive file=rbd:cloud/testrbd:id=cloud:key=AQCGbGRQ+M+NGBAATtylZNiSxqCTQ4uaApd+9w==:auth_supported=cephx none:mon_host=192.168.10.4\:6789,if=none,id=drive-virtio-disk1,format=raw: could not open disk image rbd:cloud/testrbd:id=cloud:key=AQCGbGRQ+M+NGBAATtylZNiSxqCTQ4uaApd+9w==:auth_supported=cephx none:mon_host=192.168.10.4\:6789: No such file or directory
2012-10-11 10:37:24.215+0000: shutting down
3
11