Fix: Nova, Heat APIs now rely on latest son-emu master code to handle links
authorpeusterm <manuel.peuster@uni-paderborn.de>
Wed, 17 May 2017 07:51:05 +0000 (09:51 +0200)
committerpeusterm <manuel.peuster@uni-paderborn.de>
Wed, 17 May 2017 07:51:05 +0000 (09:51 +0200)
src/emuvim/api/openstack/compute.py
src/emuvim/dcemulator/net.py

index 9918c6d..45cef59 100644 (file)
@@ -677,8 +677,6 @@ class OpenstackCompute(object):
         del self.dc.switch.ports[link.intf2]
         del self.dc.switch.nameToIntf[link.intf2.name]
         self.dc.net.removeLink(link=link)
-        self.dc.net.DCNetwork_graph.remove_edge(server_name, self.dc.switch.name)
-        self.dc.net.DCNetwork_graph.remove_edge(self.dc.switch.name, server_name)
         for intf_key in self.dc.net[server_name].intfs.keys():
             if self.dc.net[server_name].intfs[intf_key].link == link:
                 self.dc.net[server_name].intfs[intf_key].delete()
index 9dfef36..5dfcbcd 100755 (executable)
@@ -233,8 +233,21 @@ class DCNetwork(Containernet):
         """
         Remove the link from the Containernet and the networkx graph
         """
+        if link is not None:
+            node1 = link.intf1.node
+            node2 = link.intf2.node
+        assert node1 is not None
+        assert node2 is not None
         Containernet.removeLink(self, link=link, node1=node1, node2=node2)
-        self.DCNetwork_graph.remove_edge(node2.name, node1.name)
+        # TODO we might decrease the loglevel to debug:
+        try:
+            self.DCNetwork_graph.remove_edge(node2.name, node1.name)
+        except:
+            LOG.warning("%s not found in DCNetwork_graph." % ((node2.name, node1.name)))
+        try:
+            self.DCNetwork_graph.remove_edge(node1.name, node2.name)
+        except:
+            LOG.warning("%s not found in DCNetwork_graph." % ((node1.name, node2.name)))
 
     def addDocker( self, label, **params ):
         """