Exemplo n.º 1
0
    def test_filesystem_udev_symlink_fsrename_poolrename(self):
        """
        Test the udev symlink creation for filesystem devices after fs and pool rename.
        """
        pool_name = p_n()
        pool_path = make_test_pool(pool_name, StratisCertify.DISKS[0:1])

        fs_name = fs_n()
        filesystem_path = make_test_filesystem(pool_path, fs_name)

        fs_name_rename = fs_n()

        self._unittest_command(
            StratisDbus.fs_rename(pool_name, fs_name, fs_name_rename),
            dbus.UInt16(0))
        # Settle after rename, to allow udev to recognize the filesystem rename
        exec_command(["udevadm", "settle"])

        pool_name_rename = p_n()

        self._unittest_command(
            StratisDbus.pool_rename(pool_name, pool_name_rename),
            dbus.UInt16(0))
        # Settle after rename, to allow udev to recognize the pool rename
        exec_command(["udevadm", "settle"])

        fsdevdest, fsdevmapperlinkdest = acquire_filesystem_symlink_targets(
            pool_name_rename, fs_name_rename, pool_path, filesystem_path)
        self.assertEqual(fsdevdest, fsdevmapperlinkdest)
Exemplo n.º 2
0
    def test_filesystem_rename_permissions(self):
        """
        Test that renaming a filesystem fails when root permissions are dropped.
        """
        pool_name = p_n()
        pool_path = make_test_pool(pool_name, StratisCertify.DISKS[0:1])

        fs_name = fs_n()
        make_test_filesystem(pool_path, fs_name)

        fs_name_rename = fs_n()

        self._test_permissions(StratisDbus.fs_rename, [fs_name, fs_name_rename], True)
Exemplo n.º 3
0
    def test_filesystem_snapshot_permissions(self):
        """
        Test snapshotting a filesystem fails when root permissions are dropped.
        """
        pool_name = p_n()
        pool_path = make_test_pool(pool_name, StratisCertify.DISKS[0:1])

        fs_name = fs_n()
        fs_path = make_test_filesystem(pool_path, fs_name)

        snapshot_name = fs_n()

        self._test_permissions(StratisDbus.fs_snapshot,
                               [pool_path, fs_path, snapshot_name], True)
Exemplo n.º 4
0
    def test_filesystem_rename(self):
        """
        Test renaming a filesystem.
        """
        pool_name = p_n()
        pool_path = make_test_pool(pool_name, StratisCertify.DISKS[0:1])

        fs_name = fs_n()
        make_test_filesystem(pool_path, fs_name)

        fs_name_rename = fs_n()

        self._unittest_command(
            StratisDbus.fs_rename(pool_name, fs_name, fs_name_rename),
            dbus.UInt16(0))
Exemplo n.º 5
0
    def test_filesystem_snapshot(self):
        """
        Test snapshotting a filesystem.
        """
        pool_name = p_n()
        pool_path = make_test_pool(pool_name, StratisCertify.DISKS[0:1])

        fs_name = fs_n()
        fs_path = make_test_filesystem(pool_path, fs_name)

        snapshot_name = fs_n()

        self._unittest_command(
            StratisDbus.fs_snapshot(pool_path, fs_path, snapshot_name),
            dbus.UInt16(0))
Exemplo n.º 6
0
    def test_filesystem_list_not_empty(self):
        """
        Test listing an existent filesystem.
        """
        pool_name = p_n()
        pool_path = make_test_pool(pool_name, StratisCertify.DISKS[0:1])

        fs_name = fs_n()
        make_test_filesystem(pool_path, fs_name)

        self._inequality_test(StratisDbus.fs_list(), {})
Exemplo n.º 7
0
def make_test_filesystem(pool_name):
    """
    Create a test filesystem that will later get destroyed
    :param pool_name: Name of a test pool
    :return: Name of the created filesystem
    """
    filesystem_name = fs_n()
    (return_code, _, stderr) = exec_test_command(
        [_STRATIS_CLI, "filesystem", "create", pool_name, filesystem_name])

    _raise_error_exception(return_code, stderr)
    return filesystem_name
Exemplo n.º 8
0
    def test_filesystem_create_same_name(self):
        """
        Test creating a filesystem that already exists.
        """
        pool_name = p_n()
        pool_path = make_test_pool(pool_name, StratisCertify.DISKS[0:1])

        fs_name = fs_n()
        make_test_filesystem(pool_path, fs_name)

        self._unittest_command(StratisDbus.fs_create(pool_path, fs_name),
                               dbus.UInt16(0))
Exemplo n.º 9
0
    def test_filesystem_create_specified_size(self):
        """
        Test creating a filesystem with a specified size.
        """
        pool_name = p_n()
        pool_path = make_test_pool(pool_name, StratisCertify.DISKS[0:1])

        fs_name = fs_n()

        self._unittest_command(
            StratisDbus.fs_create(pool_path, fs_name, fs_size="8796093022208"),
            dbus.UInt16(0),
        )
