Ejemplo n.º 1
0
    def test_create(self):
        with TestAreaContext("create_fs") as work_area:
            work_area.copy_parent_content(self.config_file)

            self.assertTrue(EnkfFs.exists(self.mount_point))
            fs = EnkfFs(self.mount_point)
            self.assertEqual(1, fs.refCount())
            fs.umount()

            self.assertFalse(EnkfFs.exists("newFS"))
            fs = EnkfFs.createFileSystem("newFS")
            self.assertTrue(EnkfFs.exists("newFS"))
            self.assertTrue(fs is None)

            with self.assertRaises(IOError):
                version = EnkfFs.diskVersion("does/not/exist")

            version = EnkfFs.diskVersion("newFS")
            self.assertTrue(version >= 106)
Ejemplo n.º 2
0
    def getFileSystem(self, case_name, mount_root=None):
        """
        @rtype: EnkfFs
        """
        if mount_root is None:
            mount_root = self._mount_root

        full_case_name = self._createFullCaseName(mount_root, case_name)

        if not full_case_name in self._fs_rotator:
            if not EnkfFs.exists(full_case_name):
                if self._fs_rotator.atCapacity():
                    self._fs_rotator.dropOldestFileSystem()

                EnkfFs.createFileSystem(full_case_name)

            new_fs = EnkfFs(full_case_name)
            self._fs_rotator.addFileSystem(new_fs, full_case_name)

        fs = self._fs_rotator[full_case_name]

        return fs