cc1
v2.1
CC1 source code docs
Main Page
Related Pages
Packages
Classes
Files
File List
cc1
Todo List
Packages
Classes
Files
File List
clm
management
migrations
models
old-tests
tests
utils
views
admin_clm
admin_cm
__init__.py
admin.py
cluster.py
farm.py
iso_image.py
monia.py
network.py
node.py
public_ip.py
storage.py
storage_image.py
system_image.py
template.py
user.py
vm.py
guest
user
__init__.py
__init__.py
config_example.py
defaults.py
settings.py
urls.py
wsgi.py
cm
common
ec2
node
vmm
wi
__init__.py
manage.py
sitecustomize.py
wi_tests_manage.py
•
All
Classes
Namespaces
Files
Functions
Variables
Pages
vm.py
Go to the documentation of this file.
1
# -*- coding: utf-8 -*-
2
# @COPYRIGHT_begin
3
#
4
# Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland
5
#
6
# Licensed under the Apache License, Version 2.0 (the "License");
7
# you may not use this file except in compliance with the License.
8
# You may obtain a copy of the License at
9
#
10
# http://www.apache.org/licenses/LICENSE-2.0
11
#
12
# Unless required by applicable law or agreed to in writing, software
13
# distributed under the License is distributed on an "AS IS" BASIS,
14
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
# See the License for the specific language governing permissions and
16
# limitations under the License.
17
#
18
# @COPYRIGHT_end
19
20
##
21
# @package src.clm.views.admin_cm.vm
22
# @alldecoratedby{src.clm.utils.decorators.admin_cm_log}
23
# @author Maciej Nabożny <mn@mnabozny.pl>
24
#
25
26
from
clm.models.user
import
User
27
from
clm.utils.cm
import
CM
28
from
clm.utils.decorators
import
admin_cm_log, cm_request
29
from
clm.utils.exception
import
CLMException
30
31
32
@
admin_cm_log
(log=
True
, pack=
False
)
33
@cm_request
34
##
35
#
36
# Creates nev VM
37
#
38
# @clmview_admin_cm
39
# @cm_request_transparent{vm.create()}
40
#
41
def
create
(cm_response, **data):
42
return
cm_response
43
44
45
@
admin_cm_log
(log=
True
, pack=
False
)
46
@cm_request
47
##
48
#
49
# @clmview_admin_cm
50
# @cm_request_transparent{vm.destroy()}
51
#
52
def
destroy
(cm_response, **data):
53
return
cm_response
54
55
56
@
admin_cm_log
(log=
False
)
57
@cm_request
58
##
59
#
60
# @clmview_admin_cm
61
# @cm_request{storage_image.get_list()}
62
# @param_post{user_id,int}
63
#
64
def
get_list
(cm_response, **data):
65
names = {}
66
67
for
vm
in
cm_response[
'data'
]:
68
if
str(vm[
'user_id'
])
not
in
names:
69
try
:
70
user = User.objects.get(pk=vm[
'user_id'
])
71
names[str(vm[
'user_id'
])] = user.first +
" "
+ user.last
72
except
:
73
raise
CLMException(
'user_get'
)
74
vm[
'owner'
] = names[str(vm[
'user_id'
])]
75
76
return
cm_response[
'data'
]
77
78
79
@
admin_cm_log
(log=
False
, pack=
False
)
80
@cm_request
81
##
82
#
83
# @clmview_admin_cm
84
# @cm_request_transparent{vm.get_by_id()}
85
#
86
def
get_by_id
(cm_response, **data):
87
return
cm_response
88
89
90
@
admin_cm_log
(log=
True
, pack=
False
)
91
@cm_request
92
##
93
#
94
# @clmview_admin_cm
95
# @cm_request_transparent{vm.save_and_shutdown()}
96
#
97
def
save_and_shutdown
(cm_response, **data):
98
return
cm_response
99
100
101
@
admin_cm_log
(log=
True
, pack=
False
)
102
@cm_request
103
##
104
#
105
# @clmview_admin_cm
106
# @cm_request_transparent{vm.restart()}
107
#
108
def
restart
(cm_response, **data):
109
return
cm_response
110
111
112
@
admin_cm_log
(log=
True
, pack=
False
)
113
@cm_request
114
##
115
#
116
# @clmview_admin_cm
117
# @cm_request_transparent{vm.erase()}
118
#
119
def
erase
(cm_response, **data):
120
return
cm_response
121
122
123
@
admin_cm_log
(log=
True
, pack=
False
)
124
@cm_request
125
##
126
#
127
# @clmview_admin_cm
128
# @cm_request_transparent{vm.attach_vnc()}
129
#
130
def
attach_vnc
(cm_response, **data):
131
return
cm_response
132
133
134
@
admin_cm_log
(log=
True
, pack=
False
)
135
@cm_request
136
##
137
#
138
# @clmview_admin_cm
139
# @cm_request_transparent{vm.detach_vnc()}
140
#
141
def
detach_vnc
(cm_response, **data):
142
return
cm_response
143
clm
views
admin_cm
vm.py
Generated on Wed Jun 18 2014 13:33:03 for cc1 by
1.8.1.2