Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
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
Commit
eb9b746f
authored
Sep 26, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: move Instance.deploy_vm to DeployVmOperation
parent
95199687
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
13 deletions
+20
-13
circle/vm/models/instance.py
+0
-6
circle/vm/operations.py
+20
-7
No files found.
circle/vm/models/instance.py
View file @
eb9b746f
...
@@ -761,12 +761,6 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
...
@@ -761,12 +761,6 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
for
net
in
self
.
interface_set
.
all
():
for
net
in
self
.
interface_set
.
all
():
net
.
shutdown
()
net
.
shutdown
()
def
deploy_vm
(
self
,
timeout
=
15
):
queue_name
=
self
.
get_remote_queue_name
(
'vm'
,
'slow'
)
return
vm_tasks
.
deploy
.
apply_async
(
args
=
[
self
.
get_vm_desc
()],
queue
=
queue_name
)
.
get
(
timeout
=
timeout
)
def
migrate_vm
(
self
,
to_node
,
timeout
=
120
):
def
migrate_vm
(
self
,
to_node
,
timeout
=
120
):
queue_name
=
self
.
get_remote_queue_name
(
'vm'
,
'slow'
)
queue_name
=
self
.
get_remote_queue_name
(
'vm'
,
'slow'
)
return
vm_tasks
.
migrate
.
apply_async
(
args
=
[
self
.
vm_name
,
return
vm_tasks
.
migrate
.
apply_async
(
args
=
[
self
.
vm_name
,
...
...
circle/vm/operations.py
View file @
eb9b746f
...
@@ -28,7 +28,8 @@ from django.conf import settings
...
@@ -28,7 +28,8 @@ from django.conf import settings
from
sizefield.utils
import
filesizeformat
from
sizefield.utils
import
filesizeformat
from
celery.exceptions
import
TimeLimitExceeded
from
celery.contrib.abortable
import
AbortableAsyncResult
from
celery.exceptions
import
TimeLimitExceeded
,
TimeoutError
from
common.models
import
(
from
common.models
import
(
create_readable
,
humanize_exception
,
HumanReadableException
create_readable
,
humanize_exception
,
HumanReadableException
...
@@ -318,12 +319,7 @@ class DeployOperation(InstanceOperation):
...
@@ -318,12 +319,7 @@ class DeployOperation(InstanceOperation):
# Deploy VM on remote machine
# Deploy VM on remote machine
if
self
.
instance
.
state
not
in
[
'PAUSED'
]:
if
self
.
instance
.
state
not
in
[
'PAUSED'
]:
rn
=
create_readable
(
ugettext_noop
(
"deploy virtual machine"
),
self
.
instance
.
_deploy_vm
(
parent_activity
=
activity
)
ugettext_noop
(
"deploy vm to
%(node)
s"
),
node
=
self
.
instance
.
node
)
with
activity
.
sub_activity
(
'deploying_vm'
,
readable_name
=
rn
)
as
deploy_act
:
deploy_act
.
result
=
self
.
instance
.
deploy_vm
(
timeout
=
timeout
)
# Establish network connection (vmdriver)
# Establish network connection (vmdriver)
with
activity
.
sub_activity
(
with
activity
.
sub_activity
(
...
@@ -343,6 +339,23 @@ class DeployOperation(InstanceOperation):
...
@@ -343,6 +339,23 @@ class DeployOperation(InstanceOperation):
"wait operating system loading"
),
interruptible
=
True
)
"wait operating system loading"
),
interruptible
=
True
)
@register_operation
@register_operation
class
DeployVmOperation
(
SubOperationMixin
,
InstanceOperation
):
id
=
"_deploy_vm"
name
=
_
(
"deploy vm"
)
description
=
_
(
"Deploy all associated disks."
)
remote_queue
=
(
"vm"
,
"slow"
)
task
=
vm_tasks
.
deploy
def
_get_remote_args
(
self
):
return
[
self
.
instance
.
get_vm_desc
()]
# intentionally not calling super
def
get_activity_name
(
self
,
kwargs
):
return
create_readable
(
ugettext_noop
(
"deploy virtual machine"
),
ugettext_noop
(
"deploy vm to
%(node)
s"
),
node
=
self
.
instance
.
node
)
@register_operation
class
DeployDisksOperation
(
SubOperationMixin
,
InstanceOperation
):
class
DeployDisksOperation
(
SubOperationMixin
,
InstanceOperation
):
id
=
"_deploy_disks"
id
=
"_deploy_disks"
name
=
_
(
"deploy disks"
)
name
=
_
(
"deploy disks"
)
...
...
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