Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
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
550924ea
authored
Nov 18, 2013
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: add non-dummy Node.online code
parent
2703f25a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
circle/vm/models.py
+8
-2
circle/vm/tasks/vm_tasks.py
+4
-0
No files found.
circle/vm/models.py
View file @
550924ea
...
...
@@ -13,6 +13,7 @@ from django.db.models import (Model, ForeignKey, ManyToManyField, IntegerField,
from
django.utils
import
timezone
from
django.utils.translation
import
ugettext_lazy
as
_
from
celery.exceptions
import
TimeoutError
from
model_utils.models
import
TimeStampedModel
from
taggit.managers
import
TaggableManager
...
...
@@ -123,9 +124,14 @@ class Node(TimeStampedModel):
permissions
=
()
@property
@method_cache
(
30
)
@method_cache
(
10
,
5
)
def
online
(
self
):
return
True
r
=
vm_tasks
.
ping
.
apply_async
(
queue
=
self
.
get_remote_queue_name
(
'vm'
),
expires
=
3
)
try
:
return
r
.
get
(
timeout
=
2
)
except
TimeoutError
:
return
False
def
get_remote_queue_name
(
self
,
queue_id
):
return
self
.
host
.
hostname
+
"."
+
queue_id
...
...
circle/vm/tasks/vm_tasks.py
View file @
550924ea
...
...
@@ -59,3 +59,7 @@ def domain_info(params):
@celery.task
(
name
=
'vmdriver.list_domains'
)
def
list_domains
(
params
):
pass
@celery.task
(
name
=
'vmdriver.ping'
)
def
ping
(
params
):
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