Statistics
| Branch: | Tag: | Revision:

root / snf-astakos-app / astakos / im / presentation.py @ 447475de

History | View | Annotate | Download (10.3 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.active_ram': {
100
            'help_text': 'RAM used by active VMs ',
101
            'help_text_input_each': ('This is the total amount of RAM that '
102
                                     'will be granted to each user of this '
103
                                     'Project (on all active VMs)  '),
104
            'is_abbreviation': False,
105
            'report_desc': 'Active RAM',
106
            'placeholder': 'eg. 4GB',
107
            'verbose_name': 'Active RAM',
108
            'group': 'compute'
109

    
110
        },
111
        'cyclades.cpu': {
112
            'help_text': 'CPUs used by VMs ',
113
            'help_text_input_each': ('This is the total number of CPUs that '
114
                                     'will be granted to each user of this '
115
                                     'Project (on all VMs)  '),
116
            'is_abbreviation': True,
117
            'report_desc': 'CPUs',
118
            'placeholder': 'eg. 1',
119
            'verbose_name': 'cpu',
120
            'group': 'compute'
121

    
122
        },
123
        'cyclades.active_cpu': {
124
            'help_text': 'CPUs used by active VMs ',
125
            'help_text_input_each': ('This is the total number of CPUs that '
126
                                     'will be granted to each user of this '
127
                                     'Project (on all active VMs)  '),
128
            'is_abbreviation': False,
129
            'report_desc': 'Active CPUs',
130
            'placeholder': 'eg. 1',
131
            'verbose_name': 'Active CPU',
132
            'group': 'compute'
133

    
134
        },
135
        'cyclades.vm': {
136
            'help_text': ('These are the VMs one can create on the '
137
                          'Cyclades UI '),
138
            'help_text_input_each': ('This is the total number of VMs that '
139
                                     'will be granted to each user of this '
140
                                     'Project '),
141
            'is_abbreviation': True,
142
            'report_desc': 'Virtual Machines',
143
            'placeholder': 'eg. 2',
144
            'verbose_name': 'vm',
145
            'group': 'compute'
146

    
147
        },
148
        'cyclades.network.private': {
149
            'help_text': ('These are the Private Networks one can create on '
150
                          'the Cyclades UI. '),
151
            'help_text_input_each': ('This is the total number of Private '
152
                                     'Networks that will be granted to each '
153
                                     'user of this Project '),
154
            'is_abbreviation': False,
155
            'report_desc': 'Private Networks',
156
            'placeholder': 'eg. 1',
157
            'verbose_name': 'Private Network',
158
            'group': 'network'
159

    
160
        },
161
        'cyclades.floating_ip': {
162
            'help_text': ('These are the Public (Floating) IPs one can '
163
                          'reserve on the Cyclades UI. '),
164
            'help_text_input_each': ('This is the total number of Public '
165
                                     '(Floating) IPs that will be granted to '
166
                                     'each user of this Project '),
167
            'is_abbreviation': False,
168
            'report_desc': 'Public (Floating) IPs',
169
            'placeholder': 'eg. 1',
170
            'verbose_name': 'Public (Floating) IP',
171
            'group': 'network'
172

    
173
        },
174
        'astakos.pending_app': {
175
            'help_text': ('Pending project applications limit'),
176
            'help_text_input_each': ('Total pending project applications user '
177
                                     'is allowed to create'),
178
            'is_abbreviation': False,
179
            'report_desc': 'Pending Project Applications',
180
            'placeholder': 'eg. 2',
181
            'verbose_name': 'pending project application',
182
            'group': 'accounts'
183

    
184
        },
185
    },
186
    'groups_order': ['storage', 'compute', 'network', 'accounts'],
187
    'resources_order': ['pithos.diskspace',
188
                        'cyclades.disk',
189
                        'cyclades.cpu',
190
                        'cyclades.active_cpu',
191
                        'cyclades.ram',
192
                        'cyclades.active_ram',
193
                        'cyclades.vm',
194
                        'cyclades.network.private',
195
                        'cyclades.floating_ip',
196
                        'astakos.pending_app'
197
                        ],
198
    'exclude_from_usage': ['astakos.pending_app']
199
}
200

    
201
# extend from settings
202
RESOURCES = dict_merge(RESOURCES, settings.RESOURCES_META)
203

    
204

    
205
def component_defaults(service_name):
206
    """
207
    Metadata for unkown services
208
    """
209
    return {
210
        'name': service_name,
211
        'order': 1000,
212
        'verbose_name': service_name.title(),
213
        'cloudbar': {
214
            'show': True,
215
            'title': service_name
216
        },
217
        'dashboard': {
218
            'show': True,
219
            'order': 1000,
220
            'description': '%s service' % service_name
221
        }
222
    }
223

    
224

    
225
COMPONENTS = {
226
    'astakos': {
227
        'order': 1,
228
        'dashboard': {
229
            'order': 3,
230
            'show': True,
231
            'description': "Access the dashboard from the top right corner "
232
                           "of your screen. Here you can manage your profile, "
233
                           "see the usage of your resources and manage "
234
                           "projects to share virtual resources with "
235
                           "colleagues."
236
        },
237
        'cloudbar': {
238
            'show': False
239
        }
240
    },
241
    'pithos': {
242
        'order': 2,
243
        'dashboard': {
244
            'order': 1,
245
            'show': True,
246
            'description': "Pithos is the File Storage service. "
247
                           "Click to start uploading and managing your "
248
                           "files on the cloud."
249
        },
250
        'cloudbar': {
251
            'show': True
252
        }
253
    },
254
    'cyclades': {
255
        'order': 3,
256
        'dashboard': {
257
            'order': 2,
258
            'show': True,
259
            'description': "Cyclades is the Compute and Network Service. "
260
                           "Click to start creating Virtual Machines and "
261
                           "connect them to arbitrary Networks."
262
        },
263
        'cloudbar': {
264
            'show': True
265
        }
266
    }
267
}
268

    
269

    
270
PROJECT_MEMBER_JOIN_POLICIES = {
271
    1: 'automatically accepted',
272
    2: 'owner accepts',
273
    3: 'closed',
274
}
275

    
276

    
277
PROJECT_MEMBER_LEAVE_POLICIES = {
278
    1: 'automatically accepted',
279
    2: 'owner accepts',
280
    3: 'closed',
281
}