[PATCH] Added hook for network modification event

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



https://bugzilla.redhat.com/show_bug.cgi?id=1181539

Signed-off-by: Anton Khramov <webmaster@xxxxxxxxx>
---
 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;
+
     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 */
 
     VIR_HOOK_NETWORK_OP_LAST,
 } virHookNetworkOpType;
-- 
1.9.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]