review startup steps 'db' and 'accessors' - run accessors first, make
[plcapi.git] / db-config.d / 010-slice_tags
1 # -*-python-*-
2 #################### slice tag types
3 # xxx this should move to PLC/Accessors
4
5 # vref is now defined in an accessor
6 # initscript is now defined in an accessor
7     
8 # Setup default slice tag types
9 slicetag_types = \
10 [
11     # Slice type (only vserver is supported)
12     {'tagname': "type",
13      'description': "Type of slice (e.g. vserver)",
14      'category' : 'slice/general',
15      'roles': ['admin','pi']},
16     
17     # System slice
18     {'tagname': "system",
19      'description': "Is a default system slice (1) or not (0 or unset)",
20      'category' : 'slice/general'},
21     
22     # Slice enabled (1) or suspended (0)
23     {'tagname': "enabled",
24      'description': "Slice enabled (1 or unset) or suspended (0)",
25      'category' : 'slice/general'},
26     
27     # IP Addresses for a Slice
28     {'tagname': "ip_addresses",
29      'description': "Add an ip address to a slice/sliver.",
30      'category' : 'slice/rspec'},
31     
32     # CPU share
33     {'tagname': "cpu_pct",
34      'description': "Reserved CPU percent",
35      'category' : 'slice/rspec'},
36     {'tagname': "cpu_share",
37      'description': "Number of CPU shares",
38      'category' : 'slice/rspec'},
39     
40     # Bandwidth limits
41     {'tagname': "net_min_rate",
42      'description': "Minimum bandwidth (kbps)",
43      'category' : 'slice/rspec'},
44     {'tagname': "net_max_rate",
45      'description': "Maximum bandwidth (kbps)",
46      'category' : 'slice/rspec'},
47     {'tagname': "net_i2_min_rate",
48      'description': "Minimum bandwidth over I2 routes (kbps)",
49      'category' : 'slice/rspec'},
50     {'tagname': "net_i2_max_rate",
51      'description': "Maximum bandwidth over I2 routes (kbps)",
52      'category' : 'slice/rspec'},
53     {'tagname': "net_max_kbyte",
54      'description': "Maximum daily network Tx KByte limit.",
55      'category' : 'slice/rspec'},
56     {'tagname': "net_thresh_kbyte",
57      'description': "KByte limit before warning and throttling.",
58      'category' : 'slice/rspec'},
59     {'tagname': "net_i2_max_kbyte",
60      'description': "Maximum daily network Tx KByte limit to I2 hosts.",
61      'category' : 'slice/rspec'},
62     {'tagname': "net_i2_thresh_kbyte",
63      'description': "KByte limit to I2 hosts before warning and throttling.",
64      'category' : 'slice/rspec'},
65     {'tagname': "net_share",
66      'description': "Number of bandwidth shares",
67      'category' : 'slice/rspec'},
68     {'tagname': "net_i2_share",
69      'description': "Number of bandwidth shares over I2 routes",
70      'category' : 'slice/rspec'},
71     
72     # Disk quota
73     {'tagname': "disk_max",
74      'description': "Disk quota (1k disk blocks)",
75      'category' : 'slice/rspec'},
76     
77     # deprecated in nov. 2010
78     # Proper operations
79     #{'tagname': "proper_op",
80     # 'description': "Proper operation (e.g. bind_socket)",
81     # 'category' : 'slice/rspec'},
82     
83     # VServer capabilities 
84     {'tagname': "capabilities",
85      'description': "VServer bcapabilities (separate by commas)",
86      'category' : 'slice/rspec'},
87     
88     # Vsys
89     {'tagname': "vsys",
90      'description': "Bind vsys script fd's to a slice's /vsys directory.",
91      'category' : 'slice/rspec'},
92     
93     # CoDemux
94     {'tagname': "codemux",
95      'description': "Demux HTTP between slices using localhost ports. Value in the form 'host, localhost port'.",
96      'category' : 'slice/rspec'},
97     
98     # Delegation
99     {'tagname': "delegations",
100      'description': "Coma seperated list of slices to give delegation authority to.",
101      'category' : 'slice/rspec',
102      'roles' : ['admin','pi','user']},
103
104     # Capability to give a sliver access to unused raw disk
105     {'tagname': "rawdisk",
106      'description': "map unused raw disk devices into the slice",
107      'category' : 'slice/access', # we should get rid of this category thing
108      'roles': ['admin','pi']},
109
110     { 'tagname' : 'exempt_slice_until',
111       'description' : 'Exclude this slice from MyOps until given date (YYYYMMDD)',
112       'category' : 'slice/myops'},
113
114     # DistributedRateLimiting slice
115     {'tagname': "drl",
116      'description': "Is a default Distributed Rate Limiting slice (1) or not (0 or unset)",
117      'category' : 'slice/general'},
118
119 ]
120
121 import resource
122 # add in the platform supported rlimits to the default_attribute_types
123 for entry in resource.__dict__.keys() + ["VLIMIT_OPENFD"]:
124     if entry.find("LIMIT_")==1:
125         rlim = entry[len("RLIMIT_"):]
126         rlim = rlim.lower()
127         for ty in ("min","soft","hard"):
128             attribute = {
129                 'tagname': "%s_%s"%(rlim,ty),
130                 'description': "Per sliver RLIMIT %s_%s."%(rlim,ty),
131                 'category': 'slice/limit',
132                 }
133             slicetag_types.append(attribute)
134
135 for slicetag_type in slicetag_types:
136     SetTagType(slicetag_type)