add steps to build and install Monitor docs into plc
[myplc.git] / db-config
index 4389687..4a1a22d 100755 (executable)
--- a/db-config
+++ b/db-config
@@ -98,6 +98,7 @@ def main():
         ]
 
     #################### interface settings
+    # xxx this should move to PLC/Accessors
 
     # Setup default slice attribute types
     default_setting_types = [
@@ -138,6 +139,7 @@ def main():
         ]
 
     #################### slice attributes
+    # xxx this should move to PLC/Accessors
 
     # Setup default slice attribute types
     default_attribute_types = [
@@ -253,11 +255,17 @@ 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"):
@@ -265,7 +273,7 @@ def main():
                     '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)
 
@@ -451,34 +459,6 @@ def main():
          'ignore_cmd_errors': False,
          'always_update': False},
 
-        # XXX Required for old Node Manager
-        # Proper configuration
-        {'enabled': True,
-         'source': 'PlanetLabConf/propd.conf',
-         'dest': '/etc/proper/propd.conf',
-         'file_permissions': '644',
-         'file_owner': 'root',
-         'file_group': 'root',
-         'preinstall_cmd': '',
-         'postinstall_cmd': '/etc/init.d/proper restart',
-         'error_cmd': '',
-         'ignore_cmd_errors': True,
-         'always_update': False},
-
-        # XXX Required for old Node Manager
-        # Bandwidth cap
-        {'enabled': True,
-         'source': 'PlanetLabConf/bwlimit.php',
-         'dest': '/etc/planetlab/bwcap',
-         'file_permissions': '644',
-         'file_owner': 'root',
-         'file_group': 'root',
-         'preinstall_cmd': '',
-         'postinstall_cmd': '',
-         'error_cmd': '',
-         'ignore_cmd_errors': True,
-         'always_update': False},
-
         # Proxy ARP setup
         {'enabled': True,
          'source': 'PlanetLabConf/proxies.php',
@@ -658,7 +638,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',
@@ -673,6 +653,7 @@ def main():
         ]
     
     for default_slice in default_slices:
+        attributes=default_slice.pop('attributes')
         slices = GetSlices([default_slice['name']])
         if slices:
             slice = slices[0]
@@ -682,19 +663,19 @@ def main():
             slice = GetSlices([default_slice['name']])[0]
 
         # Create/update all attributes
-        slice_attributes = []
-        if slice['slice_attribute_ids']:
+        slice_tags = []
+        if slice['slice_tag_ids']:
             # Delete unknown attributes
-            for slice_attribute in GetSliceAttributes(slice['slice_attribute_ids']):
-                if (slice_attribute['name'], slice_attribute['value']) \
-                   not in default_slice['attributes']:
-                    DeleteSliceAttribute(slice_attribute['slice_attribute_id'])
+            for slice_tag in GetSliceTags(slice['slice_tag_ids']):
+                if (slice_tag['tagname'], slice_tag['value']) \
+                   not in attributes:
+                    DeleteSliceTag(slice_tag['slice_tag_id'])
                 else:
-                    slice_attributes.append((slice_attribute['name'], slice_attribute['value']))
+                    slice_tags.append((slice_tag['tagname'], slice_tag['value']))
 
-        for (name, value) in default_slice['attributes']:
-            if (name, value) not in slice_attributes:
-                AddSliceAttribute(slice['name'], name, value)
+        for (name, value) in attributes:
+            if (name, value) not in slice_tags:
+                AddSliceTag(slice['name'], name, value)
 
     
     #################### body for messages
@@ -947,124 +928,69 @@ message, please reply so that we may investigate the problem.
     #################### PCUs
     
     ### Setup Initial PCU information
