Commit 21fdbbc4 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

slapgrid: wip continue working on new API

parent d37500fe
......@@ -1730,7 +1730,6 @@ stderr_logfile_backups=1
self.checkEnvironmentAndCreateStructure()
self._launchSupervisord()
slap_computer_usage = self.slap.registerComputer(self.computer_id)
computer_partition_usage_list = []
self.logger.info('Aggregating and sending usage reports...')
......@@ -1760,7 +1759,7 @@ stderr_logfile_backups=1
clean_run = True
# Loop over the different computer partitions
computer_partition_list = self.FilterComputerPartitionList(
slap_computer_usage.getComputerPartitionList())
self.getComputerPartitionList())
for computer_partition in computer_partition_list:
try:
......@@ -1895,7 +1894,7 @@ stderr_logfile_backups=1
if self.validateXML(usage, computer_consumption_model):
self.logger.info('XML file generated by asXML is valid')
slap_computer_usage.reportUsage(usage)
self.computer.reportUsage(usage)
filename_delete_list.append(filename)
else:
self.logger.info('XML file is invalid %s' % file_path)
......@@ -1915,7 +1914,7 @@ stderr_logfile_backups=1
# We test the XML report before sending it
if self.validateXML(computer_consumption, computer_consumption_model):
self.logger.info('XML file generated by asXML is valid')
slap_computer_usage.reportUsage(computer_consumption)
self.computer.reportUsage(computer_consumption)
else:
self.logger.info('XML file generated by asXML is not valid !')
raise ValueError('XML file generated by asXML is not valid !')
......@@ -1963,14 +1962,14 @@ stderr_logfile_backups=1
local_partition.stop()
local_partition._updateCertificate()
try:
if not self.api_backward_compatibility:
self.slap.jio_api_connector.put({
"portal_type": "Software Instance",
"reference": computer_partition.get("reference"),
"reported_state": "started"
})
else:
computer_partition["slap_partition"].stopped()
if not self.api_backward_compatibility:
self.slap.jio_api_connector.put({
"portal_type": "Software Instance",
"reference": computer_partition.get("reference"),
"reported_state": "stopped"
})
else:
computer_partition["slap_partition"].stopped()
except (SystemExit, KeyboardInterrupt):
self.sendPartitionError(computer_partition, traceback.format_exc(), logger=self.logger)
raise
......@@ -2000,14 +1999,14 @@ stderr_logfile_backups=1
self.sendPartitionError(computer_partition, exc, logger=self.logger)
try:
if destroyed:
if not self.api_backward_compatibility:
self.slap.jio_api_connector.put({
"portal_type": "Software Instance",
"reference": computer_partition.get("reference"),
"reported_state": "destroyed"
})
else:
computer_partition["slap_partition"].destroyed()
if not self.api_backward_compatibility:
self.slap.jio_api_connector.put({
"portal_type": "Software Instance",
"reference": computer_partition.get("reference"),
"reported_state": "destroyed"
})
else:
computer_partition["slap_partition"].destroyed()
except NotFoundError:
self.logger.debug('Ignored slap error while trying to inform about '
'destroying not fully configured Computer Partition %r' %
......
This diff is collapsed.
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