X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2Fnepi%2Fresources%2Fplanetlab%2Fopenvswitch%2Ftunnel.py;h=8ae73939029fa3b44d11a409f7cb76c8b2b06848;hb=09ac796bac9aa2c41c5ad830f404fe128fffb22d;hp=c1f81fe948d0357d45ecacd947f8188389914325;hpb=332038a4a4e7e8c74db87dea003e4c02418175d6;p=nepi.git diff --git a/src/nepi/resources/planetlab/openvswitch/tunnel.py b/src/nepi/resources/planetlab/openvswitch/tunnel.py index c1f81fe9..8ae73939 100644 --- a/src/nepi/resources/planetlab/openvswitch/tunnel.py +++ b/src/nepi/resources/planetlab/openvswitch/tunnel.py @@ -20,7 +20,7 @@ from nepi.execution.attribute import Attribute, Flags, Types from nepi.execution.resource import ResourceManager, clsinit_copy, \ - ResourceState, failtrap + ResourceState from nepi.resources.linux.application import LinuxApplication from nepi.resources.planetlab.node import PlanetlabNode from nepi.resources.planetlab.openvswitch.ovs import OVSWitch @@ -243,7 +243,6 @@ class OVSTunnel(LinuxApplication): msg = "Failed to connect endpoints" if proc.poll(): - self.fail() self.error(msg, out, err) raise RuntimeError, msg @@ -261,7 +260,6 @@ class OVSTunnel(LinuxApplication): (out, err), proc = self.node.check_errors(self.run_home(self.node)) # Out is what was written in the stderr file if err: - self.fail() msg = " Failed to start command '%s' " % command self.error(msg, out, err) raise RuntimeError, msg @@ -296,7 +294,6 @@ class OVSTunnel(LinuxApplication): msg = "Failed to connect endpoints" if proc.poll(): - self.fail() self.error(msg, out, err) raise RuntimeError, msg else: @@ -337,7 +334,6 @@ class OVSTunnel(LinuxApplication): msg = "Failed to connect endpoints" if proc.poll(): - self.fail() self.error(msg, out, err) raise RuntimeError, msg else: @@ -345,8 +341,7 @@ class OVSTunnel(LinuxApplication): self.info(msg) return - @failtrap - def provision(self): + def do_provision(self): """ Provision the tunnel """ # Create folders @@ -365,41 +360,33 @@ class OVSTunnel(LinuxApplication): (self._pid, self._ppid) = self.udp_connect(self.endpoint2, self.endpoint1) switch_connect = self.sw_host_connect(self.endpoint1, self.endpoint2) - super(OVSTunnel, self).provision() + super(OVSTunnel, self).do_provision() - @failtrap - def deploy(self): + def do_deploy(self): if (not self.endpoint1 or self.endpoint1.state < ResourceState.READY) or \ (not self.endpoint2 or self.endpoint2.state < ResourceState.READY): self.ec.schedule(reschedule_delay, self.deploy) else: - self.discover() - self.provision() + self.do_discover() + self.do_provision() - super(OVSTunnel, self).deploy() + super(OVSTunnel, self).do_deploy() - def release(self): + def do_release(self): """ Release the udp_tunnel on endpoint2. On endpoint1 means nothing special. """ - try: - if not self.check_endpoints(): - # Kill the TAP devices - # TODO: Make more generic Release method of PLTAP - if self._pid and self._ppid: - self._nodes = self.get_node(self.endpoint2) - (out, err), proc = self.node.kill(self._pid, - self._ppid, sudo = True) - if err or proc.poll(): - # check if execution errors occurred - msg = " Failed to delete TAP device" - self.error(msg, err, err) - self.fail() - except: - import traceback - err = traceback.format_exc() - self.error(err) - - super(OVSTunnel, self).release() - + if not self.check_endpoints(): + # Kill the TAP devices + # TODO: Make more generic Release method of PLTAP + if self._pid and self._ppid: + self._nodes = self.get_node(self.endpoint2) + (out, err), proc = self.node.kill(self._pid, + self._ppid, sudo = True) + if err or proc.poll(): + # check if execution errors occurred + msg = " Failed to delete TAP device" + self.error(msg, err, err) + + super(OVSTunnel, self).do_release()