def test_unsing_mount(self): mount_points = ['/dev/mapper/fabuntu--vg-root on / type ext4 (rw,errors=remount-ro)', 'proc on /proc type proc (rw,noexec,nosuid,nodev)', 'sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)', 'none on /sys/fs/cgroup type tmpfs (rw)', 'none on /sys/fs/fuse/connections type fusectl (rw)', 'none on /sys/kernel/debug type debugfs (rw)', 'none on /sys/kernel/security type securityfs (rw)', 'udev on /dev type devtmpfs (rw,mode=0755)', 'devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)', 'tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)', 'none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)', 'none on /run/shm type tmpfs (rw,nosuid,nodev)', 'none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)', 'none on /sys/fs/pstore type pstore (rw)', 'cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,relatime,cpuset)', 'cgroup on /sys/fs/cgroup/cpu type cgroup (rw,relatime,cpu)', 'cgroup on /sys/fs/cgroup/cpuacct type cgroup (rw,relatime,cpuacct)', 'cgroup on /sys/fs/cgroup/memory type cgroup (rw,relatime,memory)', 'cgroup on /sys/fs/cgroup/devices type cgroup (rw,relatime,devices)', 'cgroup on /sys/fs/cgroup/freezer type cgroup (rw,relatime,freezer)', 'cgroup on /sys/fs/cgroup/blkio type cgroup (rw,relatime,blkio)', 'cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,relatime,perf_event)', 'cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,relatime,hugetlb)', '/dev/sda1 on /boot type ext2 (rw)', 'systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd)', '/dev/mapper/vg_prova-lv_prova_vol1 on /home/pippo type ext4 (rw)', ''] mount_point_path = '/home/pippo' source = 'mount' res = lvm.lvm_guess(mount_point_path, mount_points, source) expected_result = ('vg_prova', 'lv_prova_vol1', '/dev/vg_prova/lv_prova_vol1') self.assertEquals(res, expected_result)
def test_no_match(self): mount_points = [] mount_point_path = '/home/pippo' source = '/proc/mounts' res = lvm.lvm_guess(mount_point_path, mount_points, source) expected_result = (None, None, None) self.assertEqual(res, expected_result)
def test_unsing_proc_mounts(self): mount_points = ['rootfs / rootfs rw 0 0\n', 'sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0\n', 'proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0\n', 'udev /dev devtmpfs rw,relatime,size=2010616k,nr_inodes=502654,mode=755 0 0\n', 'devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0\n', 'tmpfs /run tmpfs rw,nosuid,noexec,relatime,size=404836k,mode=755 0 0\n', '/dev/mapper/fabuntu--vg-root / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0\n', 'none /sys/fs/cgroup tmpfs rw,relatime,size=4k,mode=755 0 0\n', 'none /sys/fs/fuse/connections fusectl rw,relatime 0 0\n', 'none /sys/kernel/debug debugfs rw,relatime 0 0\n', 'none /sys/kernel/security securityfs rw,relatime 0 0\n', 'cgroup /sys/fs/cgroup/cpuset cgroup rw,relatime,cpuset 0 0\n', 'cgroup /sys/fs/cgroup/cpu cgroup rw,relatime,cpu 0 0\n', 'cgroup /sys/fs/cgroup/cpuacct cgroup rw,relatime,cpuacct 0 0\n', 'cgroup /sys/fs/cgroup/memory cgroup rw,relatime,memory 0 0\n', 'none /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0\n', 'none /run/shm tmpfs rw,nosuid,nodev,relatime 0 0\n', 'none /run/user tmpfs rw,nosuid,nodev,noexec,relatime,size=102400k,mode=755 0 0\n', 'cgroup /sys/fs/cgroup/devices cgroup rw,relatime,devices 0 0\n', 'none /sys/fs/pstore pstore rw,relatime 0 0\n', 'cgroup /sys/fs/cgroup/freezer cgroup rw,relatime,freezer 0 0\n', 'cgroup /sys/fs/cgroup/blkio cgroup rw,relatime,blkio 0 0\n', 'cgroup /sys/fs/cgroup/perf_event cgroup rw,relatime,perf_event 0 0\n', 'cgroup /sys/fs/cgroup/hugetlb cgroup rw,relatime,hugetlb 0 0\n', '/dev/sda1 /boot ext2 rw,relatime 0 0\n', 'systemd /sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,name=systemd 0 0\n', '/dev/mapper/vg_prova-lv_prova_vol1 /home/pippo ext4 rw,relatime,data=ordered 0 0\n'] mount_point_path = '/home/pippo' source = '/proc/mounts' res = lvm.lvm_guess(mount_point_path, mount_points, source) expected_result = ('vg_prova', 'lv_prova_vol1', '/dev/vg_prova/lv_prova_vol1') self.assertEquals(res, expected_result)
def test_unsing_mount(self): mount_points = [ '/dev/mapper/fabuntu--vg-root on / type ext4 (rw,errors=' 'remount-ro)', 'proc on /proc type proc (rw,noexec,nosuid,nodev)', 'sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)', 'none on /sys/fs/cgroup type tmpfs (rw)', 'none on /sys/fs/fuse/connections type fusectl (rw)', 'none on /sys/kernel/debug type debugfs (rw)', 'none on /sys/kernel/security type securityfs (rw)', 'udev on /dev type devtmpfs (rw,mode=0755)', 'devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,' 'mode=0620)', 'tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)', 'none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,' 'size=5242880)', 'none on /run/shm type tmpfs (rw,nosuid,nodev)', 'none on /run/user type tmpfs (rw,noexec,nosuid,nodev,' 'size=104857600,mode=0755)', 'none on /sys/fs/pstore type pstore (rw)', 'cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,relatime,cpuset)', 'cgroup on /sys/fs/cgroup/cpu type cgroup (rw,relatime,cpu)', 'cgroup on /sys/fs/cgroup/cpuacct type cgroup (rw,relatime,' 'cpuacct)', 'cgroup on /sys/fs/cgroup/memory type cgroup (rw,relatime,memory)', 'cgroup on /sys/fs/cgroup/devices type cgroup (rw,relatime,' 'devices)', 'cgroup on /sys/fs/cgroup/freezer type cgroup (rw,relatime,' 'freezer)', 'cgroup on /sys/fs/cgroup/blkio type cgroup (rw,relatime,blkio)', 'cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,relatime,' 'perf_event)', 'cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,relatime,' 'hugetlb)', '/dev/sda1 on /boot type ext2 (rw)', 'systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,' 'nodev,none,name=systemd)', '/dev/mapper/vg_prova-lv_prova_vol1 on /home/pippo type ext4 (rw)', '' ] mount_point_path = '/home/pippo' source = 'mount' res = lvm.lvm_guess(mount_point_path, mount_points, source) expected_result = ('vg_prova', 'lv_prova_vol1', '/dev/vg_prova/lv_prova_vol1') self.assertEqual(res, expected_result)
def test_unsing_proc_mounts(self): mount_points = [ 'rootfs / rootfs rw 0 0\n', 'sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0\n', 'proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0\n', 'udev /dev devtmpfs rw,relatime,size=2010616k,nr_inodes=502654,' 'mode=755 0 0\n', 'devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,' 'ptmxmode=000 0 0\n', 'tmpfs /run tmpfs rw,nosuid,noexec,relatime,size=404836k,mode=755 ' '0 0\n', '/dev/mapper/fabuntu--vg-root / ext4 rw,relatime,' 'errors=remount-ro,data=ordered 0 0\n', 'none /sys/fs/cgroup tmpfs rw,relatime,size=4k,mode=755 0 0\n', 'none /sys/fs/fuse/connections fusectl rw,relatime 0 0\n', 'none /sys/kernel/debug debugfs rw,relatime 0 0\n', 'none /sys/kernel/security securityfs rw,relatime 0 0\n', 'cgroup /sys/fs/cgroup/cpuset cgroup rw,relatime,cpuset 0 0\n', 'cgroup /sys/fs/cgroup/cpu cgroup rw,relatime,cpu 0 0\n', 'cgroup /sys/fs/cgroup/cpuacct cgroup rw,relatime,cpuacct 0 0\n', 'cgroup /sys/fs/cgroup/memory cgroup rw,relatime,memory 0 0\n', 'none /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k ' '0 0\n', 'none /run/shm tmpfs rw,nosuid,nodev,relatime 0 0\n', 'none /run/user tmpfs rw,nosuid,nodev,noexec,relatime,' 'size=102400k,mode=755 0 0\n', 'cgroup /sys/fs/cgroup/devices cgroup rw,relatime,devices 0 0\n', 'none /sys/fs/pstore pstore rw,relatime 0 0\n', 'cgroup /sys/fs/cgroup/freezer cgroup rw,relatime,freezer 0 0\n', 'cgroup /sys/fs/cgroup/blkio cgroup rw,relatime,blkio 0 0\n', 'cgroup /sys/fs/cgroup/perf_event cgroup rw,relatime,perf_event ' '0 0\n', 'cgroup /sys/fs/cgroup/hugetlb cgroup rw,relatime,hugetlb 0 0\n', '/dev/sda1 /boot ext2 rw,relatime 0 0\n', 'systemd /sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,' 'relatime,name=systemd 0 0\n', '/dev/mapper/vg_prova-lv_prova_vol1 /home/pippo ext4 rw,relatime,' 'data=ordered 0 0\n' ] mount_point_path = '/home/pippo' source = '/proc/mounts' res = lvm.lvm_guess(mount_point_path, mount_points, source) expected_result = ('vg_prova', 'lv_prova_vol1', '/dev/vg_prova/lv_prova_vol1') self.assertEqual(res, expected_result)