mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
Add support for the wakeup event
This patch introduces a new event type for the QMP event WAKEUP: VIR_DOMAIN_EVENT_ID_PMWAKEUP The event doesn't take any data, but considering there might be reason for wakeup in future, the callback definition is: typedef void (*virConnectDomainEventWakeupCallback)(virConnectPtr conn, virDomainPtr dom, int reason, void *opaque); "reason" is unused currently, always passes "0".
This commit is contained in:
parent
2d19e33f97
commit
57ddcc235a
@ -538,6 +538,29 @@ static int remoteRelayDomainEventTrayChange(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int remoteRelayDomainEventPMWakeup(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||||
|
virDomainPtr dom,
|
||||||
|
void *opaque) {
|
||||||
|
virNetServerClientPtr client = opaque;
|
||||||
|
remote_domain_event_pmwakeup_msg data;
|
||||||
|
|
||||||
|
if (!client)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
VIR_DEBUG("Relaying domain %s %d system pmwakeup", 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_PMWAKEUP,
|
||||||
|
(xdrproc_t)xdr_remote_domain_event_pmwakeup_msg, &data);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static virConnectDomainEventGenericCallback domainEventCallbacks[] = {
|
static virConnectDomainEventGenericCallback domainEventCallbacks[] = {
|
||||||
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventLifecycle),
|
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventLifecycle),
|
||||||
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventReboot),
|
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventReboot),
|
||||||
@ -550,6 +573,7 @@ static virConnectDomainEventGenericCallback domainEventCallbacks[] = {
|
|||||||
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventBlockJob),
|
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventBlockJob),
|
||||||
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventDiskChange),
|
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventDiskChange),
|
||||||
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventTrayChange),
|
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventTrayChange),
|
||||||
|
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventPMWakeup),
|
||||||
};
|
};
|
||||||
|
|
||||||
verify(ARRAY_CARDINALITY(domainEventCallbacks) == VIR_DOMAIN_EVENT_ID_LAST);
|
verify(ARRAY_CARDINALITY(domainEventCallbacks) == VIR_DOMAIN_EVENT_ID_LAST);
|
||||||
|
@ -330,6 +330,16 @@ static int myDomainEventTrayChangeCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int myDomainEventPMWakeupCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||||
|
virDomainPtr dom,
|
||||||
|
int reason ATTRIBUTE_UNUSED,
|
||||||
|
void *opaque ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
printf("%s EVENT: Domain %s(%d) system pmwakeup",
|
||||||
|
__func__, virDomainGetName(dom), virDomainGetID(dom));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void myFreeFunc(void *opaque)
|
static void myFreeFunc(void *opaque)
|
||||||
{
|
{
|
||||||
char *str = opaque;
|
char *str = opaque;
|
||||||
@ -366,6 +376,7 @@ int main(int argc, char **argv)
|
|||||||
int callback8ret = -1;
|
int callback8ret = -1;
|
||||||
int callback9ret = -1;
|
int callback9ret = -1;
|
||||||
int callback10ret = -1;
|
int callback10ret = -1;
|
||||||
|
int callback11ret = -1;
|
||||||
struct sigaction action_stop;
|
struct sigaction action_stop;
|
||||||
|
|
||||||
memset(&action_stop, 0, sizeof action_stop);
|
memset(&action_stop, 0, sizeof action_stop);
|
||||||
@ -441,7 +452,11 @@ int main(int argc, char **argv)
|
|||||||
VIR_DOMAIN_EVENT_ID_TRAY_CHANGE,
|
VIR_DOMAIN_EVENT_ID_TRAY_CHANGE,
|
||||||
VIR_DOMAIN_EVENT_CALLBACK(myDomainEventTrayChangeCallback),
|
VIR_DOMAIN_EVENT_CALLBACK(myDomainEventTrayChangeCallback),
|
||||||
strdup("tray change"), myFreeFunc);
|
strdup("tray change"), myFreeFunc);
|
||||||
|
callback11ret = virConnectDomainEventRegisterAny(dconn,
|
||||||
|
NULL,
|
||||||
|
VIR_DOMAIN_EVENT_ID_PMWAKEUP,
|
||||||
|
VIR_DOMAIN_EVENT_CALLBACK(myDomainEventPMWakeupCallback),
|
||||||
|
strdup("pmwakeup"), myFreeFunc);
|
||||||
if ((callback1ret != -1) &&
|
if ((callback1ret != -1) &&
|
||||||
(callback2ret != -1) &&
|
(callback2ret != -1) &&
|
||||||
(callback3ret != -1) &&
|
(callback3ret != -1) &&
|
||||||
@ -450,7 +465,8 @@ int main(int argc, char **argv)
|
|||||||
(callback6ret != -1) &&
|
(callback6ret != -1) &&
|
||||||
(callback7ret != -1) &&
|
(callback7ret != -1) &&
|
||||||
(callback9ret != -1) &&
|
(callback9ret != -1) &&
|
||||||
(callback10ret != -1)) {
|
(callback10ret != -1) &&
|
||||||
|
(callback11ret != -1)) {
|
||||||
if (virConnectSetKeepAlive(dconn, 5, 3) < 0) {
|
if (virConnectSetKeepAlive(dconn, 5, 3) < 0) {
|
||||||
virErrorPtr err = virGetLastError();
|
virErrorPtr err = virGetLastError();
|
||||||
fprintf(stderr, "Failed to start keepalive protocol: %s\n",
|
fprintf(stderr, "Failed to start keepalive protocol: %s\n",
|
||||||
@ -476,6 +492,7 @@ int main(int argc, char **argv)
|
|||||||
virConnectDomainEventDeregisterAny(dconn, callback7ret);
|
virConnectDomainEventDeregisterAny(dconn, callback7ret);
|
||||||
virConnectDomainEventDeregisterAny(dconn, callback9ret);
|
virConnectDomainEventDeregisterAny(dconn, callback9ret);
|
||||||
virConnectDomainEventDeregisterAny(dconn, callback10ret);
|
virConnectDomainEventDeregisterAny(dconn, callback10ret);
|
||||||
|
virConnectDomainEventDeregisterAny(dconn, callback11ret);
|
||||||
if (callback8ret != -1)
|
if (callback8ret != -1)
|
||||||
virConnectDomainEventDeregisterAny(dconn, callback8ret);
|
virConnectDomainEventDeregisterAny(dconn, callback8ret);
|
||||||
}
|
}
|
||||||
|
@ -477,6 +477,9 @@ def myDomainEventDiskChangeCallback(conn, dom, oldSrcPath, newSrcPath, devAlias,
|
|||||||
def myDomainEventTrayChangeCallback(conn, dom, devAlias, reason, opaque):
|
def myDomainEventTrayChangeCallback(conn, dom, devAlias, reason, opaque):
|
||||||
print "myDomainEventTrayChangeCallback: Domain %s(%s) tray change devAlias: %s reason: %s" % (
|
print "myDomainEventTrayChangeCallback: Domain %s(%s) tray change devAlias: %s reason: %s" % (
|
||||||
dom.name(), dom.ID(), devAlias, reason)
|
dom.name(), dom.ID(), devAlias, reason)
|
||||||
|
def myDomainEventPMWakeupCallback(conn, dom, reason, opaque):
|
||||||
|
print "myDomainEventPMWakeupCallback: Domain %s(%s) system pmwakeup" % (
|
||||||
|
dom.name(), dom.ID())
|
||||||
def usage(out=sys.stderr):
|
def usage(out=sys.stderr):
|
||||||
print >>out, "usage: "+os.path.basename(sys.argv[0])+" [-hdl] [uri]"
|
print >>out, "usage: "+os.path.basename(sys.argv[0])+" [-hdl] [uri]"
|
||||||
print >>out, " uri will default to qemu:///system"
|
print >>out, " uri will default to qemu:///system"
|
||||||
@ -536,6 +539,7 @@ def main():
|
|||||||
vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_GRAPHICS, myDomainEventGraphicsCallback, None)
|
vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_GRAPHICS, myDomainEventGraphicsCallback, None)
|
||||||
vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_DISK_CHANGE, myDomainEventDiskChangeCallback, None)
|
vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_DISK_CHANGE, myDomainEventDiskChangeCallback, None)
|
||||||
vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_TRAY_CHANGE, myDomainEventTrayChangeCallback, None)
|
vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_TRAY_CHANGE, myDomainEventTrayChangeCallback, None)
|
||||||
|
vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_PMWAKEUP, myDomainEventPMWakeupCallback, None)
|
||||||
|
|
||||||
vc.setKeepAlive(5, 3)
|
vc.setKeepAlive(5, 3)
|
||||||
|
|
||||||
|
@ -3700,6 +3700,23 @@ typedef void (*virConnectDomainEventTrayChangeCallback)(virConnectPtr conn,
|
|||||||
int reason,
|
int reason,
|
||||||
void *opaque);
|
void *opaque);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* virConnectDomainEventPMWakeupCallback:
|
||||||
|
* @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 waken up.
|
||||||
|
*
|
||||||
|
* The callback signature to use when registering for an event of type
|
||||||
|
* VIR_DOMAIN_EVENT_ID_PMWAKEUP with virConnectDomainEventRegisterAny()
|
||||||
|
*/
|
||||||
|
typedef void (*virConnectDomainEventPMWakeupCallback)(virConnectPtr conn,
|
||||||
|
virDomainPtr dom,
|
||||||
|
int reason,
|
||||||
|
void *opaque);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VIR_DOMAIN_EVENT_CALLBACK:
|
* VIR_DOMAIN_EVENT_CALLBACK:
|
||||||
@ -3722,6 +3739,7 @@ typedef enum {
|
|||||||
VIR_DOMAIN_EVENT_ID_BLOCK_JOB = 8, /* virConnectDomainEventBlockJobCallback */
|
VIR_DOMAIN_EVENT_ID_BLOCK_JOB = 8, /* virConnectDomainEventBlockJobCallback */
|
||||||
VIR_DOMAIN_EVENT_ID_DISK_CHANGE = 9, /* virConnectDomainEventDiskChangeCallback */
|
VIR_DOMAIN_EVENT_ID_DISK_CHANGE = 9, /* virConnectDomainEventDiskChangeCallback */
|
||||||
VIR_DOMAIN_EVENT_ID_TRAY_CHANGE = 10, /* virConnectDomainEventTrayChangeCallback */
|
VIR_DOMAIN_EVENT_ID_TRAY_CHANGE = 10, /* virConnectDomainEventTrayChangeCallback */
|
||||||
|
VIR_DOMAIN_EVENT_ID_PMWAKEUP = 11, /* virConnectDomainEventPMWakeupCallback */
|
||||||
|
|
||||||
#ifdef VIR_ENUM_SENTINELS
|
#ifdef VIR_ENUM_SENTINELS
|
||||||
/*
|
/*
|
||||||
|
@ -143,6 +143,14 @@
|
|||||||
cb(self, virDomain(self, _obj=dom), devAlias, reason, opaque)
|
cb(self, virDomain(self, _obj=dom), devAlias, reason, opaque)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
def _dispatchDomainEventPMWakeupCallback(self, dom, reason, cbData):
|
||||||
|
"""Dispatches event to python user domain pmwakeup event callbacks
|
||||||
|
"""
|
||||||
|
cb = cbData["cb"]
|
||||||
|
opaque = cbData["opaque"]
|
||||||
|
|
||||||
|
cb(self, virDomain(self, _obj=dom), reason, opaque)
|
||||||
|
return 0;
|
||||||
|
|
||||||
def domainEventDeregisterAny(self, callbackID):
|
def domainEventDeregisterAny(self, callbackID):
|
||||||
"""Removes a Domain Event Callback. De-registering for a
|
"""Removes a Domain Event Callback. De-registering for a
|
||||||
|
@ -5152,6 +5152,53 @@ libvirt_virConnectDomainEventTrayChangeCallback(virConnectPtr conn ATTRIBUTE_UNU
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
libvirt_virConnectDomainEventPMWakeupCallback(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*)"_dispatchDomainEventPMWakeupCallback",
|
||||||
|
(char*)"OO",
|
||||||
|
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 *
|
static PyObject *
|
||||||
libvirt_virConnectDomainEventRegisterAny(ATTRIBUTE_UNUSED PyObject * self,
|
libvirt_virConnectDomainEventRegisterAny(ATTRIBUTE_UNUSED PyObject * self,
|
||||||
PyObject * args)
|
PyObject * args)
|
||||||
@ -5215,6 +5262,9 @@ libvirt_virConnectDomainEventRegisterAny(ATTRIBUTE_UNUSED PyObject * self,
|
|||||||
case VIR_DOMAIN_EVENT_ID_TRAY_CHANGE:
|
case VIR_DOMAIN_EVENT_ID_TRAY_CHANGE:
|
||||||
cb = VIR_DOMAIN_EVENT_CALLBACK(libvirt_virConnectDomainEventTrayChangeCallback);
|
cb = VIR_DOMAIN_EVENT_CALLBACK(libvirt_virConnectDomainEventTrayChangeCallback);
|
||||||
break;
|
break;
|
||||||
|
case VIR_DOMAIN_EVENT_ID_PMWAKEUP:
|
||||||
|
cb = VIR_DOMAIN_EVENT_CALLBACK(libvirt_virConnectDomainEventPMWakeupCallback);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cb) {
|
if (!cb) {
|
||||||
|
@ -1094,6 +1094,30 @@ virDomainEventPtr virDomainEventTrayChangeNewFromDom(virDomainPtr dom,
|
|||||||
devAlias, reason);
|
devAlias, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static virDomainEventPtr
|
||||||
|
virDomainEventPMWakeupNew(int id, const char *name,
|
||||||
|
unsigned char *uuid)
|
||||||
|
{
|
||||||
|
virDomainEventPtr ev =
|
||||||
|
virDomainEventNewInternal(VIR_DOMAIN_EVENT_ID_PMWAKEUP,
|
||||||
|
id, name, uuid);
|
||||||
|
|
||||||
|
return ev;
|
||||||
|
}
|
||||||
|
|
||||||
|
virDomainEventPtr
|
||||||
|
virDomainEventPMWakeupNewFromObj(virDomainObjPtr obj)
|
||||||
|
{
|
||||||
|
return virDomainEventPMWakeupNew(obj->def->id,
|
||||||
|
obj->def->name,
|
||||||
|
obj->def->uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
virDomainEventPtr
|
||||||
|
virDomainEventPMWakeupNewFromDom(virDomainPtr dom)
|
||||||
|
{
|
||||||
|
return virDomainEventPMWakeupNew(dom->id, dom->name, dom->uuid);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virDomainEventQueuePush:
|
* virDomainEventQueuePush:
|
||||||
@ -1225,6 +1249,10 @@ virDomainEventDispatchDefaultFunc(virConnectPtr conn,
|
|||||||
cbopaque);
|
cbopaque);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case VIR_DOMAIN_EVENT_ID_PMWAKEUP:
|
||||||
|
((virConnectDomainEventPMWakeupCallback)cb)(conn, dom, 0, cbopaque);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
VIR_WARN("Unexpected event ID %d", event->eventID);
|
VIR_WARN("Unexpected event ID %d", event->eventID);
|
||||||
break;
|
break;
|
||||||
|
@ -120,6 +120,8 @@ virDomainEventPtr virDomainEventTrayChangeNewFromObj(virDomainObjPtr obj,
|
|||||||
virDomainEventPtr virDomainEventTrayChangeNewFromDom(virDomainPtr dom,
|
virDomainEventPtr virDomainEventTrayChangeNewFromDom(virDomainPtr dom,
|
||||||
const char *devAlias,
|
const char *devAlias,
|
||||||
int reason);
|
int reason);
|
||||||
|
virDomainEventPtr virDomainEventPMWakeupNewFromObj(virDomainObjPtr obj);
|
||||||
|
virDomainEventPtr virDomainEventPMWakeupNewFromDom(virDomainPtr dom);
|
||||||
|
|
||||||
void virDomainEventFree(virDomainEventPtr event);
|
void virDomainEventFree(virDomainEventPtr event);
|
||||||
|
|
||||||
|
@ -508,6 +508,8 @@ virDomainEventNew;
|
|||||||
virDomainEventNewFromDef;
|
virDomainEventNewFromDef;
|
||||||
virDomainEventNewFromDom;
|
virDomainEventNewFromDom;
|
||||||
virDomainEventNewFromObj;
|
virDomainEventNewFromObj;
|
||||||
|
virDomainEventPMWakeupNewFromDom;
|
||||||
|
virDomainEventPMWakeupNewFromObj;
|
||||||
virDomainEventRTCChangeNewFromDom;
|
virDomainEventRTCChangeNewFromDom;
|
||||||
virDomainEventRTCChangeNewFromObj;
|
virDomainEventRTCChangeNewFromObj;
|
||||||
virDomainEventRebootNew;
|
virDomainEventRebootNew;
|
||||||
|
@ -1053,6 +1053,16 @@ int qemuMonitorEmitTrayChange(qemuMonitorPtr mon,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int qemuMonitorEmitPMWakeup(qemuMonitorPtr mon)
|
||||||
|
{
|
||||||
|
int ret = -1;
|
||||||
|
VIR_DEBUG("mon=%p", mon);
|
||||||
|
|
||||||
|
QEMU_MONITOR_CALLBACK(mon, ret, domainPMWakeup, mon->vm);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
int qemuMonitorEmitBlockJob(qemuMonitorPtr mon,
|
int qemuMonitorEmitBlockJob(qemuMonitorPtr mon,
|
||||||
const char *diskAlias,
|
const char *diskAlias,
|
||||||
int type,
|
int type,
|
||||||
|
@ -128,6 +128,8 @@ struct _qemuMonitorCallbacks {
|
|||||||
virDomainObjPtr vm,
|
virDomainObjPtr vm,
|
||||||
const char *devAlias,
|
const char *devAlias,
|
||||||
int reason);
|
int reason);
|
||||||
|
int (*domainPMWakeup)(qemuMonitorPtr mon,
|
||||||
|
virDomainObjPtr vm);
|
||||||
};
|
};
|
||||||
|
|
||||||
char *qemuMonitorEscapeArg(const char *in);
|
char *qemuMonitorEscapeArg(const char *in);
|
||||||
@ -197,6 +199,7 @@ int qemuMonitorEmitGraphics(qemuMonitorPtr mon,
|
|||||||
int qemuMonitorEmitTrayChange(qemuMonitorPtr mon,
|
int qemuMonitorEmitTrayChange(qemuMonitorPtr mon,
|
||||||
const char *devAlias,
|
const char *devAlias,
|
||||||
int reason);
|
int reason);
|
||||||
|
int qemuMonitorEmitPMWakeup(qemuMonitorPtr mon);
|
||||||
int qemuMonitorEmitBlockJob(qemuMonitorPtr mon,
|
int qemuMonitorEmitBlockJob(qemuMonitorPtr mon,
|
||||||
const char *diskAlias,
|
const char *diskAlias,
|
||||||
int type,
|
int type,
|
||||||
|
@ -63,6 +63,7 @@ static void qemuMonitorJSONHandleSPICEConnect(qemuMonitorPtr mon, virJSONValuePt
|
|||||||
static void qemuMonitorJSONHandleSPICEInitialize(qemuMonitorPtr mon, virJSONValuePtr data);
|
static void qemuMonitorJSONHandleSPICEInitialize(qemuMonitorPtr mon, virJSONValuePtr data);
|
||||||
static void qemuMonitorJSONHandleSPICEDisconnect(qemuMonitorPtr mon, virJSONValuePtr data);
|
static void qemuMonitorJSONHandleSPICEDisconnect(qemuMonitorPtr mon, virJSONValuePtr data);
|
||||||
static void qemuMonitorJSONHandleTrayChange(qemuMonitorPtr mon, virJSONValuePtr data);
|
static void qemuMonitorJSONHandleTrayChange(qemuMonitorPtr mon, virJSONValuePtr data);
|
||||||
|
static void qemuMonitorJSONHandlePMWakeup(qemuMonitorPtr mon, virJSONValuePtr data);
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
const char *type;
|
const char *type;
|
||||||
@ -83,6 +84,7 @@ static struct {
|
|||||||
{ "SPICE_INITIALIZED", qemuMonitorJSONHandleSPICEInitialize, },
|
{ "SPICE_INITIALIZED", qemuMonitorJSONHandleSPICEInitialize, },
|
||||||
{ "SPICE_DISCONNECTED", qemuMonitorJSONHandleSPICEDisconnect, },
|
{ "SPICE_DISCONNECTED", qemuMonitorJSONHandleSPICEDisconnect, },
|
||||||
{ "DEVICE_TRAY_MOVED", qemuMonitorJSONHandleTrayChange, },
|
{ "DEVICE_TRAY_MOVED", qemuMonitorJSONHandleTrayChange, },
|
||||||
|
{ "WAKEUP", qemuMonitorJSONHandlePMWakeup, },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -801,6 +803,13 @@ qemuMonitorJSONHandleTrayChange(qemuMonitorPtr mon,
|
|||||||
qemuMonitorEmitTrayChange(mon, devAlias, reason);
|
qemuMonitorEmitTrayChange(mon, devAlias, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
qemuMonitorJSONHandlePMWakeup(qemuMonitorPtr mon,
|
||||||
|
virJSONValuePtr data ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
qemuMonitorEmitPMWakeup(mon);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
qemuMonitorJSONHumanCommandWithFd(qemuMonitorPtr mon,
|
qemuMonitorJSONHumanCommandWithFd(qemuMonitorPtr mon,
|
||||||
const char *cmd_str,
|
const char *cmd_str,
|
||||||
|
@ -1061,6 +1061,26 @@ qemuProcessHandleTrayChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
qemuProcessHandlePMWakeup(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
||||||
|
virDomainObjPtr vm)
|
||||||
|
{
|
||||||
|
struct qemud_driver *driver = qemu_driver;
|
||||||
|
virDomainEventPtr event = NULL;
|
||||||
|
|
||||||
|
virDomainObjLock(vm);
|
||||||
|
event = virDomainEventPMWakeupNewFromObj(vm);
|
||||||
|
|
||||||
|
virDomainObjUnlock(vm);
|
||||||
|
|
||||||
|
if (event) {
|
||||||
|
qemuDriverLock(driver);
|
||||||
|
qemuDomainEventQueue(driver, event);
|
||||||
|
qemuDriverUnlock(driver);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static qemuMonitorCallbacks monitorCallbacks = {
|
static qemuMonitorCallbacks monitorCallbacks = {
|
||||||
.destroy = qemuProcessHandleMonitorDestroy,
|
.destroy = qemuProcessHandleMonitorDestroy,
|
||||||
@ -1076,6 +1096,7 @@ static qemuMonitorCallbacks monitorCallbacks = {
|
|||||||
.domainGraphics = qemuProcessHandleGraphics,
|
.domainGraphics = qemuProcessHandleGraphics,
|
||||||
.domainBlockJob = qemuProcessHandleBlockJob,
|
.domainBlockJob = qemuProcessHandleBlockJob,
|
||||||
.domainTrayChange = qemuProcessHandleTrayChange,
|
.domainTrayChange = qemuProcessHandleTrayChange,
|
||||||
|
.domainPMWakeup = qemuProcessHandlePMWakeup,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -244,6 +244,11 @@ remoteDomainBuildEventTrayChange(virNetClientProgramPtr prog,
|
|||||||
virNetClientPtr client,
|
virNetClientPtr client,
|
||||||
void *evdata, void *opaque);
|
void *evdata, void *opaque);
|
||||||
|
|
||||||
|
static void
|
||||||
|
remoteDomainBuildEventPMWakeup(virNetClientProgramPtr prog,
|
||||||
|
virNetClientPtr client,
|
||||||
|
void *evdata, void *opaque);
|
||||||
|
|
||||||
static virNetClientProgramEvent remoteDomainEvents[] = {
|
static virNetClientProgramEvent remoteDomainEvents[] = {
|
||||||
{ REMOTE_PROC_DOMAIN_EVENT_RTC_CHANGE,
|
{ REMOTE_PROC_DOMAIN_EVENT_RTC_CHANGE,
|
||||||
remoteDomainBuildEventRTCChange,
|
remoteDomainBuildEventRTCChange,
|
||||||
@ -289,6 +294,10 @@ static virNetClientProgramEvent remoteDomainEvents[] = {
|
|||||||
remoteDomainBuildEventTrayChange,
|
remoteDomainBuildEventTrayChange,
|
||||||
sizeof(remote_domain_event_tray_change_msg),
|
sizeof(remote_domain_event_tray_change_msg),
|
||||||
(xdrproc_t)xdr_remote_domain_event_tray_change_msg },
|
(xdrproc_t)xdr_remote_domain_event_tray_change_msg },
|
||||||
|
{ REMOTE_PROC_DOMAIN_EVENT_PMWAKEUP,
|
||||||
|
remoteDomainBuildEventPMWakeup,
|
||||||
|
sizeof(remote_domain_event_pmwakeup_msg),
|
||||||
|
(xdrproc_t)xdr_remote_domain_event_pmwakeup_msg },
|
||||||
};
|
};
|
||||||
|
|
||||||
enum virDrvOpenRemoteFlags {
|
enum virDrvOpenRemoteFlags {
|
||||||
@ -3764,6 +3773,27 @@ remoteDomainBuildEventTrayChange(virNetClientProgramPtr prog ATTRIBUTE_UNUSED,
|
|||||||
remoteDomainEventQueue(priv, event);
|
remoteDomainEventQueue(priv, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
remoteDomainBuildEventPMWakeup(virNetClientProgramPtr prog ATTRIBUTE_UNUSED,
|
||||||
|
virNetClientPtr client ATTRIBUTE_UNUSED,
|
||||||
|
void *evdata, void *opaque)
|
||||||
|
{
|
||||||
|
virConnectPtr conn = opaque;
|
||||||
|
struct private_data *priv = conn->privateData;
|
||||||
|
remote_domain_event_pmwakeup_msg *msg = evdata;
|
||||||
|
virDomainPtr dom;
|
||||||
|
virDomainEventPtr event = NULL;
|
||||||
|
|
||||||
|
dom = get_nonnull_domain(conn, msg->dom);
|
||||||
|
if (!dom)
|
||||||
|
return;
|
||||||
|
|
||||||
|
event = virDomainEventPMWakeupNewFromDom(dom);
|
||||||
|
|
||||||
|
virDomainFree(dom);
|
||||||
|
|
||||||
|
remoteDomainEventQueue(priv, event);
|
||||||
|
}
|
||||||
|
|
||||||
static virDrvOpenStatus ATTRIBUTE_NONNULL (1)
|
static virDrvOpenStatus ATTRIBUTE_NONNULL (1)
|
||||||
remoteSecretOpen(virConnectPtr conn, virConnectAuthPtr auth,
|
remoteSecretOpen(virConnectPtr conn, virConnectAuthPtr auth,
|
||||||
|
@ -2184,6 +2184,10 @@ struct remote_domain_event_tray_change_msg {
|
|||||||
int reason;
|
int reason;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct remote_domain_event_pmwakeup_msg {
|
||||||
|
remote_nonnull_domain dom;
|
||||||
|
};
|
||||||
|
|
||||||
struct remote_domain_managed_save_args {
|
struct remote_domain_managed_save_args {
|
||||||
remote_nonnull_domain dom;
|
remote_nonnull_domain dom;
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
@ -2772,7 +2776,8 @@ enum remote_procedure {
|
|||||||
REMOTE_PROC_DOMAIN_GET_METADATA = 265, /* autogen autogen */
|
REMOTE_PROC_DOMAIN_GET_METADATA = 265, /* autogen autogen */
|
||||||
REMOTE_PROC_DOMAIN_BLOCK_REBASE = 266, /* autogen autogen */
|
REMOTE_PROC_DOMAIN_BLOCK_REBASE = 266, /* autogen autogen */
|
||||||
REMOTE_PROC_DOMAIN_PM_WAKEUP = 267, /* autogen autogen */
|
REMOTE_PROC_DOMAIN_PM_WAKEUP = 267, /* autogen autogen */
|
||||||
REMOTE_PROC_DOMAIN_EVENT_TRAY_CHANGE = 268 /* autogen autogen */
|
REMOTE_PROC_DOMAIN_EVENT_TRAY_CHANGE = 268, /* autogen autogen */
|
||||||
|
REMOTE_PROC_DOMAIN_EVENT_PMWAKEUP = 269 /* autogen autogen */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Notice how the entries are grouped in sets of 10 ?
|
* Notice how the entries are grouped in sets of 10 ?
|
||||||
|
@ -1655,6 +1655,9 @@ struct remote_domain_event_tray_change_msg {
|
|||||||
remote_nonnull_string devAlias;
|
remote_nonnull_string devAlias;
|
||||||
int reason;
|
int reason;
|
||||||
}
|
}
|
||||||
|
struct remote_domain_event_pmwakeup_msg {
|
||||||
|
remote_nonnull_domain dom;
|
||||||
|
}
|
||||||
struct remote_domain_managed_save_args {
|
struct remote_domain_managed_save_args {
|
||||||
remote_nonnull_domain dom;
|
remote_nonnull_domain dom;
|
||||||
u_int flags;
|
u_int flags;
|
||||||
@ -2184,4 +2187,5 @@ enum remote_procedure {
|
|||||||
REMOTE_PROC_DOMAIN_BLOCK_REBASE = 266,
|
REMOTE_PROC_DOMAIN_BLOCK_REBASE = 266,
|
||||||
REMOTE_PROC_DOMAIN_PM_WAKEUP = 267,
|
REMOTE_PROC_DOMAIN_PM_WAKEUP = 267,
|
||||||
REMOTE_PROC_DOMAIN_TRAY_CHANGE = 268,
|
REMOTE_PROC_DOMAIN_TRAY_CHANGE = 268,
|
||||||
|
REMOTE_PROC_DOMAIN_PMWAKEUP = 269,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user