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
25e424c8
authored
Nov 18, 2013
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: convert Node.num_cores,ram_size to properties
parent
88ba8e10
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
5 deletions
+25
-5
circle/vm/migrations/0011_auto__del_field_node_num_cores__del_field_node_ram_size.py
+0
-0
circle/vm/models.py
+14
-5
circle/vm/tasks/vm_tasks.py
+11
-0
No files found.
circle/vm/migrations/0011_auto__del_field_node_num_cores__del_field_node_ram_size.py
0 → 100644
View file @
25e424c8
This diff is collapsed.
Click to expand it.
circle/vm/models.py
View file @
25e424c8
...
@@ -103,11 +103,6 @@ class Node(TimeStampedModel):
...
@@ -103,11 +103,6 @@ class Node(TimeStampedModel):
name
=
CharField
(
max_length
=
50
,
unique
=
True
,
name
=
CharField
(
max_length
=
50
,
unique
=
True
,
verbose_name
=
_
(
'name'
),
verbose_name
=
_
(
'name'
),
help_text
=
_
(
'Human readable name of node.'
))
help_text
=
_
(
'Human readable name of node.'
))
num_cores
=
IntegerField
(
verbose_name
=
_
(
'number of cores'
),
help_text
=
_
(
'Number of CPU threads '
'available to the virtual machines.'
))
ram_size
=
IntegerField
(
verbose_name
=
_
(
'RAM size'
),
help_text
=
_
(
'Mebibytes of memory.'
))
priority
=
IntegerField
(
verbose_name
=
_
(
'priority'
),
priority
=
IntegerField
(
verbose_name
=
_
(
'priority'
),
help_text
=
_
(
'Node usage priority.'
))
help_text
=
_
(
'Node usage priority.'
))
host
=
ForeignKey
(
Host
,
verbose_name
=
_
(
'host'
),
host
=
ForeignKey
(
Host
,
verbose_name
=
_
(
'host'
),
...
@@ -130,6 +125,20 @@ class Node(TimeStampedModel):
...
@@ -130,6 +125,20 @@ class Node(TimeStampedModel):
return
self
.
remote_query
(
vm_tasks
.
get_num_cores
,
timeout
=
1
,
return
self
.
remote_query
(
vm_tasks
.
get_num_cores
,
timeout
=
1
,
default
=
False
)
default
=
False
)
@property
@method_cache
(
300
)
def
num_cores
(
self
):
"""Number of CPU threads available to the virtual machines."""
return
self
.
remote_query
(
vm_tasks
.
get_num_cores
)
@property
@method_cache
(
300
)
def
ram_size
(
self
):
"""Bytes of total memory in the node."""
return
self
.
remote_query
(
vm_tasks
.
get_ram_size
)
def
get_remote_queue_name
(
self
,
queue_id
):
def
get_remote_queue_name
(
self
,
queue_id
):
return
self
.
host
.
hostname
+
"."
+
queue_id
return
self
.
host
.
hostname
+
"."
+
queue_id
...
...
circle/vm/tasks/vm_tasks.py
View file @
25e424c8
...
@@ -60,6 +60,17 @@ def domain_info(params):
...
@@ -60,6 +60,17 @@ def domain_info(params):
def
list_domains
(
params
):
def
list_domains
(
params
):
pass
pass
@celery.task
(
name
=
'vmdriver.ping'
)
@celery.task
(
name
=
'vmdriver.ping'
)
def
ping
(
params
):
def
ping
(
params
):
pass
pass
@celery.task
(
name
=
'vmdriver.get_core_num'
)
def
get_core_num
(
params
):
pass
@celery.task
(
name
=
'vmdriver.get_ram_size'
)
def
get_ram_size
(
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