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
bf61b653
authored
May 13, 2013
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
one: GetInstanceStateTask added
parent
d4c83320
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
2 deletions
+12
-2
cloud/settings/base.py
+1
-0
miscellaneous/celery/opennebula_celery.py
+4
-0
one/jobs/hourly/update.py
+3
-2
one/tasks.py
+4
-0
No files found.
cloud/settings/base.py
View file @
bf61b653
...
...
@@ -229,6 +229,7 @@ CELERY_ROUTES = {
'one.tasks.SaveAsTask'
:
{
'queue'
:
'opennebula'
},
'one.tasks.CreateInstanceTask'
:
{
'queue'
:
'opennebula'
},
'one.tasks.DeleteInstanceTask'
:
{
'queue'
:
'opennebula'
},
'one.tasks.GetInstanceStateTask'
:
{
'queue'
:
'opennebula'
},
}
...
...
miscellaneous/celery/opennebula_celery.py
View file @
bf61b653
...
...
@@ -164,6 +164,10 @@ def t(one_id):
except
:
pass
@task
(
name
=
"one.tasks.GetInstanceStateTask"
)
def
t
(
one_id
):
update_state
(
one_id
)
def
update_state
(
one_id
):
"""Get and update VM state from OpenNebula."""
proc
=
subprocess
.
Popen
([
"/opt/occi.sh"
,
"compute"
,
"show"
,
...
...
one/jobs/hourly/update.py
View file @
bf61b653
from
one.models
import
*
from
one.tasks
import
GetInstanceStateTask
from
django_extensions.management.jobs
import
HourlyJob
class
Job
(
HourlyJob
):
...
...
@@ -7,6 +8,6 @@ class Job(HourlyJob):
def
execute
(
self
):
Disk
.
update
()
Network
.
update
()
# for i in Instance.objects.filter(state__in=['ACTIVE', 'STOPPED'], time_of_delete__isnull=Fals
e):
# i.update_state(
)
for
i
in
Instance
.
objects
.
filter
(
state__in
=
[
'ACTIVE'
,
'STOPPED'
],
time_of_delete__isnull
=
False
,
waiting
=
Tru
e
):
GetInstanceStateTask
.
delay
(
i
.
one_id
)
pass
one/tasks.py
View file @
bf61b653
...
...
@@ -66,3 +66,7 @@ class UpdateDiskTask(Task):
class
UpdateNetworkTask
(
Task
):
def
run
(
self
):
pass
class
GetInstanceStateTask
(
Task
):
def
run
(
self
,
one_id
):
pass
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