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
72393682
authored
Oct 08, 2013
by
Dudás Ádám
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: make activity related naming consistent
parent
881f4ad3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
circle/vm/models.py
+12
-7
No files found.
circle/vm/models.py
View file @
72393682
...
@@ -523,12 +523,11 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
...
@@ -523,12 +523,11 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
act
.
save
()
act
.
save
()
# Schedule
# Schedule
act
.
update_state
(
'PENDING'
)
self
.
node
=
scheduler
.
get_node
(
self
,
Node
.
objects
.
all
())
self
.
node
=
scheduler
.
get_node
(
self
,
Node
.
objects
.
all
())
self
.
save
()
self
.
save
()
# Create virtual images
# Create virtual images
act
.
update_state
(
'
PREPAR
ING DISKS'
)
act
.
update_state
(
'
DEPLOY
ING DISKS'
)
for
disk
in
self
.
disks
.
all
():
for
disk
in
self
.
disks
.
all
():
disk
.
deploy
()
disk
.
deploy
()
...
@@ -576,13 +575,15 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
...
@@ -576,13 +575,15 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
act
.
task_uuid
=
task_uuid
act
.
task_uuid
=
task_uuid
act
.
save
()
act
.
save
()
queue_name
=
self
.
node
.
host
.
hostname
+
".vm"
queue_name
=
self
.
node
.
host
.
hostname
+
".vm"
# Delete instance
# Destroy virtual machine
act
.
update_state
(
'DESTROYING VM'
)
vm_tasks
.
destroy
.
apply_async
(
args
=
[
self
.
vm_name
],
vm_tasks
.
destroy
.
apply_async
(
args
=
[
self
.
vm_name
],
queue
=
queue_name
)
.
get
()
queue
=
queue_name
)
.
get
()
# Delete networks
# Delete networks
for
net
in
self
.
interface_set
.
all
():
for
net
in
self
.
interface_set
.
all
():
net
.
remove
()
net
.
remove
()
act
.
finish
(
result
=
"DONE"
)
act
.
finish
(
result
=
"SUCCESS"
)
def
destroy_async
(
self
,
user
=
None
):
def
destroy_async
(
self
,
user
=
None
):
"""Execute destroy asynchronously.
"""Execute destroy asynchronously.
...
@@ -610,7 +611,7 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
...
@@ -610,7 +611,7 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
local_tasks
.
sleep
.
apply_async
(
args
=
[
self
,
user
],
queue
=
"localhost.man"
)
local_tasks
.
sleep
.
apply_async
(
args
=
[
self
,
user
],
queue
=
"localhost.man"
)
def
wake_up
(
self
,
user
=
None
,
task_uuid
=
None
):
def
wake_up
(
self
,
user
=
None
,
task_uuid
=
None
):
act
=
InstanceActivity
(
activity_code
=
'vm.Instance.
resume
'
)
act
=
InstanceActivity
(
activity_code
=
'vm.Instance.
wake_up
'
)
act
.
instance
=
self
act
.
instance
=
self
act
.
user
=
user
act
.
user
=
user
act
.
started
=
timezone
.
now
()
act
.
started
=
timezone
.
now
()
...
@@ -619,6 +620,7 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
...
@@ -619,6 +620,7 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
queue_name
=
self
.
node
.
host
.
hostname
+
".vm"
queue_name
=
self
.
node
.
host
.
hostname
+
".vm"
vm_tasks
.
resume
.
apply_async
(
args
=
[
self
.
vm_name
],
vm_tasks
.
resume
.
apply_async
(
args
=
[
self
.
vm_name
],
queue
=
queue_name
)
.
get
()
queue
=
queue_name
)
.
get
()
act
.
finish
(
result
=
'SUCCESS'
)
act
.
finish
(
result
=
'SUCCESS'
)
def
wake_up_async
(
self
,
user
=
None
):
def
wake_up_async
(
self
,
user
=
None
):
...
@@ -630,7 +632,7 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
...
@@ -630,7 +632,7 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
def
shutdown
(
self
,
user
=
None
,
task_uuid
=
None
):
def
shutdown
(
self
,
user
=
None
,
task_uuid
=
None
):
"""Shutdown virtual machine with ACPI signal.
"""Shutdown virtual machine with ACPI signal.
"""
"""
act
=
InstanceActivity
(
activity_code
=
'vm.Instance.
power_off
'
)
act
=
InstanceActivity
(
activity_code
=
'vm.Instance.
shutdown
'
)
act
.
instance
=
self
act
.
instance
=
self
act
.
user
=
user
act
.
user
=
user
act
.
started
=
timezone
.
now
()
act
.
started
=
timezone
.
now
()
...
@@ -639,6 +641,7 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
...
@@ -639,6 +641,7 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
queue_name
=
self
.
node
.
host
.
hostname
+
".vm"
queue_name
=
self
.
node
.
host
.
hostname
+
".vm"
vm_tasks
.
shutdown
.
apply_async
(
args
=
[
self
.
vm_name
],
vm_tasks
.
shutdown
.
apply_async
(
args
=
[
self
.
vm_name
],
queue
=
queue_name
)
.
get
()
queue
=
queue_name
)
.
get
()
act
.
finish
(
result
=
'SUCCESS'
)
act
.
finish
(
result
=
'SUCCESS'
)
def
shutdown_async
(
self
,
user
=
None
):
def
shutdown_async
(
self
,
user
=
None
):
...
@@ -650,7 +653,7 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
...
@@ -650,7 +653,7 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
def
reset
(
self
,
user
=
None
,
task_uuid
=
None
):
def
reset
(
self
,
user
=
None
,
task_uuid
=
None
):
"""Reset virtual machine (reset button)
"""Reset virtual machine (reset button)
"""
"""
act
=
InstanceActivity
(
activity_code
=
'vm.Instance.res
tar
t'
)
act
=
InstanceActivity
(
activity_code
=
'vm.Instance.res
e
t'
)
act
.
instance
=
self
act
.
instance
=
self
act
.
user
=
user
act
.
user
=
user
act
.
started
=
timezone
.
now
()
act
.
started
=
timezone
.
now
()
...
@@ -659,6 +662,7 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
...
@@ -659,6 +662,7 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
queue_name
=
self
.
node
.
host
.
hostname
+
".vm"
queue_name
=
self
.
node
.
host
.
hostname
+
".vm"
vm_tasks
.
restart
.
apply_async
(
args
=
[
self
.
vm_name
],
vm_tasks
.
restart
.
apply_async
(
args
=
[
self
.
vm_name
],
queue
=
queue_name
)
.
get
()
queue
=
queue_name
)
.
get
()
act
.
finish
(
result
=
'SUCCESS'
)
act
.
finish
(
result
=
'SUCCESS'
)
def
reset_async
(
self
,
user
=
None
):
def
reset_async
(
self
,
user
=
None
):
...
@@ -679,6 +683,7 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
...
@@ -679,6 +683,7 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
queue_name
=
self
.
node
.
host
.
hostname
+
".vm"
queue_name
=
self
.
node
.
host
.
hostname
+
".vm"
vm_tasks
.
reboot
.
apply_async
(
args
=
[
self
.
vm_name
],
vm_tasks
.
reboot
.
apply_async
(
args
=
[
self
.
vm_name
],
queue
=
queue_name
)
.
get
()
queue
=
queue_name
)
.
get
()
act
.
finish
(
result
=
'SUCCESS'
)
act
.
finish
(
result
=
'SUCCESS'
)
def
reboot_async
(
self
,
user
=
None
):
def
reboot_async
(
self
,
user
=
None
):
...
...
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