Skip to content

Commit

Permalink
Drop the stonith drivers and "svcmgr stonith" action
Browse files Browse the repository at this point in the history
This stonith methods were limited to 2-nodes clusters. Stonith will be
reimplemented as a node action, and executed by the daemon monitor.

The service still needs to be able to declare it mandates a stonith. To
this end, a new DEFAULT.stonith boolean keyword is added. It defaults to
false.
  • Loading branch information
cvaroqui committed Oct 4, 2017
1 parent d157a38 commit 55f7f8f
Show file tree
Hide file tree
Showing 108 changed files with 239 additions and 479 deletions.
67 changes: 0 additions & 67 deletions lib/resStonith.py

This file was deleted.

14 changes: 0 additions & 14 deletions lib/resStonithCallout.py

This file was deleted.

13 changes: 0 additions & 13 deletions lib/resStonithIlo.py

This file was deleted.

15 changes: 1 addition & 14 deletions lib/svc.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def signal_handler(*args):
"container",
"app",
"sync",
"stonith",
"task",
]

Expand Down Expand Up @@ -260,8 +259,6 @@ def signal_handler(*args):
"sync.symsrdfs",
"sync.s3",
"sync.zfs",
"stonith.callout",
"stonith.ilo",
"task",
]

Expand Down Expand Up @@ -396,6 +393,7 @@ def __init__(self, svcname=None, node=None, cf=None):
self.orchestrate = "ha"
self.clustertype = "failover"
self.placement = "nodes order"
self.stonith = False
self.parents = []
self.children = []
self.show_disabled = False
Expand Down Expand Up @@ -1963,14 +1961,6 @@ def pg_kill(self):
for resource in self.get_resources(["app", "container"]):
resource.status(refresh=True)

def stonith(self):
"""
The 'stonith' action entrypoint.
Call the stonith method of resources implementing it.
"""
self.sub_set_action('stonith.ilo', 'start')
self.sub_set_action('stonith.callout', 'start')

def do_pre_monitor_action(self):
if self.pre_monitor_action is None:
return
Expand Down Expand Up @@ -2238,7 +2228,6 @@ def encap_json_status(self, container, refresh=False):
"disk",
"fs",
"share",
"stonith",
"task",
"app",
"sync"
Expand Down Expand Up @@ -4735,8 +4724,6 @@ def delete_service_conf(self):
self.paths.cf,
os.path.join(rcEnv.paths.pathetc, self.svcname),
os.path.join(rcEnv.paths.pathetc, self.svcname+".d"),
os.path.join(rcEnv.paths.pathetc, self.svcname+".cluster"),
os.path.join(rcEnv.paths.pathetc, self.svcname+".stonith"),
]
for fpath in fpaths:
if os.path.exists(fpath) and \
Expand Down
32 changes: 5 additions & 27 deletions lib/svcBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,32 +344,6 @@ def add_vdisk(svc, s):
r = m.Disk(**kwargs)
svc += r

def add_stonith(svc, s):
if rcEnv.nodename in svc.drpnodes:
# no stonith on DRP nodes
return

kwargs = init_kwargs(svc, s)

_type = svc.conf_get(s, 'type')
if len(_type) > 1:
_type = _type[0].upper()+_type[1:].lower()

if _type == 'Ilo':
kwargs['name'] = svc.conf_get(s, 'target')
elif _type == 'Callout':
kwargs['cmd'] = svc.conf_get(s, 'cmd')

st = __import__('resStonith'+_type)
try:
st = __import__('resStonith'+_type)
except ImportError:
svc.log.error("resStonith%s is not implemented"%_type)
return

r = st.Stonith(**kwargs)
svc += r

