# Mark Huang <mlhuang@cs.princeton.edu>
# Copyright (C) 2006 The Trustees of Princeton University
#
-# $Id: db-config 7454 2007-12-11 18:55:00Z faiyaza $
+# $Id$
# $HeadURL$
from plc_config import PLCConfiguration
# sudo configuration
{'enabled': True,
- 'source': 'PlanetLabConf/sudoers',
+ 'source': 'PlanetLabConf/sudoers.php',
'dest': '/etc/sudoers',
'file_permissions': '440',
'file_owner': 'root',
'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",
# 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
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("@SITE@", url).replace("@PREFIX@", plc['slice_prefix'])})
+ 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 = [
'name' : "ifname",
'description': "Set interface name, instead of eth0 or the like",
'min_role_id' : 40},
- {'category' : "general",
- 'name' : "driver",
- 'description': "Use this to specify an alternate driver",
- 'min_role_id' : 40 },
- {'category' : "general",
+ {'category' : "Multihome",
'name' : "alias",
- 'description': "Allows to reuse an interface as eth0:alias",
+ 'description': "Specifies that the network is used for multihoming",
'min_role_id' : 40},
{'category' : "hidden",
'name' : "backdoor",
'description': "For testing new settings",
'min_role_id' : 10},
-
] + [
{ "category" : "WiFi",
"name" : x,
'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': 0x7fffffff - (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': 0x7fffffff - (60 * 60 * 24),
+ 'attributes': [('system', "1"),
+ ('net_min_rate', "2000"),
+ ('cpu_pct', "25"),
+ ('initscript', plc['slice_prefix'] + "_sirius")]}
]
for default_slice in default_slices: