root / snf-astakos-app / astakos / im / presentation.py @ 4b805d30
History | View | Annotate | Download (8.7 kB)
1 |
# Copyright 2012, 2013 GRNET S.A. All rights reserved.
|
---|---|
2 |
#
|
3 |
# Redistribution and use in source and binary forms, with or
|
4 |
# without modification, are permitted provided that the following
|
5 |
# conditions are met:
|
6 |
#
|
7 |
# 1. Redistributions of source code must retain the above
|
8 |
# copyright notice, this list of conditions and the following
|
9 |
# disclaimer.
|
10 |
#
|
11 |
# 2. Redistributions in binary form must reproduce the above
|
12 |
# copyright notice, this list of conditions and the following
|
13 |
# disclaimer in the documentation and/or other materials
|
14 |
# provided with the distribution.
|
15 |
#
|
16 |
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
|
17 |
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18 |
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
19 |
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
|
20 |
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
21 |
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
22 |
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
23 |
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
24 |
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
25 |
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
26 |
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
27 |
# POSSIBILITY OF SUCH DAMAGE.
|
28 |
#
|
29 |
# The views and conclusions contained in the software and
|
30 |
# documentation are those of the authors and should not be
|
31 |
# interpreted as representing official policies, either expressed
|
32 |
# or implied, of GRNET S.A.
|
33 |
|
34 |
from astakos.im import settings |
35 |
from synnefo.lib.utils import dict_merge |
36 |
|
37 |
RESOURCES = { |
38 |
'groups': {
|
39 |
'compute': {
|
40 |
'help_text': ('Compute resources ' |
41 |
'(amount of VMs, CPUs, RAM, System disk) '),
|
42 |
'is_abbreviation': False, |
43 |
'report_desc': '', |
44 |
'verbose_name': 'compute', |
45 |
}, |
46 |
'storage': {
|
47 |
'help_text': ('Storage resources ' |
48 |
'(amount of space to store files on Pithos) '),
|
49 |
'is_abbreviation': False, |
50 |
'report_desc': '', |
51 |
'verbose_name': 'storage', |
52 |
}, |
53 |
'network': {
|
54 |
'help_text': ' Network resources (number of Private Networks) ', |
55 |
'is_abbreviation': False, |
56 |
'report_desc': '', |
57 |
'verbose_name': 'network', |
58 |
}, |
59 |
}, |
60 |
'resources': {
|
61 |
'pithos.diskspace': {
|
62 |
'help_text': ('This is the space on Pithos for storing files ' |
63 |
'and VM Images. '),
|
64 |
'help_text_input_each': ('This is the total amount of space on ' |
65 |
'Pithos that will be granted to each '
|
66 |
'user of this Project '),
|
67 |
'is_abbreviation': False, |
68 |
'report_desc': 'Storage Space', |
69 |
'placeholder': 'eg. 10GB', |
70 |
'verbose_name': 'Storage Space', |
71 |
'group': 'storage' |
72 |
}, |
73 |
'cyclades.disk': {
|
74 |
'help_text': ('This is the System Disk that the VMs have that ' |
75 |
'run the OS '),
|
76 |
'help_text_input_each': ("This is the total amount of System Disk " |
77 |
"that will be granted to each user of "
|
78 |
"this Project (this refers to the total "
|
79 |
"System Disk of all VMs, not each VM's "
|
80 |
"System Disk) "),
|
81 |
'is_abbreviation': False, |
82 |
'report_desc': 'System Disk', |
83 |
'placeholder': 'eg. 5GB, 2GB etc', |
84 |
'verbose_name': 'System Disk', |
85 |
'group': 'compute' |
86 |
}, |
87 |
'cyclades.ram': {
|
88 |
'help_text': 'RAM used by VMs ', |
89 |
'help_text_input_each': ('This is the total amount of RAM that ' |
90 |
'will be granted to each user of this '
|
91 |
'Project (on all VMs) '),
|
92 |
'is_abbreviation': True, |
93 |
'report_desc': 'RAM', |
94 |
'placeholder': 'eg. 4GB', |
95 |
'verbose_name': 'ram', |
96 |
'group': 'compute' |
97 |
|
98 |
}, |
99 |
'cyclades.cpu': {
|
100 |
'help_text': 'CPUs used by VMs ', |
101 |
'help_text_input_each': ('This is the total number of CPUs that ' |
102 |
'will be granted to each user of this '
|
103 |
'Project (on all VMs) '),
|
104 |
'is_abbreviation': True, |
105 |
'report_desc': 'CPUs', |
106 |
'placeholder': 'eg. 1', |
107 |
'verbose_name': 'cpu', |
108 |
'group': 'compute' |
109 |
|
110 |
}, |
111 |
'cyclades.vm': {
|
112 |
'help_text': ('These are the VMs one can create on the ' |
113 |
'Cyclades UI '),
|
114 |
'help_text_input_each': ('This is the total number of VMs that ' |
115 |
'will be granted to each user of this '
|
116 |
'Project '),
|
117 |
'is_abbreviation': True, |
118 |
'report_desc': 'Virtual Machines', |
119 |
'placeholder': 'eg. 2', |
120 |
'verbose_name': 'vm', |
121 |
'group': 'compute' |
122 |
|
123 |
}, |
124 |
'cyclades.network.private': {
|
125 |
'help_text': ('These are the Private Networks one can create on ' |
126 |
'the Cyclades UI. '),
|
127 |
'help_text_input_each': ('This is the total number of Private ' |
128 |
'Networks that will be granted to each '
|
129 |
'user of this Project '),
|
130 |
'is_abbreviation': False, |
131 |
'report_desc': 'Private Networks', |
132 |
'placeholder': 'eg. 1', |
133 |
'verbose_name': 'Private Network', |
134 |
'group': 'network' |
135 |
|
136 |
}, |
137 |
'astakos.pending_app': {
|
138 |
'help_text': ('Pending project applications limit'), |
139 |
'help_text_input_each': ('Total pending project applications user ' |
140 |
'is allowed to create'),
|
141 |
'is_abbreviation': False, |
142 |
'report_desc': 'Pending Project Applications', |
143 |
'placeholder': 'eg. 2', |
144 |
'verbose_name': 'pending project application', |
145 |
'group': 'accounts' |
146 |
|
147 |
}, |
148 |
}, |
149 |
'groups_order': ['storage', 'compute', 'network', 'accounts'], |
150 |
'resources_order': ['pithos.diskspace', |
151 |
'cyclades.disk',
|
152 |
'cyclades.cpu',
|
153 |
'cyclades.ram',
|
154 |
'cyclades.vm',
|
155 |
'cyclades.network.private',
|
156 |
'astakos.pending_app'
|
157 |
], |
158 |
'exclude_from_usage': ['astakos.pending_app'] |
159 |
} |
160 |
|
161 |
# extend from settings
|
162 |
RESOURCES = dict_merge(RESOURCES, settings.RESOURCES_META) |
163 |
|
164 |
|
165 |
def component_defaults(service_name): |
166 |
"""
|
167 |
Metadata for unkown services
|
168 |
"""
|
169 |
return {
|
170 |
'name': service_name,
|
171 |
'order': 1000, |
172 |
'verbose_name': service_name.title(),
|
173 |
'cloudbar': {
|
174 |
'show': True, |
175 |
'title': service_name
|
176 |
}, |
177 |
'dashboard': {
|
178 |
'show': True, |
179 |
'order': 1000, |
180 |
'description': '%s service' % service_name |
181 |
} |
182 |
} |
183 |
|
184 |
|
185 |
COMPONENTS = { |
186 |
'astakos': {
|
187 |
'url': '/im/landing', |
188 |
'order': 1, |
189 |
'dashboard': {
|
190 |
'order': 3, |
191 |
'show': True, |
192 |
'description': "Access the dashboard from the top right corner " |
193 |
"of your screen. Here you can manage your profile, "
|
194 |
"see the usage of your resources and manage "
|
195 |
"projects to share virtual resources with "
|
196 |
"colleagues."
|
197 |
}, |
198 |
'cloudbar': {
|
199 |
'show': False |
200 |
} |
201 |
}, |
202 |
'pithos': {
|
203 |
'url': '/pithos/ui/', |
204 |
'order': 2, |
205 |
'dashboard': {
|
206 |
'order': 1, |
207 |
'show': True, |
208 |
'description': "Pithos is the File Storage service. " |
209 |
"Click to start uploading and managing your "
|
210 |
"files on the cloud."
|
211 |
}, |
212 |
'cloudbar': {
|
213 |
'show': True |
214 |
} |
215 |
}, |
216 |
'cyclades': {
|
217 |
'url': '/cyclades/ui/', |
218 |
'order': 3, |
219 |
'dashboard': {
|
220 |
'order': 2, |
221 |
'show': True, |
222 |
'description': "Cyclades is the Compute and Network Service. " |
223 |
"Click to start creating Virtual Machines and "
|
224 |
"connect them to arbitrary Networks."
|
225 |
}, |
226 |
'cloudbar': {
|
227 |
'show': True |
228 |
} |
229 |
} |
230 |
} |
231 |
|
232 |
|
233 |
PROJECT_MEMBER_JOIN_POLICIES = { |
234 |
1: 'automatically accepted', |
235 |
2: 'owner accepts', |
236 |
3: 'closed', |
237 |
} |
238 |
|
239 |
|
240 |
PROJECT_MEMBER_LEAVE_POLICIES = { |
241 |
1: 'automatically accepted', |
242 |
2: 'owner accepts', |
243 |
3: 'closed', |
244 |
} |