Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
e445a532
authored
Sep 24, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: make Instance.allocate_node smarter
parent
bf6f89c8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
18 deletions
+12
-18
circle/vm/models/instance.py
+9
-3
circle/vm/operations.py
+3
-15
No files found.
circle/vm/models/instance.py
View file @
e445a532
...
@@ -910,10 +910,16 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
...
@@ -910,10 +910,16 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
delete_dump
.
apply_async
(
args
=
[
self
.
mem_dump
[
'path'
]],
delete_dump
.
apply_async
(
args
=
[
self
.
mem_dump
[
'path'
]],
queue
=
queue_name
)
.
get
(
timeout
=
timeout
)
queue
=
queue_name
)
.
get
(
timeout
=
timeout
)
def
allocate_node
(
self
):
def
allocate_node
(
self
,
activity
):
if
self
.
node
is
None
:
if
self
.
node
is
not
None
:
self
.
node
=
self
.
select_node
()
return
None
with
activity
.
sub_activity
(
'scheduling'
,
readable_name
=
ugettext_noop
(
"schedule"
))
as
sa
:
sa
.
result
=
self
.
node
=
self
.
select_node
()
self
.
save
()
self
.
save
()
return
self
.
node
def
yield_node
(
self
):
def
yield_node
(
self
):
if
self
.
node
is
not
None
:
if
self
.
node
is
not
None
:
...
...
circle/vm/operations.py
View file @
e445a532
...
@@ -276,7 +276,7 @@ class DeployOperation(InstanceOperation):
...
@@ -276,7 +276,7 @@ class DeployOperation(InstanceOperation):
def
_operation
(
self
,
activity
,
timeout
=
15
):
def
_operation
(
self
,
activity
,
timeout
=
15
):
# Allocate VNC port and host node
# Allocate VNC port and host node
self
.
instance
.
allocate_vnc_port
()
self
.
instance
.
allocate_vnc_port
()
self
.
instance
.
allocate_node
()
self
.
instance
.
allocate_node
(
activity
)
# Deploy virtual images
# Deploy virtual images
with
activity
.
sub_activity
(
with
activity
.
sub_activity
(
...
@@ -385,12 +385,7 @@ class MigrateOperation(InstanceOperation):
...
@@ -385,12 +385,7 @@ class MigrateOperation(InstanceOperation):
def
_operation
(
self
,
activity
,
to_node
=
None
,
timeout
=
120
):
def
_operation
(
self
,
activity
,
to_node
=
None
,
timeout
=
120
):
if
not
to_node
:
if
not
to_node
:
with
activity
.
sub_activity
(
'scheduling'
,
self
.
instance
.
allocate_node
(
activity
)
readable_name
=
ugettext_noop
(
"schedule"
))
as
sa
:
to_node
=
self
.
instance
.
select_node
()
sa
.
result
=
to_node
try
:
try
:
with
activity
.
sub_activity
(
with
activity
.
sub_activity
(
'migrate_vm'
,
readable_name
=
create_readable
(
'migrate_vm'
,
readable_name
=
create_readable
(
...
@@ -744,7 +739,7 @@ class WakeUpOperation(InstanceOperation):
...
@@ -744,7 +739,7 @@ class WakeUpOperation(InstanceOperation):
def
_operation
(
self
,
activity
,
timeout
=
60
):
def
_operation
(
self
,
activity
,
timeout
=
60
):
# Schedule vm
# Schedule vm
self
.
instance
.
allocate_vnc_port
()
self
.
instance
.
allocate_vnc_port
()
self
.
instance
.
allocate_node
()
self
.
instance
.
allocate_node
(
activity
)
# Resume vm
# Resume vm
with
activity
.
sub_activity
(
with
activity
.
sub_activity
(
...
@@ -758,13 +753,6 @@ class WakeUpOperation(InstanceOperation):
...
@@ -758,13 +753,6 @@ class WakeUpOperation(InstanceOperation):
"deploy network"
)):
"deploy network"
)):
self
.
instance
.
deploy_net
()
self
.
instance
.
deploy_net
()
activity
.
result
=
create_readable
(
""
,
ugettext_noop
(
"Scheduled to
%(node)
s"
%
{
'node'
:
self
.
instance
.
node
.
name
}
)
)
try
:
try
:
self
.
instance
.
renew
(
parent_activity
=
activity
)
self
.
instance
.
renew
(
parent_activity
=
activity
)
except
:
except
:
...
...
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