Changing granularity to 60s.
authorSandrine Avakian <sandrine.avakian@inria.fr>
Mon, 9 Sep 2013 14:54:21 +0000 (16:54 +0200)
committerMohamed Larabi <mohamed.larabi@inria.fr>
Mon, 16 Sep 2013 13:58:11 +0000 (15:58 +0200)
sfa/iotlab/iotlabaggregate.py
sfa/iotlab/iotlabapi.py
sfa/iotlab/iotlabdriver.py

index 5164638..c17418b 100644 (file)
@@ -326,7 +326,7 @@ class IotlabAggregate:
                     pass
                 rspec_lease['start_time'] = lease['t_from']
                 rspec_lease['duration'] = (lease['t_until'] - lease['t_from']) \
-                    / grain
+                    * grain
                 rspec_leases.append(rspec_lease)
         return rspec_leases
 
index 72bedfa..ab807df 100644 (file)
@@ -42,7 +42,7 @@ class IotlabTestbedAPI():
         self.ldap = LDAPapi()
         self.time_format = "%Y-%m-%d %H:%M:%S"
         self.root_auth = config.SFA_REGISTRY_ROOT_AUTH
-        self.grain = 1  # 10 mins lease minimum, 1 sec granularity
+        self.grain = 60  # 10 mins lease minimum, 60 sec granularity
         #import logging, logging.handlers
         #from sfa.util.sfalogging import _SfaLogger
         #sql_logger = _SfaLogger(loggername = 'sqlalchemy.engine', \
index 7fa4957..c8d5617 100644 (file)
@@ -3,7 +3,7 @@ Implements what a driver should provide for SFA to work.
 """
 from sfa.util.faults import SliverDoesNotExist, UnknownSfaType
 from sfa.util.sfalogging import logger
-from sfa.storage.alchemy import dbsession
+from sfa.storage.alchemy import dbsession
 from sfa.storage.model import RegRecord
 
 from sfa.managers.driver import Driver
@@ -700,27 +700,24 @@ class IotlabDriver(Driver):
 
     def update(self, old_sfa_record, new_sfa_record, hrn, new_key):
         """
-        No site or node record update allowed in Iotlab.
-            The only modifications authorized here are key deletion/addition
-            on an existing user and password change.
-            On an existing user, CAN NOT BE MODIFIED:
-            'first_name', 'last_name', 'email'
-            DOES NOT EXIST IN SENSLAB:
-            'phone', 'url', 'bio','title', 'accepted_aup',
-            A slice is bound to its user, so modifying the user's ssh key should
-            modify the slice's GID after an import procedure.
+        No site or node record update allowed in Iotlab. The only modifications
+        authorized here are key deletion/addition on an existing user and
+        password change. On an existing user, CAN NOT BE MODIFIED: 'first_name',
+        'last_name', 'email'. DOES NOT EXIST IN SENSLAB: 'phone', 'url', 'bio',
+        'title', 'accepted_aup'. A slice is bound to its user, so modifying the
+        user's ssh key should nmodify the slice's GID after an import procedure.
 
         :param old_sfa_record: what is in the db for this hrn
-        :param new_sfa_record: what was passed to the Update call
+        :param new_sfa_record: what was passed to the update call
         :param new_key: the new user's public key
         :param hrn: the user's sfa hrn
-        :type old_sfa_record: dictionary
-        :type new_sfa_record: dictionary
-        :type pub_key: string
+        :type old_sfa_record: dict
+        :type new_sfa_record: dict
+        :type new_key: string
         :type hrn: string
 
-         TODO: needs review
-        .. seealso::: update in driver.py.
+        TODO: needs review
+        .. seealso:: update in driver.py.
 
         """
         pointer = old_sfa_record['pointer']
@@ -765,9 +762,8 @@ class IotlabDriver(Driver):
     def remove(self, sfa_record):
         """
 
-        Removes users only. Mark the user as disabled in
-            LDAP. The user and his slice are then deleted from the
-            db by running an import on the registry.
+        Removes users only. Mark the user as disabled in LDAP. The user and his
+        slice are then deleted from the db by running an import on the registry.
 
         :param sfa_record: record is the existing sfa record in the db
         :type sfa_record: dict
@@ -775,6 +771,7 @@ class IotlabDriver(Driver):
         ..warning::As fas as the slice is concerned, here only the leases are
             removed from the slice. The slice is record itself is not removed
             from the db.
+
         TODO: needs review
 
         TODO : REMOVE SLICE FROM THE DB AS WELL? SA 14/05/2013,