Exemplo n.º 10
0
    def test_filesystem_udev_symlink_create(self):
        """
        Test the udev symlink creation for filesystem devices.
        """
        pool_name = p_n()
        pool_path = make_test_pool(pool_name, StratisCertify.DISKS[0:1])

        fs_name = fs_n()
        filesystem_path = make_test_filesystem(pool_path, fs_name)

        fsdevdest, fsdevmapperlinkdest = acquire_filesystem_symlink_targets(
            pool_name, fs_name, pool_path, filesystem_path)
        self.assertEqual(fsdevdest, fsdevmapperlinkdest)
Exemplo n.º 11
0
    def test_filesystem_create_specified_size_toosmall(self):
        """
        Test creating a filesystem with a specified size that is too small.
        """
        pool_name = p_n()
        pool_path = make_test_pool(pool_name, StratisCertify.DISKS[0:1])

        fs_name = fs_n()

        self._unittest_command(
            StratisDbus.fs_create(pool_path, fs_name, fs_size="536866816"),
            dbus.UInt16(1),
        )
Exemplo n.º 12
0
    def test_filesystem_destroy(self):
        """
        Test destroying a filesystem.
        """
        pool_name = p_n()
        pool_path = make_test_pool(pool_name, StratisCertify.DISKS[0:1])

        fs_name = fs_n()
        make_test_filesystem(pool_path, fs_name)

        self._unittest_command(StratisDbus.fs_destroy(pool_name, fs_name),
                               dbus.UInt16(0))

        self.assertEqual(StratisDbus.fs_list(), {})
Exemplo n.º 13
0
 def test_filesystem_create_permissions(self):
     """
     Test creating a filesystem fails with dropped permissions.
     """
     filesystem_name = fs_n()
     self._test_permissions(
         [
             _STRATIS_CLI,
             "filesystem",
             "create",
             make_test_pool(StratisCertify.DISKS[0:1]),
             filesystem_name,
         ],
         True,
         True,
     )
Exemplo n.º 14
0
 def test_filesystem_create(self):
     """
     Test creating a filesystem.
     """
     filesystem_name = fs_n()
     self.unittest_command(
         [
             _STRATIS_CLI,
             "filesystem",
             "create",
             make_test_pool(StratisCertify.DISKS[0:1]),
             filesystem_name,
         ],
         0,
         True,
         True,
     )
Exemplo n.º 15
0
 def test_filesystem_create_specified_size_toosmall(self):
     """
     Test creating a filesystem with a specified size that is too small.
     """
     filesystem_name = fs_n()
     self.unittest_command(
         [
             _STRATIS_CLI,
             "filesystem",
             "create",
             make_test_pool(StratisCertify.DISKS[0:1]),
             filesystem_name,
             "--size=4KiB",
         ],
         1,
         False,
         True,
     )
Exemplo n.º 16
0
 def test_filesystem_rename_permissions(self):
     """
     Test renaming a filesystem fails with dropped permissions.
     """
     pool_name = make_test_pool(StratisCertify.DISKS[0:1])
     filesystem_name = make_test_filesystem(pool_name)
     fs_name_rename = fs_n()
     self._test_permissions(
         [
             _STRATIS_CLI,
             "filesystem",
             "rename",
             pool_name,
             filesystem_name,
             fs_name_rename,
         ],
         True,
         True,
     )
Exemplo n.º 17
0
 def test_filesystem_snapshot_permissions(self):
     """
     Test snapshotting a filesystem fails with dropped permissions.
     """
     pool_name = make_test_pool(StratisCertify.DISKS[0:1])
     filesystem_name = make_test_filesystem(pool_name)
     snapshot_name = fs_n()
     self._test_permissions(
         [
             _STRATIS_CLI,
             "filesystem",
             "snapshot",
             pool_name,
             filesystem_name,
             snapshot_name,
         ],
         True,
         True,
     )
Exemplo n.º 18
0
 def test_filesystem_rename(self):
     """
     Test renaming a filesystem to a new name.
     """
     pool_name = make_test_pool(StratisCertify.DISKS[0:1])
     filesystem_name = make_test_filesystem(pool_name)
     fs_name_rename = fs_n()
     self.unittest_command(
         [
             _STRATIS_CLI,
             "filesystem",
             "rename",
             pool_name,
             filesystem_name,
             fs_name_rename,
         ],
         0,
         True,
         True,
     )
Exemplo n.º 19
0
 def test_filesystem_snapshot(self):
     """
     Test snapshotting a filesystem.
     """
     pool_name = make_test_pool(StratisCertify.DISKS[0:1])
     filesystem_name = make_test_filesystem(pool_name)
     snapshot_name = fs_n()
     self.unittest_command(
         [
             _STRATIS_CLI,
             "filesystem",
             "snapshot",
             pool_name,
             filesystem_name,
             snapshot_name,
         ],
         0,
         True,
         True,
     )