Ejemplo n.º 1
0
def get_kernel_modules():
    modules = []
    try:
        for line in sh.lsmod():
            if 'Module' not in line:
                modules.append(line.split()[0])
        return modules
    except:
        return 'Unable to run lsmod.'
Ejemplo n.º 2
0
def get_kernel_modules():
    modules = []
    try:
        for line in sh.lsmod():
            if 'Module' not in line:
                modules.append(line.split()[0])
        return modules
    except:
        return 'Unable to run lsmod.'
Ejemplo n.º 3
0
    def find_free_nbd_dev(self):
        nbd_dev_avail = None
        modules, sizes, deps = zip(
            *[l.split(maxsplit=2) for l in str(sh.lsmod()).splitlines()])

        if 'nbd' not in modules:
            sh.sudo.modprobe('nbd', 'max_part=8', _fg=True)
            self.__load_nbd = True

        if not (nbd_devs := [
                *filter(lambda d: re.search(r'^nbd\d+$', d),
                        os.listdir('/dev'))
        ]):
            self.unmap()
            raise Exception('Failed to load nbd')
Ejemplo n.º 4
0
 def ui_command_lsmod(self):
     """ lsmod - program to show the status of modules in the Linux Kernel. """
     print sh.lsmod()