[libvirt] [PATCH] Added hook for network modification event
Martin Kletzander
mkletzan at redhat.com
Thu Jun 25 20:31:01 UTC 2015
On Tue, Jun 23, 2015 at 09:01:58AM +0200, Anton Khramov wrote:
>https://bugzilla.redhat.com/show_bug.cgi?id=1181539
>
>Signed-off-by: Anton Khramov <webmaster at ulzone.ru>
>---
> src/network/bridge_driver.c | 5 +++++
> src/util/virhook.c | 3 ++-
> src/util/virhook.h | 1 +
> 3 files changed, 8 insertions(+), 1 deletion(-)
>
>diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
>index 3d6721b..f5fc6f4 100644
>--- a/src/network/bridge_driver.c
>+++ b/src/network/bridge_driver.c
>@@ -3307,6 +3307,11 @@ networkUpdate(virNetworkPtr net,
> if (needFirewallRefresh && networkAddFirewallRules(network->def) < 0)
> goto cleanup;
>
>+ if (needFirewallRefresh &&
>+ networkRunHook(network, NULL, NULL, VIR_HOOK_NETWORK_OP_UPDATED,
>+ VIR_HOOK_SUBOP_BEGIN) < 0)
>+ goto cleanup;
>+
Any reason why the hook should be called only if the firewall is being
refreshed?
> if (flags & VIR_NETWORK_UPDATE_AFFECT_CONFIG) {
> /* save updated persistent config to disk */
> if (virNetworkSaveConfig(driver->networkConfigDir,
>diff --git a/src/util/virhook.c b/src/util/virhook.c
>index ee19382..516e4f4 100644
>--- a/src/util/virhook.c
>+++ b/src/util/virhook.c
>@@ -93,7 +93,8 @@ VIR_ENUM_IMPL(virHookNetworkOp, VIR_HOOK_NETWORK_OP_LAST,
> "started",
> "stopped",
> "plugged",
>- "unplugged")
>+ "unplugged",
>+ "updated")
>
> static int virHooksFound = -1;
>
>diff --git a/src/util/virhook.h b/src/util/virhook.h
>index 550ef84..021308d 100644
>--- a/src/util/virhook.h
>+++ b/src/util/virhook.h
>@@ -82,6 +82,7 @@ typedef enum {
> 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_UNPLUGGED, /* an interface was unplugged from the network */
>+ VIR_HOOK_NETWORK_OP_UPDATED, /* network has been modified */
>
While it's enough for the code to work, you also need to update
the documentation (docs/hooks.html.in in particular).
> VIR_HOOK_NETWORK_OP_LAST,
> } virHookNetworkOpType;
>--
>1.9.1
>
>--
>libvir-list mailing list
>libvir-list at redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150625/c0fa8cf8/attachment-0001.sig>
More information about the libvir-list
mailing list