def add_loop(svc, s):
"""Parse the configuration file and add a loop object for each [loop#n]
section. Loop objects are stored in a list in the service object.
Expand Down Expand Up @@ -2011,6 +1985,11 @@ def build(name, minimal=False, svcconf=None, node=None):
except ex.OptNotFound as exc:
svc.orchestrate = exc.default

try:
svc.stonith = svc.conf_get("DEFAULT", "stonith")
except ex.OptNotFound as exc:
svc.stonith = exc.default


#
# Store and validate the service type
Expand Down Expand Up @@ -2112,7 +2091,6 @@ def build(name, minimal=False, svcconf=None, node=None):
# instanciate resources
#
add_resources(svc, 'container')
add_resources(svc, 'stonith')
add_resources(svc, 'ip')
add_resources(svc, 'disk')
add_resources(svc, 'fs')
Expand Down
64 changes: 17 additions & 47 deletions lib/svcdict.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"disk.vg.vgname": "name",
"sync.rsync.exclude": "options",
"disk.zpool.poolname": "name",
"stonith.ilo.name": "target",
}

# supported => deprecated
Expand All @@ -27,7 +26,6 @@
"disk.vg.name": "vgname",
"sync.rsync.options": "exclude",
"disk.zpool.name": "poolname",
"stonith.ilo.target": "name",
}

deprecated_sections = {
Expand Down Expand Up @@ -802,46 +800,6 @@ def __init__(self):
order=2
)

class KeywordStonithType(Keyword):
def __init__(self):
Keyword.__init__(
self,
section="stonith",
keyword="type",
at=True,
candidates=["ilo", "callout"],
text="The type of stonith.",
required=True,
order=1
)

class KeywordStonithTarget(Keyword):
def __init__(self):
Keyword.__init__(
self,
section="stonith",
rtype="ilo",
keyword="target",
at=True,
text="The server management console to pass the stonith command to, as defined in the corresponding auth.conf section title.",
required=True,
order=2
)

class KeywordStonithCalloutCmd(Keyword):
def __init__(self):
Keyword.__init__(
self,
section="stonith",
rtype="callout",
at=True,
keyword="cmd",
default="/bin/false",
text="The command to execute on target to stonith.",
required=True,
order=3
)

class KeywordContainerType(Keyword):
def __init__(self):
Keyword.__init__(
Expand Down Expand Up @@ -1361,6 +1319,20 @@ def __init__(self):
text="If set to 'no', disable service orchestration by the OpenSVC daemon monitor, including service start on boot. If set to 'start' failover services won't failover automatically, though the service instance on the natural placement leader is started if another instance is not already up. Flex services won't start missing instances to meet the flex_min_nodes target, though the <flex_min_nodes>th instances on best placement leaders are started if the instances minimum quota is not already reached. Resource restart is still active whatever the orchestrate value.",
)

class KeywordStonith(Keyword):
def __init__(self):
Keyword.__init__(
self,
section="DEFAULT",
keyword="stonith",
convert="boolean",
order=16,
default=False,
candidates=(True, False),
depends=[("cluster_type", ["failover"])],
text="Stonith the node previously running the service if stale upon start by the daemon monitor.",
)

class KeywordPlacement(Keyword):
def __init__(self):
Keyword.__init__(
Expand Down Expand Up @@ -4286,7 +4258,7 @@ def kw_optional(resource):
generic=True,
at=True,
candidates=(True, False),
default_text="True for task, sync and stonith, else False",
default_text="True for task and sync, else False",
convert="boolean",
text="Possible values are 'true' or 'false'. Actions on resource will be tried upon service startup and shutdown, but action failures will be logged and passed over. Useful for resources like dump filesystems for example."
)
Expand Down Expand Up @@ -4637,7 +4609,7 @@ def kw_requires(section, action):

self += kw_disable("DEFAULT")

for r in ["DEFAULT", "sync", "ip", "fs", "disk", "share", "container", "app", "task", "stonith"]:
for r in ["DEFAULT", "sync", "ip", "fs", "disk", "share", "container", "app", "task"]:
self += kw_restart(r)
self += kw_tags(r)
self += kw_subset(r)
Expand Down Expand Up @@ -4951,9 +4923,7 @@ def kw_requires(section, action):
self += KeywordSyncDdsSnapSize()
self += KeywordVdiskPath()
self += KeywordSubsetParallel()
self += KeywordStonithType()
self += KeywordStonithTarget()
self += KeywordStonithCalloutCmd()
self += KeywordStonith()
self += KeywordContainerType()
self += KeywordContainerZoneDeleteOnStop()
self += KeywordContainerScsireserv()
Expand Down
5 changes: 0 additions & 5 deletions lib/svcmgr_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,11 +751,6 @@
'scheduleable, usually every minute.',
'options': ACTION_OPTS,
},
'stonith': {
'msg': 'command provided to the heartbeat daemon to fence peer '
'node in case of split brain',
'options': ACTION_OPTS,
},
'docker': {
'msg': 'wrap the docker client command, setting automatically '
'the socket parameter to join the service-private docker '
Expand Down
3 changes: 1 addition & 2 deletions usr/share/bash_completion.d/opensvc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


svcmgr="boot clear collector compliance create delete disable dns docker edit enable freeze frozen get giveback logs ls migrate pg postsync presync print provision prstart prstatus prstop pull push resource restart resync run scheduler set shutdown start startapp startcontainer startdisk startfs startip startshare startstandby status stonith stop stopapp stopcontainer stopdisk stopfs stopip stopshare switch sync takeover thaw toc unprovision unset update validate"
svcmgr="boot clear collector compliance create delete disable dns docker edit enable freeze frozen get giveback logs ls migrate pg postsync presync print provision prstart prstatus prstop pull push resource restart resync run scheduler set shutdown start startapp startcontainer startdisk startfs startip startshare startstandby status stop stopapp stopcontainer stopdisk stopfs stopip stopshare switch sync takeover thaw toc unprovision unset update validate"
svcmgr_collector="ack alerts asset checks create disks events list log networks show tag untag"
svcmgr_collector_ack="action unavailability"
svcmgr_collector_create="tag"
Expand Down Expand Up @@ -89,7 +89,6 @@ svcmgr_startfs="--color --cron --daemon --debug --disable-rollback --dry-run --e
svcmgr_sync_revert="--color --cron --daemon --debug --dry-run --env --local --master --node --rid --slave --slaves --status --subsets --tags --waitlock -c --cluster -f --force -h --help -p --parallel -s --service"
svcmgr_push_service_status="--color --cron --daemon --debug --env --status --waitlock -c --cluster -h --help -p --parallel -s --service"
svcmgr_logs="--backlog --color --cron --daemon --debug --env --follow --no-pager --node --status --waitlock -c --cluster -h --help -p --parallel -s --service"
svcmgr_stonith="--color --cron --daemon --debug --dry-run --env --local --master --node --rid --slave --slaves --status --subsets --tags --waitlock -c --cluster -f --force -h --help -p --parallel -s --service"
svcmgr_push_resinfo="--color --cron --daemon --debug --env --status --waitlock -c --cluster -h --help -p --parallel -s --service"
svcmgr_stopip="--color --cron --daemon --debug --dry-run --env --local --master --node --rid --slave --slaves --status --subsets --tags --waitlock -c --cluster -f --force -h --help -p --parallel -s --service"
svcmgr_sync_drp="--color --cron --daemon --debug --dry-run --env --local --master --node --rid --slave --slaves --status --subsets --tags --waitlock -c --cluster -f --force -h --help -p --parallel -s --service"
Expand Down
22 changes: 20 additions & 2 deletions usr/share/doc/template.DEFAULT.conf
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,24 @@
#
;flex_cpu_high_threshold = 70

#
# keyword: stonith
# ----------------------------------------------------------------------------
# scopable: False
# required: False
# provisioning: False
# default: False
# inheritance: leaf > head
# scope order: specific > generic
# candidates: True | False
# depends: cluster_type in ['failover']
# convert: boolean
#
# desc: Stonith the node previously running the service if stale upon start
# by the daemon monitor.
#
;stonith = False

#
# keyword: docker_swarm_managers
# ----------------------------------------------------------------------------
Expand Down Expand Up @@ -1187,7 +1205,7 @@
# scopable: True
# required: False
# provisioning: False
# default: True for task, sync and stonith, else False
# default: True for task and sync, else False
# inheritance: leaf > head
# scope order: specific > generic
# candidates: True | False
Expand All @@ -1198,7 +1216,7 @@
# logged and passed over. Useful for resources like dump filesystems
# for example.
#
;optional = True for task, sync and stonith, else False
;optional = True for task and sync, else False

#
# keyword: always_on
Expand Down
Loading

0 comments on commit 55f7f8f

Please sign in to comment.