mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
network: Added hook for network modification event
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1181539
This commit is contained in:
parent
200a40f94e
commit
128a8b2c9f
@ -250,6 +250,8 @@
|
|||||||
<pre>/etc/libvirt/hooks/network network_name plugged begin -</pre>
|
<pre>/etc/libvirt/hooks/network network_name plugged begin -</pre>
|
||||||
Please note, that in this case, the script is passed both network and
|
Please note, that in this case, the script is passed both network and
|
||||||
domain XMLs on its stdin.</li>
|
domain XMLs on its stdin.</li>
|
||||||
|
<li>When network is updated, the hook script is called as:<br/>
|
||||||
|
<pre>/etc/libvirt/hooks/network network_name updated begin -</pre></li>
|
||||||
<li>When the domain from previous case is shutting down, the interface
|
<li>When the domain from previous case is shutting down, the interface
|
||||||
is unplugged. This leads to another script invocation:<br/>
|
is unplugged. This leads to another script invocation:<br/>
|
||||||
<pre>/etc/libvirt/hooks/network network_name unplugged begin -</pre>
|
<pre>/etc/libvirt/hooks/network network_name unplugged begin -</pre>
|
||||||
|
@ -3462,6 +3462,12 @@ networkUpdate(virNetworkPtr net,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* call the 'updated' network hook script */
|
||||||
|
if (networkRunHook(network, NULL, NULL, VIR_HOOK_NETWORK_OP_UPDATED,
|
||||||
|
VIR_HOOK_SUBOP_BEGIN) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
cleanup:
|
cleanup:
|
||||||
virNetworkObjEndAPI(&network);
|
virNetworkObjEndAPI(&network);
|
||||||
|
@ -93,7 +93,8 @@ VIR_ENUM_IMPL(virHookNetworkOp, VIR_HOOK_NETWORK_OP_LAST,
|
|||||||
"started",
|
"started",
|
||||||
"stopped",
|
"stopped",
|
||||||
"plugged",
|
"plugged",
|
||||||
"unplugged")
|
"unplugged",
|
||||||
|
"updated")
|
||||||
|
|
||||||
static int virHooksFound = -1;
|
static int virHooksFound = -1;
|
||||||
|
|
||||||
|
@ -82,6 +82,7 @@ typedef enum {
|
|||||||
VIR_HOOK_NETWORK_OP_STOPPED, /* network has stopped */
|
VIR_HOOK_NETWORK_OP_STOPPED, /* network has stopped */
|
||||||
VIR_HOOK_NETWORK_OP_IFACE_PLUGGED, /* an interface has been plugged into the network */
|
VIR_HOOK_NETWORK_OP_IFACE_PLUGGED, /* an interface has been plugged into the network */
|
||||||
VIR_HOOK_NETWORK_OP_IFACE_UNPLUGGED, /* an interface was unplugged from the network */
|
VIR_HOOK_NETWORK_OP_IFACE_UNPLUGGED, /* an interface was unplugged from the network */
|
||||||
|
VIR_HOOK_NETWORK_OP_UPDATED, /* network has been updated */
|
||||||
|
|
||||||
VIR_HOOK_NETWORK_OP_LAST,
|
VIR_HOOK_NETWORK_OP_LAST,
|
||||||
} virHookNetworkOpType;
|
} virHookNetworkOpType;
|
||||||
|
Loading…
Reference in New Issue
Block a user