Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
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
32c390c1
authored
Jul 05, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: reenable node if flush fails
parent
cce7935c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
circle/vm/models/node.py
+6
-2
circle/vm/operations.py
+7
-0
No files found.
circle/vm/models/node.py
View file @
32c390c1
...
@@ -148,10 +148,14 @@ class Node(OperatedMixin, TimeStampedModel):
...
@@ -148,10 +148,14 @@ class Node(OperatedMixin, TimeStampedModel):
self
.
enabled
=
False
self
.
enabled
=
False
self
.
save
()
self
.
save
()
def
enable
(
self
,
user
=
None
):
def
enable
(
self
,
user
=
None
,
base_activity
=
None
):
''' Enable the node. '''
''' Enable the node. '''
if
self
.
enabled
is
not
True
:
if
self
.
enabled
is
not
True
:
with
node_activity
(
code_suffix
=
'enable'
,
node
=
self
,
user
=
user
):
if
base_activity
:
act_ctx
=
base_activity
.
sub_activity
(
'enable'
)
else
:
act_ctx
=
node_activity
(
'enable'
,
node
=
self
,
user
=
user
)
with
act_ctx
:
self
.
enabled
=
True
self
.
enabled
=
True
self
.
save
()
self
.
save
()
self
.
get_info
(
invalidate_cache
=
True
)
self
.
get_info
(
invalidate_cache
=
True
)
...
...
circle/vm/operations.py
View file @
32c390c1
...
@@ -594,7 +594,14 @@ class FlushOperation(NodeOperation):
...
@@ -594,7 +594,14 @@ class FlushOperation(NodeOperation):
name
=
_
(
"flush"
)
name
=
_
(
"flush"
)
description
=
_
(
"Disable node and move all instances to other ones."
)
description
=
_
(
"Disable node and move all instances to other ones."
)
def
on_abort
(
self
,
activity
,
error
):
from
manager.scheduler
import
TraitsUnsatisfiableException
if
isinstance
(
error
,
TraitsUnsatisfiableException
):
if
self
.
node_enabled
:
self
.
node
.
enable
(
activity
.
user
,
activity
)
def
_operation
(
self
,
activity
,
user
):
def
_operation
(
self
,
activity
,
user
):
self
.
node_enabled
=
self
.
node
.
enabled
self
.
node
.
disable
(
user
,
activity
)
self
.
node
.
disable
(
user
,
activity
)
for
i
in
self
.
node
.
instance_set
.
all
():
for
i
in
self
.
node
.
instance_set
.
all
():
with
activity
.
sub_activity
(
'migrate_instance_
%
d'
%
i
.
pk
):
with
activity
.
sub_activity
(
'migrate_instance_
%
d'
%
i
.
pk
):
...
...
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