HEX
Server: Apache
System: Linux wp02.tdr-lab.com 3.10.0-1160.42.2.el7.x86_64 #1 SMP Tue Sep 7 14:49:57 UTC 2021 x86_64
User: kusanagi (1001)
PHP: 7.4.23
Disabled: NONE
Upload Files
File: //lib/python2.7/site-packages/blivet/devicelibs/mpath.py
from .. import util

import logging
log = logging.getLogger("blivet")

def flush_mpaths():
    util.run_program(["multipath", "-F"])
    check_output = util.capture_output(["multipath", "-ll"]).strip()
    if check_output:
        log.error("multipath: some devices could not be flushed")

def is_multipath_member(path):
    return (util.run_program(["multipath", "-c", path]) == 0)

def set_friendly_names(enabled=True):
    """ Set the state of friendly names in multipathd.

        NOTE: If you call this you also need to take appropriate steps to make
              sure the devicetree contains devices with the appropriate names.
              They will not be updated automatically.
    """
    if enabled:
        val = "y"
    else:
        val = "n"

    # --find_multipaths is important to keep multipath from making up multipath devices
    # that aren't really multipath
    cmd = ["mpathconf", "--find_multipaths", "y", "--user_friendly_names", val, "--with_multipathd", "y"]
    return (util.run_program(cmd) == 0)