INNER CODE UNIT · Python

drbd_kernel_version

LINBIT/linstor-server · scripts/linstor-controller-ha-setup.py:327

def drbd_kernel_version():
    """(major, minor) of the loaded DRBD kernel module, or None when no module
    is loaded. /proc/drbd only exists once the module is in."""
    try:
        with open("/proc/drbd") as fh:
            # "version: 9.3.2 (api:2/proto:118-124)"
            parts = fh.readline().split()
        major, minor = parts[1].split(".")[:2]
        return int(major), int(minor)
    except (OSError, IndexError, ValueError):
        return None


def check_drbd_module():
    """LINSTOR needs DRBD 9. Distributions ship an in-tree DRBD 8.4 module that
    can be loaded ahead of the 9.x one from drbd-dkms, in which case everything
    only breaks later with a confusing error."""
    version = drbd_kernel_version()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…