8691132e36f6cea061022b13489d8a22f25b69f5
[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     {'tagname': "isolate_loopback",
32      'description': "Create an isolated loopback interface within the vserver rather than sharing with all vservers.",
33      'category' : 'slice/rspec'},
34     
35     # CPU share
36     {'tagname': "cpu_pct",
37      'description': "Reserved CPU percent",
38      'category' : 'slice/rspec'},
39     {'tagname': "cpu_share",
40      'description': "Number of CPU shares",
41      'category' : 'slice/rspec'},
42     {'tagname': "cpu_cores",
43      'description': "Number of CPU cores",
44      'category': 'slice/rspec'},
45     
46     # Bandwidth limits
47     {'tagname': "net_min_rate",
48      'description': "Minimum bandwidth (kbps)",
49      'category' : 'slice/rspec'},
50     {'tagname': "net_max_rate",
51      'description': "Maximum bandwidth (kbps)",
52      'category' : 'slice/rspec'},
53     {'tagname': "net_i2_min_rate",
54      'description': "Minimum bandwidth over I2 routes (kbps)",
55      'category' : 'slice/rspec'},
56     {'tagname': "net_i2_max_rate",
57      'description': "Maximum bandwidth over I2 routes (kbps)",
58      'category' : 'slice/rspec'},
59     {'tagname': "net_max_kbyte",
60      'description': "Maximum daily network Tx KByte limit.",
61      'category' : 'slice/rspec'},
62     {'tagname': "net_thresh_kbyte",
63      'description': "KByte limit before warning and throttling.",
64      'category' : 'slice/rspec'},
65     {'tagname': "net_i2_max_kbyte",
66      'description': "Maximum daily network Tx KByte limit to I2 hosts.",
67      'category' : 'slice/rspec'},
68     {'tagname': "net_i2_thresh_kbyte",
69      'description': "KByte limit to I2 hosts before warning and throttling.",
70      'category' : 'slice/rspec'},
71     {'tagname': "net_share",
72      'description': "Number of bandwidth shares",
73      'category' : 'slice/rspec'},
74     {'tagname': "net_i2_share",
75      'description': "Number of bandwidth shares over I2 routes",
76      'category' : 'slice/rspec'},
77     
78     # Disk quota
79     {'tagname': "disk_max",
80      'description': "Disk quota (1k disk blocks)",
81      'category' : 'slice/rspec'},
82     
83     # deprecated in nov. 2010
84     # Proper operations
85     #{'tagname': "proper_op",
86     # 'description': "Proper operation (e.g. bind_socket)",
87     # 'category' : 'slice/rspec'},
88     
89     # VServer capabilities 
90     {'tagname': "capabilities",
91      'description': "VServer bcapabilities (separate by commas)",
92      'category' : 'slice/rspec'},
93     
94     # Vsys
95     {'tagname': "vsys",
96      'description': "Bind vsys script fd's to a slice's /vsys directory.",
97      'category' : 'slice/rspec'},
98     
99     # CoDemux
100     {'tagname': "codemux",
101      'description': "Demux HTTP between slices using localhost ports. Value in the form 'host, localhost port'.",
102      'category' : 'slice/rspec'},
103     
104     # Delegation
105     {'tagname': "delegations",
106      'description': "Coma seperated list of slices to give delegation authority to.",
107      'category' : 'slice/rspec',
108      'roles' : ['admin','pi','user']},
109
110     # Capability to give a sliver access to unused raw disk
111     {'tagname': "rawdisk",
112      'description': "map unused raw disk devices into the slice",
113      'category' : 'slice/access', # we should get rid of this category thing
114      'roles': ['admin','pi']},
115
116     { 'tagname' : 'exempt_slice_until',
117       'description' : 'Exclude this slice from MyOps until given date (YYYYMMDD)',
118       'category' : 'slice/myops'},
119
120     # DistributedRateLimiting slice
121     {'tagname': "drl",
122      'description': "Is a default Distributed Rate Limiting slice (1) or not (0 or unset)",
123      'category' : 'slice/general'},
124
125 ]
126
127 import resource
128 # add in the platform supported rlimits to the default_attribute_types
129 for entry in resource.__dict__.keys() + ["VLIMIT_OPENFD"]:
130     if entry.find("LIMIT_")==1:
131         rlim = entry[len("RLIMIT_"):]
132         rlim = rlim.lower()
133         for ty in ("min","soft","hard"):
134             attribute = {
135                 'tagname': "%s_%s"%(rlim,ty),
136                 'description': "Per sliver RLIMIT %s_%s."%(rlim,ty),
137                 'category': 'slice/limit',
138                 }
139             slicetag_types.append(attribute)
140
141 for slicetag_type in slicetag_types:
142     SetTagType(slicetag_type)