提交 6e2545c0 编写于 作者: D Daniel P. Berrange

Add 'detail' arg to network lifecycle event internals

While the public API & wire protocol included the 'detail'
arg for network lifecycle events, the internal event handling
code did not process it. This meant that if a future libvirtd
server starts sending non-0 'detail' args, the current libvirt
client will not process them.
Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
上级 447d55c1
......@@ -32,6 +32,7 @@ struct _virNetworkEventLifecycle {
virObjectEvent parent;
int type;
int detail;
};
typedef struct _virNetworkEventLifecycle virNetworkEventLifecycle;
typedef virNetworkEventLifecycle *virNetworkEventLifecyclePtr;
......@@ -80,7 +81,7 @@ virNetworkEventDispatchDefaultFunc(virConnectPtr conn,
networkLifecycleEvent = (virNetworkEventLifecyclePtr)event;
((virConnectNetworkEventLifecycleCallback)cb)(conn, net,
networkLifecycleEvent->type,
0,
networkLifecycleEvent->detail,
cbopaque);
goto cleanup;
}
......@@ -135,7 +136,8 @@ virNetworkEventStateRegisterID(virConnectPtr conn,
virObjectEventPtr
virNetworkEventLifecycleNew(const char *name,
const unsigned char *uuid,
int type)
int type,
int detail)
{
virNetworkEventLifecyclePtr event;
int eventId = (VIR_EVENT_NAMESPACE_NETWORK << 8) + VIR_NETWORK_EVENT_ID_LIFECYCLE;
......@@ -149,6 +151,7 @@ virNetworkEventLifecycleNew(const char *name,
return NULL;
event->type = type;
event->detail = detail;
return (virObjectEventPtr)event;
}
......@@ -40,7 +40,8 @@ virNetworkEventStateRegisterID(virConnectPtr conn,
virObjectEventPtr
virNetworkEventLifecycleNew(const char *name,
const unsigned char *uuid,
int type);
int type,
int detail);
void
virNetworkEventDispatchDefaultFunc(virConnectPtr conn,
......
......@@ -2559,7 +2559,8 @@ static virNetworkPtr networkCreateXML(virConnectPtr conn, const char *xml) {
event = virNetworkEventLifecycleNew(network->def->name,
network->def->uuid,
VIR_NETWORK_EVENT_STARTED);
VIR_NETWORK_EVENT_STARTED,
0);
VIR_INFO("Creating network '%s'", network->def->name);
ret = virGetNetwork(conn, network->def->name, network->def->uuid);
......@@ -2621,7 +2622,8 @@ static virNetworkPtr networkDefineXML(virConnectPtr conn, const char *xml) {
}
event = virNetworkEventLifecycleNew(def->name, def->uuid,
VIR_NETWORK_EVENT_DEFINED);
VIR_NETWORK_EVENT_DEFINED,
0);
VIR_INFO("Defining network '%s'", def->name);
ret = virGetNetwork(conn, def->name, def->uuid);
......@@ -2673,7 +2675,8 @@ networkUndefine(virNetworkPtr net) {
event = virNetworkEventLifecycleNew(network->def->name,
network->def->uuid,
VIR_NETWORK_EVENT_UNDEFINED);
VIR_NETWORK_EVENT_UNDEFINED,
0);
VIR_INFO("Undefining network '%s'", network->def->name);
if (!active) {
......@@ -2890,7 +2893,8 @@ static int networkCreate(virNetworkPtr net) {
event = virNetworkEventLifecycleNew(network->def->name,
network->def->uuid,
VIR_NETWORK_EVENT_STARTED);
VIR_NETWORK_EVENT_STARTED,
0);
cleanup:
if (event)
......@@ -2930,7 +2934,8 @@ static int networkDestroy(virNetworkPtr net) {
event = virNetworkEventLifecycleNew(network->def->name,
network->def->uuid,
VIR_NETWORK_EVENT_STOPPED);
VIR_NETWORK_EVENT_STOPPED,
0);
if (!network->persistent) {
if (networkRemoveInactive(driver, network) < 0) {
......
......@@ -4918,7 +4918,7 @@ remoteNetworkBuildEventLifecycle(virNetClientProgramPtr prog ATTRIBUTE_UNUSED,
if (!net)
return;
event = virNetworkEventLifecycleNew(net->name, net->uuid, msg->event);
event = virNetworkEventLifecycleNew(net->name, net->uuid, msg->event, msg->detail);
virNetworkFree(net);
remoteDomainEventQueue(priv, event);
......
......@@ -3542,7 +3542,8 @@ static virNetworkPtr testNetworkCreateXML(virConnectPtr conn, const char *xml) {
net->active = 1;
event = virNetworkEventLifecycleNew(net->def->name, net->def->uuid,
VIR_NETWORK_EVENT_STARTED);
VIR_NETWORK_EVENT_STARTED,
0);
ret = virGetNetwork(conn, net->def->name, net->def->uuid);
......@@ -3575,7 +3576,8 @@ virNetworkPtr testNetworkDefineXML(virConnectPtr conn, const char *xml)
net->persistent = 1;
event = virNetworkEventLifecycleNew(net->def->name, net->def->uuid,
VIR_NETWORK_EVENT_DEFINED);
VIR_NETWORK_EVENT_DEFINED,
0);
ret = virGetNetwork(conn, net->def->name, net->def->uuid);
......@@ -3611,7 +3613,8 @@ static int testNetworkUndefine(virNetworkPtr network) {
}
event = virNetworkEventLifecycleNew(network->name, network->uuid,
VIR_NETWORK_EVENT_UNDEFINED);
VIR_NETWORK_EVENT_UNDEFINED,
0);
virNetworkRemoveInactive(&privconn->networks,
privnet);
......@@ -3699,7 +3702,8 @@ static int testNetworkCreate(virNetworkPtr network) {
privnet->active = 1;
event = virNetworkEventLifecycleNew(privnet->def->name, privnet->def->uuid,
VIR_NETWORK_EVENT_STARTED);
VIR_NETWORK_EVENT_STARTED,
0);
ret = 0;
cleanup:
......@@ -3727,7 +3731,8 @@ static int testNetworkDestroy(virNetworkPtr network) {
privnet->active = 0;
event = virNetworkEventLifecycleNew(privnet->def->name, privnet->def->uuid,
VIR_NETWORK_EVENT_STOPPED);
VIR_NETWORK_EVENT_STOPPED,
0);
if (!privnet->persistent) {
virNetworkRemoveInactive(&privconn->networks,
privnet);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册