diff --git a/src/conf/network_event.c b/src/conf/network_event.c index 4a025239449f5e6b4c4027b5cc0af1ba989663df..b885cedf4425b1b95ae10ce10c14bb8d2a344bfd 100644 --- a/src/conf/network_event.c +++ b/src/conf/network_event.c @@ -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; } diff --git a/src/conf/network_event.h b/src/conf/network_event.h index 44b762e34ba2beacc4832e4598b2cc87ed46c874..1eef771be45ac89ebc896d0cf7b796b7f4b3b43c 100644 --- a/src/conf/network_event.h +++ b/src/conf/network_event.h @@ -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, diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 1bde7d788c370f64c1d16eae864d14343bdcdd55..3e10758d5c96ae91914a0954f280318c76305a32 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -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) { diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 7bd4b24f7c3299819db10c871985f77264b3158f..be282d6dfc33d79ab8e2d5b6a9d2a98813508580 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -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); diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 30d2636fc3854539df14b4c43e55c8292215142c..a48404a364656ca2a8641bf92bc83a77be905771 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -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);