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