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
d4f31a5d
Commit
d4f31a5d
authored
Aug 09, 2013
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resiliency: allow takeover script to be configurable.
Add a way to takeover remotely.
parent
f2a688d5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
slapos/recipe/addresiliency/takeover.py
slapos/recipe/addresiliency/takeover.py
+13
-4
No files found.
slapos/recipe/addresiliency/takeover.py
View file @
d4f31a5d
...
@@ -8,7 +8,8 @@ log = logging.getLogger(__name__)
...
@@ -8,7 +8,8 @@ log = logging.getLogger(__name__)
logging
.
basicConfig
(
level
=
logging
.
DEBUG
)
logging
.
basicConfig
(
level
=
logging
.
DEBUG
)
def
takeover
(
server_url
,
key_file
,
cert_file
,
computer_guid
,
def
takeover
(
server_url
,
key_file
,
cert_file
,
computer_guid
,
partition_id
,
software_release
,
namebase
):
partition_id
,
software_release
,
namebase
,
winner_instance_suffix
=
None
):
"""
"""
This function does
This function does
...
@@ -24,11 +25,19 @@ def takeover(server_url, key_file, cert_file, computer_guid,
...
@@ -24,11 +25,19 @@ def takeover(server_url, key_file, cert_file, computer_guid,
slap
=
slapos
.
slap
.
slap
()
slap
=
slapos
.
slap
.
slap
()
slap
.
initializeConnection
(
server_url
,
key_file
,
cert_file
)
slap
.
initializeConnection
(
server_url
,
key_file
,
cert_file
)
current_partition
=
slap
.
registerComputerPartition
(
computer_guid
=
computer_guid
,
partition_id
=
partition_id
)
# partition that will take over.
# partition that will take over.
if
winner_instance_suffix
:
winner_instance_name
=
namebase
+
winner_instance_suffix
# XXX: we hardcode a lot of values here, because request is a settergetter, all at once.
cp_winner
=
current_partition
.
request
(
software_release
=
software_release
,
software_type
=
'importer'
,
partition_reference
=
winner_instance_name
)
else
:
# This script is run in the winning partition: use this one as winner
# This script is run in the winning partition: use this one as winner
cp_winner
=
slap
.
registerComputerPartition
(
computer_guid
=
computer_guid
,
cp_winner
=
current_partition
partition_id
=
partition_id
)
# XXX although we can already rename cp_winner, to change its software type we need to
# XXX although we can already rename cp_winner, to change its software type we need to
# get hold of the root cp as well
# get hold of the root cp as well
...
...
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