Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
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
Show 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,
...
@@ -728,7 +728,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
"""
"""
return
scheduler
.
select_node
(
self
,
Node
.
objects
.
all
())
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.
"""Schedule the virtual machine as part of a higher level activity.
:param act: Parent activity.
:param act: Parent activity.
...
@@ -743,7 +743,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
...
@@ -743,7 +743,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
self
.
save
()
self
.
save
()
def
_
_
deploy_vm
(
self
,
act
,
timeout
=
15
):
def
_deploy_vm
(
self
,
act
,
timeout
=
15
):
"""Deploy the virtual machine.
"""Deploy the virtual machine.
:param self: The virtual machine.
:param self: The virtual machine.
...
@@ -793,7 +793,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
...
@@ -793,7 +793,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
on_commit
=
__on_commit
,
task_uuid
=
task_uuid
,
on_commit
=
__on_commit
,
task_uuid
=
task_uuid
,
user
=
user
)
as
act
:
user
=
user
)
as
act
:
self
.
_
_
schedule_vm
(
act
)
self
.
_schedule_vm
(
act
)
# Deploy virtual images
# Deploy virtual images
with
act
.
sub_activity
(
'deploying_disks'
):
with
act
.
sub_activity
(
'deploying_disks'
):
...
@@ -808,7 +808,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
...
@@ -808,7 +808,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
# deploy disk
# deploy disk
disk
.
deploy
()
disk
.
deploy
()
self
.
_
_
deploy_vm
(
act
)
self
.
_deploy_vm
(
act
)
def
deploy_async
(
self
,
user
=
None
):
def
deploy_async
(
self
,
user
=
None
):
"""Execute deploy asynchronously.
"""Execute deploy asynchronously.
...
@@ -818,7 +818,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
...
@@ -818,7 +818,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
return
local_tasks
.
deploy
.
apply_async
(
args
=
[
self
,
user
],
return
local_tasks
.
deploy
.
apply_async
(
args
=
[
self
,
user
],
queue
=
"localhost.man"
)
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.
"""Destroy the virtual machine and its associated networks.
:param self: The virtual machine.
:param self: The virtual machine.
...
@@ -844,7 +844,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
...
@@ -844,7 +844,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
else
:
else
:
raise
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.
"""Clean up the virtual machine's data after destroy.
:param self: The virtual machine.
:param self: The virtual machine.
...
@@ -881,14 +881,14 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
...
@@ -881,14 +881,14 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
task_uuid
=
task_uuid
,
user
=
user
)
as
act
:
task_uuid
=
task_uuid
,
user
=
user
)
as
act
:
# Destroy VM
# Destroy VM
if
self
.
node
:
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
# Deploy VM
self
.
_
_
schedule_vm
(
act
)
self
.
_schedule_vm
(
act
)
self
.
_
_
deploy_vm
(
act
)
self
.
_deploy_vm
(
act
)
def
redeploy_async
(
self
,
user
=
None
):
def
redeploy_async
(
self
,
user
=
None
):
"""Execute redeploy asynchronously.
"""Execute redeploy asynchronously.
...
@@ -907,9 +907,9 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
...
@@ -907,9 +907,9 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
on_commit
=
__on_commit
)
as
act
:
on_commit
=
__on_commit
)
as
act
:
# Destroy VM
# Destroy VM
if
self
.
node
:
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
()
self
.
save
()
def
shut_off_async
(
self
,
user
=
None
):
def
shut_off_async
(
self
,
user
=
None
):
...
@@ -942,14 +942,14 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
...
@@ -942,14 +942,14 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
user
=
user
)
as
act
:
user
=
user
)
as
act
:
if
self
.
node
:
if
self
.
node
:
self
.
_
_
destroy_vm
(
act
)
self
.
_destroy_vm
(
act
)
# Destroy disks
# Destroy disks
with
act
.
sub_activity
(
'destroying_disks'
):
with
act
.
sub_activity
(
'destroying_disks'
):
for
disk
in
self
.
disks
.
all
():
for
disk
in
self
.
disks
.
all
():
disk
.
destroy
()
disk
.
destroy
()
self
.
_
_
cleanup_after_destroy_vm
(
act
)
self
.
_cleanup_after_destroy_vm
(
act
)
self
.
destroyed_at
=
timezone
.
now
()
self
.
destroyed_at
=
timezone
.
now
()
self
.
save
()
self
.
save
()
...
@@ -1019,7 +1019,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
...
@@ -1019,7 +1019,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
task_uuid
=
task_uuid
,
user
=
user
)
as
act
:
task_uuid
=
task_uuid
,
user
=
user
)
as
act
:
# Schedule vm
# Schedule vm
self
.
_
_
schedule_vm
(
act
)
self
.
_schedule_vm
(
act
)
queue_name
=
self
.
get_remote_queue_name
(
'vm'
)
queue_name
=
self
.
get_remote_queue_name
(
'vm'
)
# Resume 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