Exemplo n.º 1
0
def get_mapped():
    # If tap-ctl exists return mapped volumes even if blktap module is
    # disabled. There is always the possibility we are facing a mixed
    # situation where the blktap module is disabled but we have remaining
    # archipelago volumes.
    if find_executable(VlmcTapdisk.TAP_CTL):
        return VlmcTapdisk.list()
    else:
        # If the executable does not exist and the blktap module is disabled
        # we can assume that we can safely return an empty list.
        if not config['BLKTAP_ENABLED']:
            return []
        else:
            # Assume that blktap-archipelago-utils package is not
            # installed and that tap-ctl executable is missing.
            # That way we provide a hint where to find tap-ctl file.
            raise Error("%s\n%s" % ("Cannot execute tap-ctl command.",
                                    "Maybe blktap-archipelago-utils package "
                                    "is missing or you don't have sufficient "
                                    "privileges"))