mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-08-25 13:50:09 +03:00
Introduce virNetlinkEventServiceStopAll() to stop all netlink services.
This patch introduce virNetlinkEventServiceStopAll() to stop all the monitors to receive netlink messages for libvirtd. Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
This commit is contained in:
committed by
Daniel Veillard
parent
d575679401
commit
15a71e6059
@ -1327,7 +1327,7 @@ int main(int argc, char **argv) {
|
|||||||
0, "shutdown", NULL, NULL);
|
0, "shutdown", NULL, NULL);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virNetlinkEventServiceStop(NETLINK_ROUTE);
|
virNetlinkEventServiceStopAll();
|
||||||
virObjectUnref(remoteProgram);
|
virObjectUnref(remoteProgram);
|
||||||
virObjectUnref(qemuProgram);
|
virObjectUnref(qemuProgram);
|
||||||
virNetServerClose(srv);
|
virNetServerClose(srv);
|
||||||
|
@ -1483,6 +1483,7 @@ virNetlinkEventRemoveClient;
|
|||||||
virNetlinkEventServiceIsRunning;
|
virNetlinkEventServiceIsRunning;
|
||||||
virNetlinkEventServiceLocalPid;
|
virNetlinkEventServiceLocalPid;
|
||||||
virNetlinkEventServiceStop;
|
virNetlinkEventServiceStop;
|
||||||
|
virNetlinkEventServiceStopAll;
|
||||||
virNetlinkEventServiceStart;
|
virNetlinkEventServiceStart;
|
||||||
virNetlinkShutdown;
|
virNetlinkShutdown;
|
||||||
virNetlinkStartup;
|
virNetlinkStartup;
|
||||||
|
@ -404,6 +404,46 @@ virNetlinkEventServiceStop(unsigned int protocol)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* virNetlinkEventServiceStopAll:
|
||||||
|
*
|
||||||
|
* Stop all the monitors to receive netlink messages for libvirtd.
|
||||||
|
*
|
||||||
|
* Returns -1 if any monitor cannot be unregistered, 0 upon success
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
virNetlinkEventServiceStopAll(void)
|
||||||
|
{
|
||||||
|
unsigned int i, j;
|
||||||
|
virNetlinkEventSrvPrivatePtr srv = NULL;
|
||||||
|
|
||||||
|
VIR_INFO("stopping all netlink event services");
|
||||||
|
|
||||||
|
for (i = 0; i < MAX_LINKS; i++) {
|
||||||
|
srv = server[i];
|
||||||
|
if (!srv)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
virNetlinkEventServerLock(srv);
|
||||||
|
nl_close(srv->netlinknh);
|
||||||
|
virNetlinkFree(srv->netlinknh);
|
||||||
|
virEventRemoveHandle(srv->eventwatch);
|
||||||
|
|
||||||
|
for (j = 0; j < srv->handlesCount; j++) {
|
||||||
|
if (srv->handles[j].deleted == VIR_NETLINK_HANDLE_VALID)
|
||||||
|
virNetlinkEventRemoveClientPrimitive(j, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
server[i] = NULL;
|
||||||
|
virNetlinkEventServerUnlock(srv);
|
||||||
|
|
||||||
|
virMutexDestroy(&srv->lock);
|
||||||
|
VIR_FREE(srv);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virNetlinkEventServiceIsRunning:
|
* virNetlinkEventServiceIsRunning:
|
||||||
*
|
*
|
||||||
@ -731,6 +771,16 @@ int virNetlinkEventServiceStop(unsigned int protocol ATTRIBUTE_UNUSED)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* stopNetlinkEventServerAll: stop all the monitors to receive netlink
|
||||||
|
* messages for libvirtd
|
||||||
|
*/
|
||||||
|
int virNetlinkEventServiceStopAll(void)
|
||||||
|
{
|
||||||
|
VIR_DEBUG("%s", _(unsupported));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* startNetlinkEventServer: start a monitor to receive netlink
|
* startNetlinkEventServer: start a monitor to receive netlink
|
||||||
* messages for libvirtd
|
* messages for libvirtd
|
||||||
|
@ -53,6 +53,11 @@ typedef void (*virNetlinkEventRemoveCallback)(int watch, const virMacAddrPtr mac
|
|||||||
*/
|
*/
|
||||||
int virNetlinkEventServiceStop(unsigned int protocol);
|
int virNetlinkEventServiceStop(unsigned int protocol);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* stopNetlinkEventServerAll: stop all the monitors to receive netlink messages for libvirtd
|
||||||
|
*/
|
||||||
|
int virNetlinkEventServiceStopAll(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* startNetlinkEventServer: start a monitor to receive netlink messages for libvirtd
|
* startNetlinkEventServer: start a monitor to receive netlink messages for libvirtd
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user