Commit a0436e5d authored by Benjamin Blanc's avatar Benjamin Blanc

testnode: scalability: Use request to update XML configuration

parent 4e2da560
...@@ -121,7 +121,8 @@ class ScalabilityTestRunner(): ...@@ -121,7 +121,8 @@ class ScalabilityTestRunner():
test_result, test_suite) test_result, test_suite)
self.log("testnode, request : %s", instance_title) self.log("testnode, request : %s", instance_title)
self.slapos_controler.request(instance_title, software_path, self.slapos_controler.request(instance_title, software_path,
"scalability", {"_" : config}) "scalability", {"_" : config},
self.launcher_nodes_computer_guid[0])
self.authorize_request = False self.authorize_request = False
return {'status_code' : 0} return {'status_code' : 0}
else: else:
...@@ -179,12 +180,19 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),)) ...@@ -179,12 +180,19 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
# Not empty grid means that all softwares are not installed # Not empty grid means that all softwares are not installed
return len(self.remaining_software_installation_dict) > 0 return len(self.remaining_software_installation_dict) > 0
def _updateInstanceXML(self, software_path, computer_guid, xml): def _updateInstanceXML(self, software_path, software_configuration, instance_title,
test_result, test_suite):
""" """
Just a proxy to SlapOSControler.updateInstanceXML. Just a proxy to SlapOSControler.updateInstanceXML.
""" """
# use _generateInstanceXML...; config = self._generateInstanceXML(software_path, software_configuration,
self.slapos_controler.updateInstanceXML(software_path, computer_guid, xml) test_result, test_suite)
self.log("testnode, updateInstanceXML : %s", instance_title)
self.slapos_controler.updateInstanceXML(instance_title, software_path,
"scalability", {"_" : config},
self.launcher_nodes_computer_guid[0])
self.authorize_request = False
return {'status_code' : 0}
def prepareSlapOSForTestSuite(self, node_test_suite): def prepareSlapOSForTestSuite(self, node_test_suite):
""" """
......
...@@ -168,35 +168,17 @@ class SlapOSControler(object): ...@@ -168,35 +168,17 @@ class SlapOSControler(object):
else: else:
raise ValueError("Configuration file not found.") raise ValueError("Configuration file not found.")
def updateInstanceXML(self, software_url, computer_id, xml): def updateInstanceXML(self, reference,
software_url, software_type, software_configuration, computer_guid=None):
""" """
Update the XML configuration of an instance Update the XML configuration of an instance
# If doesn't work, try to re-request same instance just with an other # Request same instance with different parameters.
xml onfiguration.
""" """
self.log('SlapOSControler : updateInstanceXML') self.log('SlapOSControler : updateInstanceXML')
parser = argparse.ArgumentParser() self.log('SlapOSControler : updateInstanceXML will request same'
parser.add_argument("configuration_file") 'instance with new XML configuration...')
parser.add_argument("software_url") self.request(reference,
parser.add_argument("node") software_url, software_type, software_configuration, computer_guid)
if os.path.exists(self.configuration_file_path):
args = parser.parse_args([self.configuration_file_path, software_url, computer_id])
config = client.Config()
config.setConfig(args, args.configuration_file)
try:
slap = slapos.slap.slap()
slap.initializeConnection(config.master_url,
key_file=config.key_file,
cert_file=config.cert_file)
computer = slap.registerComputer(computer_id)
computer.updateConfiguration(xml)
self.log('SlapOSControler : updateInstanceXML %s' %(xml,))
except:
self.log("SlapOSControler.updateInstanceXML, \
exception in registerOpenOrder", exc_info=sys.exc_info())
raise ValueError("Unable to updateInstanceXML")
else:
raise ValueError("Configuration file not found.")
def _resetSoftware(self): def _resetSoftware(self):
self.log('SlapOSControler : GOING TO RESET ALL SOFTWARE : %r' % self.log('SlapOSControler : GOING TO RESET ALL SOFTWARE : %r' %
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment