From: Thierry Parmentelat Date: Fri, 23 Jul 2010 12:46:48 +0000 (+0200) Subject: Merge branch 'master' of ssh://git.onelab.eu/git/tests X-Git-Tag: tests-5.0-15~4 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=f3da7c1a9397208dfdc52997d8bb0a21fdbf4e12;hp=37cd29130593ee944504cc0a1628a7424efd6528;p=tests.git Merge branch 'master' of ssh://git.onelab.eu/git/tests --- diff --git a/system/TestPlc.py b/system/TestPlc.py index 1246fa1..546ba5d 100644 --- a/system/TestPlc.py +++ b/system/TestPlc.py @@ -665,8 +665,8 @@ class TestPlc: YEAR = 365*24*3600 @staticmethod - def translate_timestamp (start,timestamp): - if timestamp < TestPlc.YEAR: return start+timestamp + def translate_timestamp (start,grain,timestamp): + if timestamp < TestPlc.YEAR: return start+timestamp*grain else: return timestamp @staticmethod @@ -677,8 +677,9 @@ class TestPlc: "create leases (on reservable nodes only, use e.g. run -c default -c resa)" now=int(time.time()) grain=self.apiserver.GetLeaseGranularity(self.auth_root()) - round_time=(now/grain)*grain - start=round_time+grain + print 'API answered grain=',grain + start=(now/grain)*grain + start += grain # find out all nodes that are reservable nodes=self.all_reservable_nodenames() if not nodes: @@ -690,8 +691,8 @@ class TestPlc: for lease_spec in self.plc_spec['leases']: # skip the ones that come with a null slice id if not lease_spec['slice']: continue - lease_spec['t_from']=TestPlc.translate_timestamp(start,lease_spec['t_from']) - lease_spec['t_until']=TestPlc.translate_timestamp(start,lease_spec['t_until']) + lease_spec['t_from']=TestPlc.translate_timestamp(start,grain,lease_spec['t_from']) + lease_spec['t_until']=TestPlc.translate_timestamp(start,grain,lease_spec['t_until']) lease_addition=self.apiserver.AddLeases(self.auth_root(),nodes, lease_spec['slice'],lease_spec['t_from'],lease_spec['t_until']) if lease_addition['errors']: diff --git a/system/config_default.py b/system/config_default.py index c776991..cc642dc 100644 --- a/system/config_default.py +++ b/system/config_default.py @@ -7,8 +7,6 @@ # values like 'hostname', 'ip' and the like are rewritten later with a TestPool object -reservation_granularity=180 - def nodes(options,index): return [{'name':'node%d'%index, 'node_fields': {'hostname': 'deferred-nodename%d'%index, @@ -206,7 +204,7 @@ def tcp_tests (options,index): return [] # the semantic for 't_from' and 't_until' here is: -# if they are smaller than one year, they are relative to the current time +# if they are smaller than one year, they are relative to the current time, expressed in grains # otherwise they are absolute def leases (options, index): leases=[] @@ -215,8 +213,8 @@ def leases (options, index): slice_sequence = slices[:1] + slices + [None,] for iterator in range(12): for slice in slice_sequence: - leases.append ( {'slice' : slice, 't_from':counter,'t_until':counter+reservation_granularity} ) - counter += reservation_granularity + leases.append ( {'slice' : slice, 't_from':counter,'t_until':counter+1} ) + counter += 1 return leases def plc (options,index) : @@ -241,7 +239,7 @@ def plc (options,index) : 'PLC_BOOT_HOST' : 'deferred-myplc-hostname', 'PLC_NET_DNS1' : 'deferred-dns-1', 'PLC_NET_DNS2' : 'deferred-dns-2', - 'PLC_RESERVATION_GRANULARITY':reservation_granularity, + 'PLC_RESERVATION_GRANULARITY':1800, 'PLC_OMF_ENABLED' : 'false', 'sites' : sites(options,index), 'keys' : keys(options,index),