Esempio n. 1
0
def target_running(uuid):
    # This is called by the Target RA from corosync
    from os import _exit

    try:
        info = _get_target_config(uuid)
    except (KeyError, TypeError) as err:
        # it can't possibly be running here if the config entry for
        # it doesn't even exist, or if the store doesn't even exist!
        console_log.warning("Exception getting target config: %s", err)
        _exit(1)

    filesystem = FileSystem(info["backfstype"], info["bdev"])

    for devices, mntpnt, _ in get_local_mounts():
        if (mntpnt == info["mntpt"]) and next(
            (True for device in devices
             if filesystem.devices_match(device, info["bdev"], uuid)),
                False,
        ):
            _exit(0)

    console_log.warning(
        "Did not find mount with matching mntpt and device for %s", uuid)
    _exit(1)
Esempio n. 2
0
def target_running(uuid):
    from os import _exit
    try:
        info = _get_target_config(uuid)
    except (KeyError, TypeError) as e:
        # it can't possibly be running here if the config entry for
        # it doesn't even exist, or if the store doesn't even exist!
        console_log.warning("Exception getting target config: '%s'" % e)
        _exit(1)

    filesystem = FileSystem(info['backfstype'], info['bdev'])

    for device, mntpnt, fstype in get_local_mounts():
        if (mntpnt == info['mntpt']) and filesystem.devices_match(
                device, info['bdev'], uuid):
            _exit(0)

    console_log.warning(
        "Did not find mount with matching mntpt and device for %s" % uuid)
    _exit(1)