Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kwabena Antwi-Boasiako
slapos
Commits
dc752c18
Commit
dc752c18
authored
Aug 20, 2013
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resiliency: allow takeover to retry renaming until it works.
parent
88d2d582
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
slapos/recipe/addresiliency/takeover.py
slapos/recipe/addresiliency/takeover.py
+9
-1
No files found.
slapos/recipe/addresiliency/takeover.py
View file @
dc752c18
...
@@ -3,6 +3,7 @@ import logging
...
@@ -3,6 +3,7 @@ import logging
import
time
import
time
import
slapos
import
slapos
from
slapos.slap.slap
import
NotFoundError
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
logging
.
basicConfig
(
level
=
logging
.
DEBUG
)
logging
.
basicConfig
(
level
=
logging
.
DEBUG
)
...
@@ -58,8 +59,15 @@ def takeover(server_url, key_file, cert_file, computer_guid,
...
@@ -58,8 +59,15 @@ def takeover(server_url, key_file, cert_file, computer_guid,
log
.
debug
(
"Renaming {}: {}"
.
format
(
cp_winner
.
getId
(),
cp_exporter_ref
))
log
.
debug
(
"Renaming {}: {}"
.
format
(
cp_winner
.
getId
(),
cp_exporter_ref
))
# update name (and later, software type) for the partition that will take over
# update name (and later, software type) for the partition that will take over
while
True
:
time
.
sleep
(
10
)
try
:
cp_winner
.
rename
(
new_name
=
cp_exporter_ref
)
cp_winner
.
rename
(
new_name
=
cp_exporter_ref
)
break
except
NotFoundError
:
log
.
warning
(
'Impossible to rename. Retrying in a few seconds...'
)
log
.
debug
(
'Renamed.'
)
cp_winner
.
bang
(
message
=
'partitions have been renamed!'
)
cp_winner
.
bang
(
message
=
'partitions have been renamed!'
)
# Note: Root instance will reconfigure itself the winning instance (software_type
# Note: Root instance will reconfigure itself the winning instance (software_type
# and parameters.)
# and parameters.)
...
...
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