Conditionally reconfig multipath
In MOS 9.1 /etc/multipath.conf doesn't exist by default. So the reconfiguration should depend on the existence of /etc/multipath.conf. Change-Id: I2784642fc49f6ea01f131f63be011ba1fc81acf6
This commit is contained in:
parent
7533f8c80a
commit
bccc176701
|
@ -321,8 +321,14 @@ def reconfig_multipath():
|
|||
|
||||
Change devnode rule from "^hd[a-z]" to "^(hd|xvd)[a-z]"
|
||||
"""
|
||||
utils.execute('sed', '-i', r's/"\^hd\[a-z\]"/"^(hd|xvd)[a-z]"/',
|
||||
'/etc/multipath.conf')
|
||||
multipath_conf = '/etc/multipath.conf'
|
||||
if os.path.exists(multipath_conf):
|
||||
utils.execute('sed', '-i', r's/"\^hd\[a-z\]"/"^(hd|xvd)[a-z]"/',
|
||||
multipath_conf)
|
||||
else:
|
||||
with open(multipath_conf, "w") as f:
|
||||
f.write('# Generated by %s:\n' % utils.PLUGIN_NAME)
|
||||
f.write('blacklist {\ndevnode "^(hd|xvd)[a-z]"\n}')
|
||||
utils.execute('service', 'multipath-tools', 'restart')
|
||||
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import yaml
|
|||
XS_RSA = '/root/.ssh/xs_rsa'
|
||||
ASTUTE_PATH = '/etc/astute.yaml'
|
||||
ASTUTE_SECTION = '@PLUGIN_NAME@'
|
||||
PLUGIN_NAME = '@PLUGIN_NAME@'
|
||||
LOG_ROOT = '/var/log/@PLUGIN_NAME@'
|
||||
HIMN_IP = '169.254.0.1'
|
||||
|
||||
|
|
Loading…
Reference in New Issue