Provide versioned myplc so versioned Requires will work correctly.
[myplc.git] / db-config
index dba3dc9..0457887 100755 (executable)
--- a/db-config
+++ b/db-config
@@ -253,19 +253,25 @@ def main():
          'category' : 'slice/rspec',
          'min_role_id': 10},
 
+        # Delegation
+        {'tagname': "delegations",
+         'description': "Coma seperated list of slices to give delegation authority to.",
+         'category' : 'slice/rspec',
+         'min_role_id': 10}
+
         ]
 
     # add in the platform supported rlimits to the default_attribute_types
-    for entry in resource.__dict__.keys():
-        if entry.find("RLIMIT_")==0:
+    for entry in resource.__dict__.keys() + ["VLIMIT_OPENFD"]:
+        if entry.find("LIMIT_")==1:
             rlim = entry[len("RLIMIT_"):]
             rlim = rlim.lower()
             for ty in ("min","soft","hard"):
                 attribute = {
-                    'tagname': "%s_%s'%(rlim,ty)",
+                    'tagname': "%s_%s"%(rlim,ty),
                     'description': "Per sliver RLIMIT %s_%s."%(rlim,ty),
                     'category': 'slice/limit',
-                    'min_role_id': 40 #admin
+                    'min_role_id': 10 #admin
                     }
                 default_attribute_types.append(attribute)
 
@@ -658,7 +664,7 @@ def main():
          'expires': 0x7fffffff - (60 * 60 * 24),
          'attributes': [('system', "1"),
                         ('vref', "planetflow"),
-                                               ('vsys', "pfmount")]},
+                        ('vsys', "pfmount")]},
           # Sirius
         {'name': plc['slice_prefix'] + "_sirius",
          'description': 'The Sirius Calendar Service.\n\nSirius provides system-wide reservations of 25% CPU and 2Mb/s outgoing\nbandwidth.  Sign up for hour-long slots using the Web GUI at the\nPlanetLab website.\n\nThis slice should not generate traffic external to PlanetLab.\n',
@@ -686,11 +692,11 @@ def main():
         if slice['slice_attribute_ids']:
             # Delete unknown attributes
             for slice_attribute in GetSliceAttributes(slice['slice_attribute_ids']):
-                if (slice_attribute['name'], slice_attribute['value']) \
+                if (slice_attribute['tagname'], slice_attribute['value']) \
                    not in default_slice['attributes']:
                     DeleteSliceAttribute(slice_attribute['slice_attribute_id'])
                 else:
-                    slice_attributes.append((slice_attribute['name'], slice_attribute['value']))
+                    slice_attributes.append((slice_attribute['tagname'], slice_attribute['value']))
 
         for (name, value) in default_slice['attributes']:
             if (name, value) not in slice_attributes:
@@ -1072,25 +1078,39 @@ message, please reply so that we may investigate the problem.
             for ptype in protocol_types:
                 AddPCUProtocolType(id, ptype)
 
-       default_boot_states = [
-               'boot',
-               'failboot',
-               'safeboot',
-               'install',
-               'reinstall',
-               'disabled',
-       ]
-
-       current_boot_states = GetBootStates()
-       for state in default_boot_states:
-               if state not in current_boot_states:
-                       AddBootState(state)
-
-       # TODO: Delete old boot states. 
-       # NOTE: Only do this if all federating peers have the new default boot states above.
-       #for state in current_boot_states:
-       #       if state not in default_boot_states:
-       #               DeleteBootState(state)
+    default_boot_states = [
+        'boot',
+        'failboot',
+        'safeboot',
+        'install',
+        'reinstall',
+        'disabled',
+    ]
+    current_boot_states = GetBootStates()
+    for state in default_boot_states:
+        if state not in current_boot_states:
+            AddBootState(state)
+
+    # TODO: Delete old boot states. 
+    # NOTE: Only do this if all federating peers have the new default boot states above.
+    #for state in current_boot_states:
+    #    if state not in default_boot_states:
+    #        DeleteBootState(state)
+
+    # Run local db-config snippets
+    files = []
+    dir = "/etc/planetlab/db-config.d"
+    try:
+        files = os.listdir(dir)
+    except:
+        pass
+
+    for file in files:
+        if (file.endswith(".bak") or file.endswith("~") or
+            file.endswith(".rpmsave") or file.endswith(".rpmnew") or
+            file.endswith(".orig")):
+            continue
+        execfile(os.path.join(dir, file))
 
 
 if __name__ == '__main__':