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