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
85f074a6
authored
Nov 25, 2013
by
Dudás Ádám
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: beautification
parent
0a40f809
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
circle/vm/models.py
+10
-7
No files found.
circle/vm/models.py
View file @
85f074a6
...
@@ -40,6 +40,7 @@ post_state_changed = Signal(providing_args=["new_state"])
...
@@ -40,6 +40,7 @@ post_state_changed = Signal(providing_args=["new_state"])
class
InstanceActiveManager
(
Manager
):
class
InstanceActiveManager
(
Manager
):
def
get_query_set
(
self
):
def
get_query_set
(
self
):
return
super
(
InstanceActiveManager
,
return
super
(
InstanceActiveManager
,
self
)
.
get_query_set
()
.
filter
(
destroyed
=
None
)
self
)
.
get_query_set
()
.
filter
(
destroyed
=
None
)
...
@@ -133,6 +134,9 @@ class Node(TimeStampedModel):
...
@@ -133,6 +134,9 @@ class Node(TimeStampedModel):
class
Meta
:
class
Meta
:
permissions
=
()
permissions
=
()
def
__unicode__
(
self
):
return
self
.
name
@property
@property
@method_cache
(
10
,
5
)
@method_cache
(
10
,
5
)
def
online
(
self
):
def
online
(
self
):
...
@@ -143,15 +147,15 @@ class Node(TimeStampedModel):
...
@@ -143,15 +147,15 @@ class Node(TimeStampedModel):
@property
@property
@method_cache
(
300
)
@method_cache
(
300
)
def
num_cores
(
self
):
def
num_cores
(
self
):
"""Number of CPU threads available to the virtual machines.
"""
"""Number of CPU threads available to the virtual machines.
"""
return
self
.
remote_query
(
vm_tasks
.
get_core_num
)
return
self
.
remote_query
(
vm_tasks
.
get_core_num
)
@property
@property
@method_cache
(
300
)
@method_cache
(
300
)
def
ram_size
(
self
):
def
ram_size
(
self
):
"""Bytes of total memory in the node.
"""
"""Bytes of total memory in the node.
"""
return
self
.
remote_query
(
vm_tasks
.
get_ram_size
)
return
self
.
remote_query
(
vm_tasks
.
get_ram_size
)
@property
@property
...
@@ -208,9 +212,6 @@ class Node(TimeStampedModel):
...
@@ -208,9 +212,6 @@ class Node(TimeStampedModel):
logger
.
info
(
'Node
%
s update: domain
%
s in libvirt but not in db.'
,
logger
.
info
(
'Node
%
s update: domain
%
s in libvirt but not in db.'
,
self
,
i
)
self
,
i
)
def
__unicode__
(
self
):
return
self
.
name
class
NodeActivity
(
ActivityModel
):
class
NodeActivity
(
ActivityModel
):
node
=
ForeignKey
(
Node
,
related_name
=
'activity_log'
,
node
=
ForeignKey
(
Node
,
related_name
=
'activity_log'
,
...
@@ -679,6 +680,7 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
...
@@ -679,6 +680,7 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
# Schedule
# Schedule
if
self
.
node
is
None
:
if
self
.
node
is
None
:
self
.
node
=
scheduler
.
get_node
(
self
,
Node
.
objects
.
all
())
self
.
node
=
scheduler
.
get_node
(
self
,
Node
.
objects
.
all
())
self
.
save
()
self
.
save
()
# Deploy virtual images
# Deploy virtual images
...
@@ -687,6 +689,7 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
...
@@ -687,6 +689,7 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
disk
.
deploy
()
disk
.
deploy
()
queue_name
=
self
.
get_remote_queue_name
(
'vm'
)
queue_name
=
self
.
get_remote_queue_name
(
'vm'
)
# Deploy VM on remote machine
# Deploy VM on remote machine
with
act
.
sub_activity
(
'deploying_vm'
):
with
act
.
sub_activity
(
'deploying_vm'
):
vm_tasks
.
deploy
.
apply_async
(
args
=
[
self
.
get_vm_desc
()],
vm_tasks
.
deploy
.
apply_async
(
args
=
[
self
.
get_vm_desc
()],
...
...
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