Antoni Segura Puimedon has uploaded a new change for review.

Change subject: Don't crash on libvirt network re-definition.
......................................................................

Don't crash on libvirt network re-definition.

This patch is aimed to solve the libvirt syncing bug described in
bugurl. In short, the vdsmd restart scenario is solved by the
previous patch (30c63c5).

This one solves the case when the interface backing a bridge/network
has disappeared (and thus is not reported by netinfo to the engine)
and then the engine sends a new setupnetwork that attempts to
recreate the partially defined network. Up until now, libvirt would
report an exception. Now we will not raise that exception unless the
network that is being recreated is different than the one libvirt
knows about.

Bug-Url: https://bugzilla.redhat.com/861701
Change-Id: I76d95e20b7aa99280e604abdb1663c6c5c7dd32e
Signed-off-by: Antoni S. Puimedon <[email protected]>
---
M vdsm/configNetwork.py
1 file changed, 16 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/01/10901/1

diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index e784ac1..c046dca 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -27,6 +27,7 @@
 import logging
 import threading
 from xml.sax.saxutils import escape
+from xml.dom.minidom import parseString
 import glob
 import shutil
 
@@ -204,7 +205,21 @@
                 (escape(netName), escape(iface)))
         if not skipBackup:
             self._networkBackup(network)
-        self._createNetwork(netXml)
+        try:
+            self._createNetwork(netXml)
+        except libvirt.libvirtError:
+            conn = libvirtconnection.get()
+            if netName not in conn.listNetworks():
+                raise
+            net = conn.networkLookupByName(netName)
+            if bridged:
+                if net.bridgeName() != network:
+                    raise
+            else:
+                if parseString(net.XMLDesc(0)).\
+                        getElementsByTagName('interface')[0].\
+                        getAttribute('dev') != iface:
+                    raise
 
     def _removeNetwork(self, network):
         netName = netinfo.LIBVIRT_NET_PREFIX + network


--
To view, visit http://gerrit.ovirt.org/10901
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I76d95e20b7aa99280e604abdb1663c6c5c7dd32e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to