Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
48dcff49
authored
Mar 23, 2014
by
Dudás Ádám
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: create VM operations
parent
25356007
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
15 deletions
+15
-15
circle/vm/models/instance.py
+15
-15
circle/vm/models/operation.py
+0
-0
No files found.
circle/vm/models/instance.py
View file @
48dcff49
...
...
@@ -728,7 +728,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
"""
return
scheduler
.
select_node
(
self
,
Node
.
objects
.
all
())
def
_
_
schedule_vm
(
self
,
act
):
def
_schedule_vm
(
self
,
act
):
"""Schedule the virtual machine as part of a higher level activity.
:param act: Parent activity.
...
...
@@ -743,7 +743,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
self
.
save
()
def
_
_
deploy_vm
(
self
,
act
,
timeout
=
15
):
def
_deploy_vm
(
self
,
act
,
timeout
=
15
):
"""Deploy the virtual machine.
:param self: The virtual machine.
...
...
@@ -793,7 +793,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
on_commit
=
__on_commit
,
task_uuid
=
task_uuid
,
user
=
user
)
as
act
:
self
.
_
_
schedule_vm
(
act
)
self
.
_schedule_vm
(
act
)
# Deploy virtual images
with
act
.
sub_activity
(
'deploying_disks'
):
...
...
@@ -808,7 +808,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
# deploy disk
disk
.
deploy
()
self
.
_
_
deploy_vm
(
act
)
self
.
_deploy_vm
(
act
)
def
deploy_async
(
self
,
user
=
None
):
"""Execute deploy asynchronously.
...
...
@@ -818,7 +818,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
return
local_tasks
.
deploy
.
apply_async
(
args
=
[
self
,
user
],
queue
=
"localhost.man"
)
def
_
_
destroy_vm
(
self
,
act
,
timeout
=
15
):
def
_destroy_vm
(
self
,
act
,
timeout
=
15
):
"""Destroy the virtual machine and its associated networks.
:param self: The virtual machine.
...
...
@@ -844,7 +844,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
else
:
raise
def
_
_
cleanup_after_destroy_vm
(
self
,
act
,
timeout
=
15
):
def
_cleanup_after_destroy_vm
(
self
,
act
,
timeout
=
15
):
"""Clean up the virtual machine's data after destroy.
:param self: The virtual machine.
...
...
@@ -881,14 +881,14 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
task_uuid
=
task_uuid
,
user
=
user
)
as
act
:
# Destroy VM
if
self
.
node
:
self
.
_
_
destroy_vm
(
act
)
self
.
_destroy_vm
(
act
)
self
.
_
_
cleanup_after_destroy_vm
(
act
)
self
.
_cleanup_after_destroy_vm
(
act
)
# Deploy VM
self
.
_
_
schedule_vm
(
act
)
self
.
_schedule_vm
(
act
)
self
.
_
_
deploy_vm
(
act
)
self
.
_deploy_vm
(
act
)
def
redeploy_async
(
self
,
user
=
None
):
"""Execute redeploy asynchronously.
...
...
@@ -907,9 +907,9 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
on_commit
=
__on_commit
)
as
act
:
# Destroy VM
if
self
.
node
:
self
.
_
_
destroy_vm
(
act
)
self
.
_destroy_vm
(
act
)
self
.
_
_
cleanup_after_destroy_vm
(
act
)
self
.
_cleanup_after_destroy_vm
(
act
)
self
.
save
()
def
shut_off_async
(
self
,
user
=
None
):
...
...
@@ -942,14 +942,14 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
user
=
user
)
as
act
:
if
self
.
node
:
self
.
_
_
destroy_vm
(
act
)
self
.
_destroy_vm
(
act
)
# Destroy disks
with
act
.
sub_activity
(
'destroying_disks'
):
for
disk
in
self
.
disks
.
all
():
disk
.
destroy
()
self
.
_
_
cleanup_after_destroy_vm
(
act
)
self
.
_cleanup_after_destroy_vm
(
act
)
self
.
destroyed_at
=
timezone
.
now
()
self
.
save
()
...
...
@@ -1019,7 +1019,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
task_uuid
=
task_uuid
,
user
=
user
)
as
act
:
# Schedule vm
self
.
_
_
schedule_vm
(
act
)
self
.
_schedule_vm
(
act
)
queue_name
=
self
.
get_remote_queue_name
(
'vm'
)
# Resume vm
...
...
circle/vm/models/operation.py
View file @
48dcff49
This diff is collapsed.
Click to expand it.
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