Tagging module MyPLC - MyPLC-4.2-5
[myplc.git] / db-config
index 2f8691f..64c5e24 100755 (executable)
--- a/db-config
+++ b/db-config
@@ -450,8 +450,8 @@ def main():
          'min_role_id': 10},
 
         # CPU share
-        {'name': "cpu_min",
-         'description': "Minimum CPU share (ms/s)",
+        {'name': "cpu_pct",
+         'description': "Reserved CPU percent",
          'min_role_id': 10},
         {'name': "cpu_share",
          'description': "Number of CPU shares",
@@ -497,7 +497,23 @@ def main():
         # Proper operations
         {'name': "proper_op",
          'description': "Proper operation (e.g. bind_socket)",
-         'min_role_id': 10}
+         'min_role_id': 10},
+
+        # VServer capabilities 
+        {'name': "capabilities",
+         'description': "VServer bcapabilities (separate by commas)",
+         'min_role_id': 10},
+
+               # Vsys
+        {'name': "vsys",
+         'description': "Bind vsys script fd's to a slice's vsys directory.",
+         'min_role_id': 10},
+
+        # CoDemux
+        {'name': "codemux",
+         'description': "Demux HTTP between slices using localhost ports. Value in the form 'host, localhost port'.",
+         'min_role_id': 10},
+
         ]
 
     # Get list of existing attribute types
@@ -511,6 +527,26 @@ def main():
         else:
             UpdateSliceAttributeType(default_attribute_type['name'], default_attribute_type)
 
+    # Default Initscripts
+    default_initscripts = []
+
+    # Find initscripts and add them to the db
+    for (root, dirs, files) in os.walk("/etc/plc_sliceinitscripts"):
+        for f in files:
+            # Read the file
+            file = open(root + "/" + f, "ro")
+            default_initscripts.append({"name": plc['slice_prefix'] + "_" + f,
+                                        "enabled": True,
+                                        "script": file.read().replace("XXXSITEXXX", url)})
+            file.close()
+
+    # Get list of existing initscripts
+    oldinitscripts = GetInitScripts()
+    oldinitscripts = [script['name'] for script in oldinitscripts]
+
+    for initscript in default_initscripts:
+        if initscript['name'] not in oldinitscripts:  AddInitScript(initscript)
+
     # Setup default slice attribute types
     default_setting_types = [
 
@@ -531,7 +567,6 @@ def main():
          'name' : "backdoor",
          'description': "For testing new settings",
          'min_role_id' : 10},
-
         ] + [
         { "category" : "WiFi",
           "name" : x,
@@ -574,13 +609,24 @@ def main():
          'description': "PlanetFlow Traffic Auditing Service",
          'url': url,
          'instantiation': "plc-instantiated",
-         # Renew forever
-         'expires': sys.maxint,
+         # Renew forever (minus one day, work around date conversion weirdness)
+         'expires': sys.maxint - (60 * 60 * 24),
          'attributes': [('system', "1"),
                         ('vref', "planetflow"),
                         ('proper_op', "open file=/etc/passwd, flags=r"),
                         ('proper_op', "create_socket"),
                         ('proper_op', "bind_socket")]},
+          # 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',
+         'url': url,
+         'instantiation': "plc-instantiated",
+         # Renew forever (minus one day, work around date conversion weirdness)
+         'expires': sys.maxint - (60 * 60 * 24),
+         'attributes': [('system', "1"),
+                        ('net_min_rate', "2000"),
+                        ('cpu_pct', "25"),
+                        ('initscript', plc['slice_prefix'] + "_sirius")]}
         ]
     
     for default_slice in default_slices: