From f5191b855fd040fe9df389d1032bc8ab007fb81a Mon Sep 17 00:00:00 2001 From: Brandon Heller <brandonh@stanford.edu> Date: Tue, 23 Mar 2010 01:15:51 -0700 Subject: [PATCH] Revert "Add ability to pause and resume any node" This reverts commit 07aad110819778fdf65a43a6d11e9ca46c9881db. When the semantics are clear, functionality like this will get added back to Mininet. Conflicts: mininet/node.py --- mininet/cli.py | 20 ---------------- mininet/node.py | 63 ------------------------------------------------- 2 files changed, 83 deletions(-) diff --git a/mininet/cli.py b/mininet/cli.py index aefb9350..f7502f67 100644 --- a/mininet/cli.py +++ b/mininet/cli.py @@ -161,26 +161,6 @@ def do_link( self, args ): else: self.mn.configLinkStatus( *args ) - def do_pause( self, args ): - "Temporarily bring a node down." - args = args.split() - if len(args) != 1: - error( 'invalid number of args: pause [node]\n' ) - elif args[0] not in self.nodemap: - error( 'invalid node: %s\n' % args[0] ) - else: - self.nodemap[ args[ 0 ] ].pause() - - def do_resume( self, args ): - "Temporarily bring a node up." - args = args.split() - if len(args) != 1: - error( 'invalid number of args: resume [node]\n' ) - elif args[0] not in self.nodemap: - error( 'invalid node: %s\n' % args[0] ) - else: - self.nodemap[ args[ 0 ] ].resume() - def do_exit( self, args ): "Exit" return 'exited by user command' diff --git a/mininet/node.py b/mininet/node.py index e9ab04cf..80eda2d7 100644 --- a/mininet/node.py +++ b/mininet/node.py @@ -365,12 +365,6 @@ def intfIsUp( self, intf ): "Check if an interface is up." return 'UP' in self.cmd( 'ifconfig ' + intf ) - def modIntfs( self, action ): - """Bring all interfaces up or down. - action: string to pass to ifconfig""" - for intf in self.intfs.values(): - self.cmd( [ 'ifconfig', intf, action ] ) - # Other methods def __str__( self ): result = self.name + ':' @@ -384,18 +378,6 @@ def __str__( self ): class Host( Node ): "A host is simply a Node." - # Ideally, pausing a host would pause the bash process corresponding to - # that host. However, when one tries to run a command on a paused host, - # it leads to an exception later. For now, disable interfaces to "pause" - # the host. - - def pause( self ): - "Disable interfaces." - self.modIntfs('down') - - def resume( self ): - "Re-enable interfaces" - self.modIntfs('up') class Switch( Node ): """A Switch is a Node that is running (or has execed?) @@ -455,17 +437,6 @@ def stop( self ): self.cmd( 'kill %ofprotocol' ) self.deleteIntfs() - def pause( self ): - "Pause ofprotocol and ofdatapath." - self.cmd( 'kill -STOP %ofdatapath' ) - self.cmd( 'kill -STOP %ofprotocol' ) - - def resume( self ): - "Resume ofprotocol and datapath." - self.cmd( 'kill -CONT %ofdatapath' ) - self.cmd( 'kill -CONT %ofprotocol' ) - - class KernelSwitch( Switch ): """Kernel-space switch. Currently only works in root namespace.""" @@ -518,18 +489,6 @@ def stop( self ): self.cmd( 'kill %ofprotocol' ) self.deleteIntfs() - # Since kernel threads cannot receive signals like user-space processes, - # disabling the interfaces and ofdatapath is our workaround. - - def pause( self ): - "Disable interfaces and pause ofprotocol." - self.cmd( 'kill -STOP %ofprotocol' ) - self.modIntfs('down') - - def resume( self ): - "Re-enable interfaces and resume ofprotocol." - self.cmd( 'kill -CONT %ofprotocol' ) - self.modIntfs('up') class OVSKernelSwitch( Switch ): """Open VSwitch kernel-space switch. @@ -584,19 +543,6 @@ def stop( self ): self.cmd( 'kill %ovs-openflowd' ) self.deleteIntfs() - # Since kernel threads cannot receive signals like user-space processes, - # disabling the interfaces and ovs-openflowd is our workaround. - - def pause( self ): - "Disable interfaces and pause ovs-openflowd." - self.cmd( 'kill -STOP %ovs-openflowd' ) - self.modIntfs('down') - - def resume( self ): - "Re-enable interfaces and resume ovs-openflowd." - self.cmd( 'kill -CONT %ovs-openflowd' ) - self.modIntfs('up') - class Controller( Node ): """A Controller is a Node that is running (or has execed?) an @@ -627,14 +573,6 @@ def stop( self ): self.cmd( 'kill %' + self.controller ) self.terminate() - def pause( self ): - "Pause controller." - self.cmd( 'kill -STOP %' + self.controller ) - - def resume( self ): - "Resume controller." - self.cmd( 'kill -CONT %' + self.controller ) - def IP( self, intf=None ): "Return IP address of the Controller" ip = Node.IP( self, intf=intf ) @@ -642,7 +580,6 @@ def IP( self, intf=None ): ip = self.defaultIP return ip - class ControllerParams( object ): "Container for controller IP parameters." -- GitLab