Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
8fdeebb8
authored
Oct 15, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: add node option for deploy operation
closes #337
parent
345a3659
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
5 deletions
+36
-5
circle/dashboard/forms.py
+14
-0
circle/dashboard/views/vm.py
+17
-4
circle/vm/operations.py
+5
-1
No files found.
circle/dashboard/forms.py
View file @
8fdeebb8
...
...
@@ -943,6 +943,20 @@ class VmAddInterfaceForm(forms.Form):
return
helper
class
VmDeployForm
(
forms
.
Form
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
choices
=
kwargs
.
pop
(
'choices'
,
None
)
super
(
VmDeployForm
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
if
choices
is
not
None
:
self
.
fields
.
insert
(
0
,
'node'
,
forms
.
ModelChoiceField
(
queryset
=
choices
,
label
=
_
(
'Node'
),
help_text
=
_
(
"Deploy virtual machine to this node "
"(blank allows scheduling automatically)."
)))
class
CircleAuthenticationForm
(
AuthenticationForm
):
# fields: username, password
...
...
circle/dashboard/views/vm.py
View file @
8fdeebb8
...
...
@@ -60,7 +60,7 @@ from ..forms import (
VmAddInterfaceForm
,
VmCreateDiskForm
,
VmDownloadDiskForm
,
VmSaveForm
,
VmRenewForm
,
VmStateChangeForm
,
VmListSearchForm
,
VmCustomizeForm
,
TransferOwnershipForm
,
VmDiskResizeForm
,
RedeployForm
,
VmDiskRemoveForm
,
VmMigrateForm
,
VmMigrateForm
,
VmDeployForm
,
)
from
..models
import
Favourite
,
Profile
...
...
@@ -605,7 +605,6 @@ class VmStateChangeView(FormOperationMixin, VmOperationView):
op
=
'emergency_change_state'
icon
=
'legal'
effect
=
'danger'
show_in_toolbar
=
True
form_class
=
VmStateChangeForm
wait_for_result
=
0.5
...
...
@@ -628,9 +627,23 @@ class RedeployView(FormOperationMixin, VmOperationView):
wait_for_result
=
0.5
class
VmDeployView
(
FormOperationMixin
,
VmOperationView
):
op
=
'deploy'
icon
=
'play'
effect
=
'success'
form_class
=
VmDeployForm
def
get_form_kwargs
(
self
):
kwargs
=
super
(
VmOperationView
,
self
)
.
get_form_kwargs
()
if
self
.
request
.
user
.
is_superuser
:
online
=
(
n
.
pk
for
n
in
Node
.
objects
.
filter
(
enabled
=
True
)
if
n
.
online
)
kwargs
[
'choices'
]
=
Node
.
objects
.
filter
(
pk__in
=
online
)
return
kwargs
vm_ops
=
OrderedDict
([
(
'deploy'
,
VmOperationView
.
factory
(
op
=
'deploy'
,
icon
=
'play'
,
effect
=
'success'
)),
(
'deploy'
,
VmDeployView
),
(
'wake_up'
,
VmOperationView
.
factory
(
op
=
'wake_up'
,
icon
=
'sun-o'
,
effect
=
'success'
)),
(
'sleep'
,
VmOperationView
.
factory
(
...
...
circle/vm/operations.py
View file @
8fdeebb8
...
...
@@ -324,9 +324,13 @@ class DeployOperation(InstanceOperation):
"deployed to node:
%(node)
s"
),
node
=
self
.
instance
.
node
)
def
_operation
(
self
,
activity
):
def
_operation
(
self
,
activity
,
node
=
None
):
# Allocate VNC port and host node
self
.
instance
.
allocate_vnc_port
()
if
node
is
not
None
:
self
.
instance
.
node
=
node
self
.
instance
.
save
()
else
:
self
.
instance
.
allocate_node
()
# Deploy virtual images
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment