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