Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
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
5ce861b8
authored
Aug 27, 2014
by
Guba Sándor
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'issue-264' into 'master'
Issue 264 fixes #264
parents
0c8fc223
9460f70f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
+17
-2
circle/vm/models/instance.py
+9
-0
circle/vm/operations.py
+8
-2
No files found.
circle/vm/models/instance.py
View file @
5ce861b8
...
@@ -32,6 +32,7 @@ from django.core.exceptions import PermissionDenied
...
@@ -32,6 +32,7 @@ from django.core.exceptions import PermissionDenied
from
django.db.models
import
(
BooleanField
,
CharField
,
DateTimeField
,
from
django.db.models
import
(
BooleanField
,
CharField
,
DateTimeField
,
IntegerField
,
ForeignKey
,
Manager
,
IntegerField
,
ForeignKey
,
Manager
,
ManyToManyField
,
permalink
,
SET_NULL
,
TextField
)
ManyToManyField
,
permalink
,
SET_NULL
,
TextField
)
from
django.db
import
IntegrityError
from
django.dispatch
import
Signal
from
django.dispatch
import
Signal
from
django.utils
import
timezone
from
django.utils
import
timezone
from
django.utils.translation
import
ugettext_lazy
as
_
,
ugettext_noop
from
django.utils.translation
import
ugettext_lazy
as
_
,
ugettext_noop
...
@@ -926,8 +927,16 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
...
@@ -926,8 +927,16 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
def
allocate_vnc_port
(
self
):
def
allocate_vnc_port
(
self
):
if
self
.
vnc_port
is
None
:
if
self
.
vnc_port
is
None
:
while
True
:
try
:
self
.
vnc_port
=
find_unused_vnc_port
()
self
.
vnc_port
=
find_unused_vnc_port
()
self
.
save
()
self
.
save
()
except
IntegrityError
:
# Another thread took this port get another one
logger
.
debug
(
"Port
%
s is in use."
,
self
.
vnc_port
)
pass
else
:
break
def
yield_vnc_port
(
self
):
def
yield_vnc_port
(
self
):
if
self
.
vnc_port
is
not
None
:
if
self
.
vnc_port
is
not
None
:
...
...
circle/vm/operations.py
View file @
5ce861b8
...
@@ -261,6 +261,10 @@ class DeployOperation(InstanceOperation):
...
@@ -261,6 +261,10 @@ class DeployOperation(InstanceOperation):
def
on_commit
(
self
,
activity
):
def
on_commit
(
self
,
activity
):
activity
.
resultant_state
=
'RUNNING'
activity
.
resultant_state
=
'RUNNING'
activity
.
result
=
create_readable
(
ugettext_noop
(
"virtual machine successfully "
"deployed to node:
%(node)
s"
),
node
=
self
.
instance
.
node
)
def
_operation
(
self
,
activity
,
timeout
=
15
):
def
_operation
(
self
,
activity
,
timeout
=
15
):
# Allocate VNC port and host node
# Allocate VNC port and host node
...
@@ -275,9 +279,11 @@ class DeployOperation(InstanceOperation):
...
@@ -275,9 +279,11 @@ class DeployOperation(InstanceOperation):
# Deploy VM on remote machine
# Deploy VM on remote machine
if
self
.
instance
.
state
not
in
[
'PAUSED'
]:
if
self
.
instance
.
state
not
in
[
'PAUSED'
]:
rn
=
create_readable
(
ugettext_noop
(
"deploy virtual machine"
),
ugettext_noop
(
"deploy vm to
%(node)
s"
),
node
=
self
.
instance
.
node
)
with
activity
.
sub_activity
(
with
activity
.
sub_activity
(
'deploying_vm'
,
readable_name
=
ugettext_noop
(
'deploying_vm'
,
readable_name
=
rn
)
as
deploy_act
:
"deploy virtual machine"
))
as
deploy_act
:
deploy_act
.
result
=
self
.
instance
.
deploy_vm
(
timeout
=
timeout
)
deploy_act
.
result
=
self
.
instance
.
deploy_vm
(
timeout
=
timeout
)
# Establish network connection (vmdriver)
# Establish network connection (vmdriver)
...
...
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