ec.register_connection(reboot_app, gw_node)\r
\r
ec.register_condition(reboot_app, ResourceAction.START, load_app, \r
- ResourceState.STOPPED, time="300s") \r
+ ResourceState.STOPPED, time="60s") \r
\r
hosts = hosts.split(",")\r
\r
ec.register_condition(node, ResourceAction.DEPLOY, reboot_app, \r
ResourceState.STOPPED, time="300s") \r
\r
- app = ec.register_resource("linux::Application")\r
- ec.set(app, "command", "modprobe ath5k && ip a | grep wlan0 && service omf_rc restart")\r
- ec.register_connection(app, node)\r
- \r
- apps.append(app)\r
+ modprobe_app = ec.register_resource("linux::Application")\r
+ ec.set(modprobe_app, "command", "modprobe ath5k && ip a | grep wlan0")\r
+ ec.register_connection(modprobe_app, node)\r
+ apps.append(modprobe_app)\r
+\r
+ rc_app = ec.register_resource("linux::Application")\r
+ ec.set(rc_app, "command", "service omf_rc stop; service omf_rc start")\r
+ ec.register_connection(rc_app, node)\r
+ apps.append(rc_app)\r
\r
print "This might take time..."\r
\r
def clsinit_copy(cls):
""" Initializes template information (i.e. attributes and traces)
- on classes direved from the ResourceManager class.
+ on classes derived from the ResourceManager class.
It differs from the clsinit method in that it forces inheritance
of attributes and traces from the parent class.
""" Resource subclasses will invoke this method to register
resource traces
- This method should be overriden in the RMs that define traces.
+ This method should be overridden in the RMs that define traces.
"""
@property
def reserved_time(self):
- """ Returns the resreved time of the RM as a timestamp """
+ """ Returns the reserved time of the RM as a timestamp """
return self._reserved_time
@property
@property
def failed_time(self):
- """ Returns the time failure occured for the RM as a timestamp """
+ """ Returns the time failure occurred for the RM as a timestamp """
return self._failed_time
@property
def register_connection(self, guid):
""" Registers a connection to the RM identified by guid
- This method should not be overriden. Specific functionality
+ This method should not be overridden. Specific functionality
should be added in the do_connect method.
:param guid: Global unique identified of the RM to connect to
def unregister_connection(self, guid):
""" Removes a registered connection to the RM identified by guid
- This method should not be overriden. Specific functionality
+ This method should not be overridden. Specific functionality
should be added in the do_disconnect method.
:param guid: Global unique identified of the RM to connect to
This method is responsible for selecting an individual resource
matching user requirements.
- This method should not be overriden directly. Specific functionality
+ This method should not be overridden directly. Specific functionality
should be added in the do_discover method.
"""
This method is responsible for reserving an individual resource
matching user requirements.
- This method should not be overriden directly. Specific functionality
+ This method should not be overridden directly. Specific functionality
should be added in the do_reserved method.
"""
After this method has been successfully invoked, the resource
should be accessible/controllable by the RM.
- This method should not be overriden directly. Specific functionality
+ This method should not be overridden directly. Specific functionality
should be added in the do_provision method.
"""
if self._state != ResourceState.RELEASED:
self.do_provision()
+ @failtrap
+ def configure(self):
+ """ Performs resource configuration.
+
+ This method is responsible for configuring one resource.
+ After this method has been successfully invoked, the resource
+ should be set up to start the experimentation.
+
+ This method should not be overridden directly. Specific functionality
+ should be added in the do_configure method.
+
+ """
+ with self._release_lock:
+ if self._state != ResourceState.RELEASED:
+ self.do_configure()
+
@failtrap
def start(self):
""" Starts the RM (e.g. launch remote process).
There is no standard start behavior. Some RMs will not need to perform
any actions upon start.
- This method should not be overriden directly. Specific functionality
+ This method should not be overridden directly. Specific functionality
should be added in the do_start method.
"""
There is no standard stop behavior. Some RMs will not need to perform
any actions upon stop.
- This method should not be overriden directly. Specific functionality
+ This method should not be overridden directly. Specific functionality
should be added in the do_stop method.
"""
This method is responsible for deploying the resource (and invoking
the discover and provision methods).
- This method should not be overriden directly. Specific functionality
+ This method should not be overridden directly. Specific functionality
should be added in the do_deploy method.
"""
This method is responsible for releasing resources that were
used during the experiment by the RM.
- This method should not be overriden directly. Specific functionality
+ This method should not be overridden directly. Specific functionality
should be added in the do_release method.
"""
def fail(self):
""" Sets the RM to state FAILED.
- This method should not be overriden directly. Specific functionality
+ This method should not be overridden directly. Specific functionality
should be added in the do_fail method.
"""
def do_provision(self):
self.set_provisioned()
+ def do_configure(self):
+ pass
+
def do_start(self):
self.set_started()