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
ffbca82d
authored
Mar 18, 2015
by
Bach Dániel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix-operations' into 'master'
Fix operations
✅
See merge request !308
parents
bd850078
dd1cb983
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
5 deletions
+15
-5
circle/common/models.py
+2
-1
circle/vm/operations.py
+13
-4
No files found.
circle/common/models.py
View file @
ffbca82d
...
@@ -69,7 +69,8 @@ def activitycontextimpl(act, on_abort=None, on_commit=None):
...
@@ -69,7 +69,8 @@ def activitycontextimpl(act, on_abort=None, on_commit=None):
# system-exiting exceptions, e.g. KeyboardInterrupt
# system-exiting exceptions, e.g. KeyboardInterrupt
result
=
create_readable
(
result
=
create_readable
(
ugettext_noop
(
"Failure."
),
ugettext_noop
(
"Failure."
),
ugettext_noop
(
"Unhandled exception:
%(error)
s"
),
ugettext_noop
(
"Unhandled exception:
%(e)
s:
%(error)
s"
),
e
=
str
(
e
.
__class__
.
__name__
),
error
=
get_error_msg
(
e
))
error
=
get_error_msg
(
e
))
raise
raise
except
:
except
:
...
...
circle/vm/operations.py
View file @
ffbca82d
...
@@ -377,7 +377,12 @@ class DeployOperation(InstanceOperation):
...
@@ -377,7 +377,12 @@ class DeployOperation(InstanceOperation):
self
.
instance
.
allocate_node
()
self
.
instance
.
allocate_node
()
# Deploy virtual images
# Deploy virtual images
try
:
self
.
instance
.
_deploy_disks
(
parent_activity
=
activity
)
self
.
instance
.
_deploy_disks
(
parent_activity
=
activity
)
except
:
self
.
instance
.
yield_node
()
self
.
instance
.
yield_vnc_port
()
raise
# Deploy VM on remote machine
# Deploy VM on remote machine
if
self
.
instance
.
state
not
in
[
'PAUSED'
]:
if
self
.
instance
.
state
not
in
[
'PAUSED'
]:
...
@@ -452,6 +457,9 @@ class DestroyOperation(InstanceOperation):
...
@@ -452,6 +457,9 @@ class DestroyOperation(InstanceOperation):
required_perms
=
()
required_perms
=
()
resultant_state
=
'DESTROYED'
resultant_state
=
'DESTROYED'
def
on_abort
(
self
,
activity
,
error
):
activity
.
resultant_state
=
None
def
_operation
(
self
,
activity
,
system
):
def
_operation
(
self
,
activity
,
system
):
# Destroy networks
# Destroy networks
with
activity
.
sub_activity
(
with
activity
.
sub_activity
(
...
@@ -1093,16 +1101,17 @@ class ResetNodeOperation(NodeOperation):
...
@@ -1093,16 +1101,17 @@ class ResetNodeOperation(NodeOperation):
"You cannot reset a disabled or online node."
),
Exception
())
"You cannot reset a disabled or online node."
),
Exception
())
def
_operation
(
self
,
activity
,
user
):
def
_operation
(
self
,
activity
,
user
):
if
self
.
node
.
enabled
:
DisableOperation
(
self
.
node
)
.
call
(
parent_activity
=
activity
,
user
=
user
)
for
i
in
self
.
node
.
instance_set
.
all
():
for
i
in
self
.
node
.
instance_set
.
all
():
name
=
create_readable
(
ugettext_noop
(
name
=
create_readable
(
ugettext_noop
(
"
migrate
%(instance)
s (
%(pk)
s)"
),
instance
=
i
.
name
,
pk
=
i
.
pk
)
"
redeploy
%(instance)
s (
%(pk)
s)"
),
instance
=
i
.
name
,
pk
=
i
.
pk
)
with
activity
.
sub_activity
(
'migrate_instance_
%
d'
%
i
.
pk
,
with
activity
.
sub_activity
(
'migrate_instance_
%
d'
%
i
.
pk
,
readable_name
=
name
):
readable_name
=
name
):
i
.
redeploy
(
user
=
user
)
i
.
redeploy
(
user
=
user
)
self
.
node
.
enabled
=
False
self
.
node
.
schedule_enabled
=
False
self
.
node
.
save
()
@register_operation
@register_operation
class
FlushOperation
(
NodeOperation
):
class
FlushOperation
(
NodeOperation
):
...
...
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