mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
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: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
447d55c138
commit
6e2545c07b
@ -32,6 +32,7 @@ struct _virNetworkEventLifecycle {
|
|||||||
virObjectEvent parent;
|
virObjectEvent parent;
|
||||||
|
|
||||||
int type;
|
int type;
|
||||||
|
int detail;
|
||||||
};
|
};
|
||||||
typedef struct _virNetworkEventLifecycle virNetworkEventLifecycle;
|
typedef struct _virNetworkEventLifecycle virNetworkEventLifecycle;
|
||||||
typedef virNetworkEventLifecycle *virNetworkEventLifecyclePtr;
|
typedef virNetworkEventLifecycle *virNetworkEventLifecyclePtr;
|
||||||
@ -80,7 +81,7 @@ virNetworkEventDispatchDefaultFunc(virConnectPtr conn,
|
|||||||
networkLifecycleEvent = (virNetworkEventLifecyclePtr)event;
|
networkLifecycleEvent = (virNetworkEventLifecyclePtr)event;
|
||||||
((virConnectNetworkEventLifecycleCallback)cb)(conn, net,
|
((virConnectNetworkEventLifecycleCallback)cb)(conn, net,
|
||||||
networkLifecycleEvent->type,
|
networkLifecycleEvent->type,
|
||||||
0,
|
networkLifecycleEvent->detail,
|
||||||
cbopaque);
|
cbopaque);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -135,7 +136,8 @@ virNetworkEventStateRegisterID(virConnectPtr conn,
|
|||||||
virObjectEventPtr
|
virObjectEventPtr
|
||||||
virNetworkEventLifecycleNew(const char *name,
|
virNetworkEventLifecycleNew(const char *name,
|
||||||
const unsigned char *uuid,
|
const unsigned char *uuid,
|
||||||
int type)
|
int type,
|
||||||
|
int detail)
|
||||||
{
|
{
|
||||||
virNetworkEventLifecyclePtr event;
|
virNetworkEventLifecyclePtr event;
|
||||||
int eventId = (VIR_EVENT_NAMESPACE_NETWORK << 8) + VIR_NETWORK_EVENT_ID_LIFECYCLE;
|
int eventId = (VIR_EVENT_NAMESPACE_NETWORK << 8) + VIR_NETWORK_EVENT_ID_LIFECYCLE;
|
||||||
@ -149,6 +151,7 @@ virNetworkEventLifecycleNew(const char *name,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
event->type = type;
|
event->type = type;
|
||||||
|
event->detail = detail;
|
||||||
|
|
||||||
return (virObjectEventPtr)event;
|
return (virObjectEventPtr)event;
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,8 @@ virNetworkEventStateRegisterID(virConnectPtr conn,
|
|||||||
virObjectEventPtr
|
virObjectEventPtr
|
||||||
virNetworkEventLifecycleNew(const char *name,
|
virNetworkEventLifecycleNew(const char *name,
|
||||||
const unsigned char *uuid,
|
const unsigned char *uuid,
|
||||||
int type);
|
int type,
|
||||||
|
int detail);
|
||||||
|
|
||||||
void
|
void
|
||||||
virNetworkEventDispatchDefaultFunc(virConnectPtr conn,
|
virNetworkEventDispatchDefaultFunc(virConnectPtr conn,
|
||||||
|
@ -2559,7 +2559,8 @@ static virNetworkPtr networkCreateXML(virConnectPtr conn, const char *xml) {
|
|||||||
|
|
||||||
event = virNetworkEventLifecycleNew(network->def->name,
|
event = virNetworkEventLifecycleNew(network->def->name,
|
||||||
network->def->uuid,
|
network->def->uuid,
|
||||||
VIR_NETWORK_EVENT_STARTED);
|
VIR_NETWORK_EVENT_STARTED,
|
||||||
|
0);
|
||||||
|
|
||||||
VIR_INFO("Creating network '%s'", network->def->name);
|
VIR_INFO("Creating network '%s'", network->def->name);
|
||||||
ret = virGetNetwork(conn, network->def->name, network->def->uuid);
|
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,
|
event = virNetworkEventLifecycleNew(def->name, def->uuid,
|
||||||
VIR_NETWORK_EVENT_DEFINED);
|
VIR_NETWORK_EVENT_DEFINED,
|
||||||
|
0);
|
||||||
|
|
||||||
VIR_INFO("Defining network '%s'", def->name);
|
VIR_INFO("Defining network '%s'", def->name);
|
||||||
ret = virGetNetwork(conn, def->name, def->uuid);
|
ret = virGetNetwork(conn, def->name, def->uuid);
|
||||||
@ -2673,7 +2675,8 @@ networkUndefine(virNetworkPtr net) {
|
|||||||
|
|
||||||
event = virNetworkEventLifecycleNew(network->def->name,
|
event = virNetworkEventLifecycleNew(network->def->name,
|
||||||
network->def->uuid,
|
network->def->uuid,
|
||||||
VIR_NETWORK_EVENT_UNDEFINED);
|
VIR_NETWORK_EVENT_UNDEFINED,
|
||||||
|
0);
|
||||||
|
|
||||||
VIR_INFO("Undefining network '%s'", network->def->name);
|
VIR_INFO("Undefining network '%s'", network->def->name);
|
||||||
if (!active) {
|
if (!active) {
|
||||||
@ -2890,7 +2893,8 @@ static int networkCreate(virNetworkPtr net) {
|
|||||||
|
|
||||||
event = virNetworkEventLifecycleNew(network->def->name,
|
event = virNetworkEventLifecycleNew(network->def->name,
|
||||||
network->def->uuid,
|
network->def->uuid,
|
||||||
VIR_NETWORK_EVENT_STARTED);
|
VIR_NETWORK_EVENT_STARTED,
|
||||||
|
0);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (event)
|
if (event)
|
||||||
@ -2930,7 +2934,8 @@ static int networkDestroy(virNetworkPtr net) {
|
|||||||
|
|
||||||
event = virNetworkEventLifecycleNew(network->def->name,
|
event = virNetworkEventLifecycleNew(network->def->name,
|
||||||
network->def->uuid,
|
network->def->uuid,
|
||||||
VIR_NETWORK_EVENT_STOPPED);
|
VIR_NETWORK_EVENT_STOPPED,
|
||||||
|
0);
|
||||||
|
|
||||||
if (!network->persistent) {
|
if (!network->persistent) {
|
||||||
if (networkRemoveInactive(driver, network) < 0) {
|
if (networkRemoveInactive(driver, network) < 0) {
|
||||||
|
@ -4918,7 +4918,7 @@ remoteNetworkBuildEventLifecycle(virNetClientProgramPtr prog ATTRIBUTE_UNUSED,
|
|||||||
if (!net)
|
if (!net)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
event = virNetworkEventLifecycleNew(net->name, net->uuid, msg->event);
|
event = virNetworkEventLifecycleNew(net->name, net->uuid, msg->event, msg->detail);
|
||||||
virNetworkFree(net);
|
virNetworkFree(net);
|
||||||
|
|
||||||
remoteDomainEventQueue(priv, event);
|
remoteDomainEventQueue(priv, event);
|
||||||
|
@ -3542,7 +3542,8 @@ static virNetworkPtr testNetworkCreateXML(virConnectPtr conn, const char *xml) {
|
|||||||
net->active = 1;
|
net->active = 1;
|
||||||
|
|
||||||
event = virNetworkEventLifecycleNew(net->def->name, net->def->uuid,
|
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);
|
ret = virGetNetwork(conn, net->def->name, net->def->uuid);
|
||||||
|
|
||||||
@ -3575,7 +3576,8 @@ virNetworkPtr testNetworkDefineXML(virConnectPtr conn, const char *xml)
|
|||||||
net->persistent = 1;
|
net->persistent = 1;
|
||||||
|
|
||||||
event = virNetworkEventLifecycleNew(net->def->name, net->def->uuid,
|
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);
|
ret = virGetNetwork(conn, net->def->name, net->def->uuid);
|
||||||
|
|
||||||
@ -3611,7 +3613,8 @@ static int testNetworkUndefine(virNetworkPtr network) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
event = virNetworkEventLifecycleNew(network->name, network->uuid,
|
event = virNetworkEventLifecycleNew(network->name, network->uuid,
|
||||||
VIR_NETWORK_EVENT_UNDEFINED);
|
VIR_NETWORK_EVENT_UNDEFINED,
|
||||||
|
0);
|
||||||
|
|
||||||
virNetworkRemoveInactive(&privconn->networks,
|
virNetworkRemoveInactive(&privconn->networks,
|
||||||
privnet);
|
privnet);
|
||||||
@ -3699,7 +3702,8 @@ static int testNetworkCreate(virNetworkPtr network) {
|
|||||||
|
|
||||||
privnet->active = 1;
|
privnet->active = 1;
|
||||||
event = virNetworkEventLifecycleNew(privnet->def->name, privnet->def->uuid,
|
event = virNetworkEventLifecycleNew(privnet->def->name, privnet->def->uuid,
|
||||||
VIR_NETWORK_EVENT_STARTED);
|
VIR_NETWORK_EVENT_STARTED,
|
||||||
|
0);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
@ -3727,7 +3731,8 @@ static int testNetworkDestroy(virNetworkPtr network) {
|
|||||||
|
|
||||||
privnet->active = 0;
|
privnet->active = 0;
|
||||||
event = virNetworkEventLifecycleNew(privnet->def->name, privnet->def->uuid,
|
event = virNetworkEventLifecycleNew(privnet->def->name, privnet->def->uuid,
|
||||||
VIR_NETWORK_EVENT_STOPPED);
|
VIR_NETWORK_EVENT_STOPPED,
|
||||||
|
0);
|
||||||
if (!privnet->persistent) {
|
if (!privnet->persistent) {
|
||||||
virNetworkRemoveInactive(&privconn->networks,
|
virNetworkRemoveInactive(&privconn->networks,
|
||||||
privnet);
|
privnet);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user