-    pcu_types = [{'model': 'AP79xx',
-          'name': 'APC AP79xx',
-          'pcu_protocol_types': [{ 'port': 80,
-                                  'protocol': 'APC79xxHttp',
-                                  'supported': False},
-                                 { 'port': 23,
-                                  'protocol': 'APC79xx',
-                                  'supported': True},
-                                 { 'port': 22,
-                                  'protocol': 'APC79xx',
-                                  'supported': True}],
-          },
-         {'model': 'Masterswitch',
-          'name': 'APC Masterswitch',
-          'pcu_protocol_types': [{ 'port': 80,
-                                  'protocol': 'APCMasterHttp',
-                                  'supported': False},
-                                 { 'port': 23,
-                                  'protocol': 'APCMaster',
-                                  'supported': True},
-                                 { 'port': 22,
-                                  'protocol': 'APCMaster',
-                                  'supported': True}],
-          },
-         {'model': 'DS4-RPC',
-          'name': 'BayTech DS4-RPC',
-          'pcu_protocol_types': [{ 'port': 80,
-                                  'protocol': 'BayTechHttp',
-                                  'supported': False},
-                                 { 'port': 23,
-                                  'protocol': 'BayTech',
-                                  'supported': True},
-                                 { 'port': 22,
-                                  'protocol': 'BayTech',
-                                  'supported': True}],
-          },
-         {'model': 'IP-41x_IP-81x',
-          'name': 'Dataprobe IP-41x & IP-81x',
-          'pcu_protocol_types': [ { 'port': 23,
-                                  'protocol': 'IPALTelnet',
-                                  'supported': True},
-                                  { 'port': 80,
-                                  'protocol': 'IPALHttp',
-                                  'supported': False}],
-          },
-         {'model': 'DRAC3',
-          'name': 'Dell RAC Version 3',
-          'pcu_protocol_types': [],
-          },
-         {'model': 'DRAC4',
-          'name': 'Dell RAC Version 4',
-          'pcu_protocol_types': [{ 'port': 443,
-                                  'protocol': 'DRACRacAdm',
-                                  'supported': True},
-                                 { 'port': 80,
-                                  'protocol': 'DRACRacAdm',
-                                  'supported': False},
-                                 { 'port': 22,
-                                  'protocol': 'DRAC',
-                                  'supported': True}],
-          },
-         {'model': 'ePowerSwitch',
-          'name': 'ePowerSwitch 1/4/8x',
-          'pcu_protocol_types': [{ 'port': 80,
-                                  'protocol': 'ePowerSwitch',
-                                  'supported': True}],
-          },
-         {'model': 'ilo2',
-          'name': 'HP iLO2 (Integrated Lights-Out)',
-          'pcu_protocol_types': [{ 'port': 443,
-                                  'protocol': 'HPiLOHttps',
-                                  'supported': True},
-                                 { 'port': 22,
-                                  'protocol': 'HPiLO',
-                                  'supported': True}],
-          },
-         {'model': 'ilo1',
-          'name': 'HP iLO version 1',
-          'pcu_protocol_types': [],
-          },
-         {'model': 'PM211-MIP',
-          'name': 'Infratec PM221-MIP',
-          'pcu_protocol_types': [],
-          },
-         {'model': 'AMT2.5',
-          'name': 'Intel AMT v2.5 (Active Management Technology)',
-          'pcu_protocol_types': [],
-          },
-         {'model': 'AMT3.0',
-          'name': 'Intel AMT v3.0 (Active Management Technology)',
-          'pcu_protocol_types': [],
-          },
-         {'model': 'WTI_IPS-4',
-          'name': 'Western Telematic (WTI IPS-4)',
-          'pcu_protocol_types': [],
-          },
-         {'model': 'unknown',
-          'name': 'Unknown Vendor or Model',
-          'pcu_protocol_types': [{ 'port': 443,
-                                  'protocol': 'UnknownPCU',
-                                  'supported': False},
-                                 { 'port': 80,
-                                  'protocol': 'UnknownPCU',
-                                  'supported': False},
-                                 { 'port': 23,
-                                  'protocol': 'UnknownPCU',
-                                  'supported': False},
-                                 { 'port': 22,
-                                  'protocol': 'UnknownPCU',
-                                  'supported': False}],
-          }]
+       pcu_types = [
+                        {'model': 'APCControl12p3',
+                         'name': 'APC AP79xx or Masterswitch (sequence 1-2-port-3)', },
+                        {'model': 'APCControl1p4',
+                         'name': 'APC AP79xx or Masterswitch (sequence 1-port-4)', },
+                        {'model': 'APCControl121p3',
+                         'name': 'APC AP79xx or Masterswitch (sequence 1-2-1-port-3)', },
+                        {'model': 'APCControl121p1',
+                         'name': 'APC AP79xx or Masterswitch (sequence 1-2-1-port-1)', },
+                        {'model': 'APCControl13p13',
+                         'name': 'APC AP79xx or Masterswitch (sequence 1-3-port-1-3)', },
+
+                        {'model': 'BayTechRPC3NC', 
+                         'name': 'BayTech with prompt RPC3-NC>', },
+                        {'model': 'BayTechRPC16', 
+                         'name': 'BayTech with prompt RPC-16>', },
+                        {'model': 'BayTech',
+                         'name': 'BayTech with prompt DS-RPC>', },
+                        {'model': 'BayTechCtrlC', 
+                         'name': 'BayTech Ctrl-C, 5, then with prompt DS-RPC>', },
+                        {'model': 'BayTechCtrlCUnibe', 
+                         'name': 'BayTech Ctrl-C, 3, then with prompt DS-RPC>', },
+
+                        {'model': 'BlackBoxPSMaverick',
+                         'name': 'BlackBoxPSMaverick Web based controller'},
+
+                        {'model': 'IPAL', 
+                         'name': 'IPAL - Dataprobe IP-41x & IP-81x', },
+                        {'model': 'DRAC',
+                         'name': 'DRAC - Dell RAC Version 3 or 4', },
+                        {'model': 'ePowerSwitchNew',
+                         'name': 'ePowerSwitch Newer Models 1/4/8x', },
+                        {'model': 'ePowerSwitchOld',
+                         'name': 'ePowerSwitch Older Models 1/4/8x', },
+
+                        {'model': 'HPiLO',
+                         'name': 'HP iLO v1 or v2 (Integrated Lights-Out)', },
+
+                        {'model': 'IntelAMT',
+                         'name': 'Intel AMT v2.5 or v3.0 (Active Management Technology)', },
+
+                        {'model': 'IPMI',
+                         'name': 'OpenIPMI - Intelligent Platform Management Interface', },
+
+                        {'model': 'PM211MIP',
+                         'name': 'Infratec PM221-MIP', },
+
+                        {'model': 'WTIIPS4',
+                         'name': 'Western Telematic (WTI IPS-4)', },
+
+                        {'model': 'ManualPCU',
+                         'name': 'Manual Administrator Operation (choose if model unknown)', },
+                         ]
 
     # Get all model names
     pcu_models = [type['model'] for type in GetPCUTypes()]
     for type in pcu_types:
-        protocol_types = type['pcu_protocol_types']
-        # Take this value out of the struct.
-        del type['pcu_protocol_types']
+               if 'pcu_protocol_types' in type:
+               protocol_types = type['pcu_protocol_types']
+               # Take this value out of the struct.
+               del type['pcu_protocol_types']
+               else:
+                       protocol_types = []
         if type['model'] not in pcu_models:
             # Add the name/model info into DB
             id = AddPCUType(type)
@@ -1072,25 +998,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__':