From 92a37cd072a82cc8bfc32f04d7b4eedb39a57192 Mon Sep 17 00:00:00 2001 From: peusterm Date: Wed, 17 May 2017 09:51:05 +0200 Subject: [PATCH] Fix: Nova, Heat APIs now rely on latest son-emu master code to handle links --- src/emuvim/api/openstack/compute.py | 2 -- src/emuvim/dcemulator/net.py | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/emuvim/api/openstack/compute.py b/src/emuvim/api/openstack/compute.py index 9918c6d..45cef59 100644 --- a/src/emuvim/api/openstack/compute.py +++ b/src/emuvim/api/openstack/compute.py @@ -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() diff --git a/src/emuvim/dcemulator/net.py b/src/emuvim/dcemulator/net.py index 9dfef36..5dfcbcd 100755 --- a/src/emuvim/dcemulator/net.py +++ b/src/emuvim/dcemulator/net.py @@ -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 ): """ -- 2.25.1