Commit 3313b309 authored by Yingjie Xu's avatar Yingjie Xu

Optimise slapgrid-cp. Compare timestamp from server side to local timestamp,

run slapgrid-cp only if there is an update on slapos server.
parent 599d611b
...@@ -573,6 +573,16 @@ class Slapgrid(object): ...@@ -573,6 +573,16 @@ class Slapgrid(object):
computer_partition_id = computer_partition.getId() computer_partition_id = computer_partition.getId()
instance_path = os.path.join( instance_path = os.path.join(
self.instance_root, computer_partition_id) self.instance_root, computer_partition_id)
timestamp_path = os.path.join(instance_path, '.timestamp')
if os.path.exists(timestamp_path):
descriptor = open(timestamp_path)
old_timestamp = int(descriptor.read())
descriptor.close()
parameter_dict = computer_partition.getInstanceParameterDict()
if 'timestamp' in parameter_dict:
timestamp = int(parameter_dict['timestamp'])
if timestamp <= old_timestamp:
continue
try: try:
software_url = computer_partition.getSoftwareRelease().getURI() software_url = computer_partition.getSoftwareRelease().getURI()
except NotFoundError: except NotFoundError:
......
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