From: Claudio-Daniel Freire Date: Fri, 22 Apr 2011 13:50:17 +0000 (+0200) Subject: Validate Node configuration X-Git-Tag: nepi_v2~128 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=3d6c4c14defedc78112a0d36f1f50174a57b936b;p=nepi.git Validate Node configuration --- diff --git a/src/nepi/testbeds/planetlab/metadata_v01.py b/src/nepi/testbeds/planetlab/metadata_v01.py index 00804362..42133e58 100644 --- a/src/nepi/testbeds/planetlab/metadata_v01.py +++ b/src/nepi/testbeds/planetlab/metadata_v01.py @@ -136,6 +136,11 @@ def configure_tuniface(testbed_instance, guid): def configure_node(testbed_instance, guid): node = testbed_instance._elements[guid] + # Just inject configuration stuff + node.home_path = "nepi-node-%s" % (guid,) + node.ident_path = testbed_instance.sliceSSHKey + node.slicename = testbed_instance.slicename + # If we have only one candidate, simply use it candidates = node.find_candidates( filter_slice_id = testbed_instance.slice_id) diff --git a/src/nepi/testbeds/planetlab/node.py b/src/nepi/testbeds/planetlab/node.py index dd5e4167..f5d159a0 100644 --- a/src/nepi/testbeds/planetlab/node.py +++ b/src/nepi/testbeds/planetlab/node.py @@ -6,6 +6,7 @@ import plcapi import operator import rspawn import time +import os class Node(object): BASEFILTERS = { @@ -52,6 +53,7 @@ class Node(object): # Testbed-derived attributes self.slicename = None self.ident_path = None + self.home_path = None # Those are filled when an actual node is allocated self._node_id = None @@ -158,7 +160,12 @@ class Node(object): self.max_num_external_ifaces = len(info['interface_ids']) def validate(self): - pass + if self.home_path is None: + raise AssertionError, "Misconfigured node: missing home path" + if self.ident_path is None or not os.access(self.ident_path, os.R_OK): + raise AssertionError, "Misconfigured node: missing slice SSH key" + if self.slicename is None: + raise AssertionError, "Misconfigured node: unspecified slice" def install_dependencies(self): if self.required_packages: