Example #1
0
    def quota_group_report(self):
        # nfs has no quota support
        return []

    def quota_user_set(self,
                       user,
                       block_softlimit=0,
                       block_hardlimit=0,
                       inode_softlimit=0,
                       inode_hardlimit=0,
                       operator="unknown"):
        # nfs has no quota support
        raise StorLeverError("NFS does not support quota", 500)

    def quota_group_set(self,
                        group,
                        block_softlimit=0,
                        block_hardlimit=0,
                        inode_softlimit=0,
                        inode_hardlimit=0,
                        operator="unknown"):
        # nfs has no quota support
        raise StorLeverError("NFS does not support quota", 500)


ModuleManager.register_module(**MODULE_INFO)

# register to fs manager
FileSystemManager.add_fs_type("nfs", Nfs)
Example #2
0
    def mount(self):
        check_output([
            "/bin/mount", "-t", self.fs_conf["type"], "-o", self.mount_options,
            self.fs_conf["dev_file"], self.fs_conf["mount_point"]
        ],
                     input_ret=[32])
        # xfs does not support and no needs quota_check and quota_on

    def fs_meta_dump(self):
        if not self.is_available():
            raise StorLeverError("File system is unavailable", 500)
        return check_output(
            ["/usr/sbin/xfs_info", self.fs_conf["mount_point"]], input_ret=[1])

    def grow_size(self):
        if not self.is_available():
            raise StorLeverError("File system is unavailable", 500)
        check_output(["/usr/sbin/xfs_growfs", self.fs_conf["mount_point"]],
                     input_ret=[1])

    def quota_check(self):
        if not self.is_available():
            raise StorLeverError("File system is unavailable", 500)
        # xfs no needs and has no quota check function
        pass


ModuleManager.register_module(**MODULE_INFO)
# register to fs manager
FileSystemManager.add_fs_type("xfs", Xfs)
Example #3
0
    def quota_user_report(self):
        # nfs has no quota support
        return []

    def quota_group_report(self):
        # nfs has no quota support
        return []

    def quota_user_set(self, user,
                       block_softlimit=0,
                       block_hardlimit=0,
                       inode_softlimit=0,
                       inode_hardlimit=0,
                       operator="unknown"):
        # nfs has no quota support
        raise StorLeverError("NFS does not support quota", 500)

    def quota_group_set(self, group,
                        block_softlimit=0,
                        block_hardlimit=0,
                        inode_softlimit=0,
                        inode_hardlimit=0,
                        operator="unknown"):
        # nfs has no quota support
        raise StorLeverError("NFS does not support quota", 500)

ModuleManager.register_module(**MODULE_INFO)

# register to fs manager
FileSystemManager.add_fs_type("nfs", Nfs)
Example #4
0
MODULE_INFO = {
    "module_name": "ext4",
    "rpms": ["e2fsprogs"],
    "comment": "Provides the ext4 filesystem type support"
}


class Ext4(FileSystem):
    @classmethod
    def mkfs(cls, type, dev_file, fs_options=""):
        cmd = "/sbin/mkfs.ext4 -F -q %s %s" % (fs_options, dev_file)
        check_output(cmd, shell=True, input_ret=[1])

    def fs_meta_dump(self):
        if not self.is_available():
            raise StorLeverError("File system is unavailable", 400)
        return check_output(["/sbin/dumpe2fs", "-h", self.fs_conf["dev_file"]],
                            input_ret=[1])

    def grow_size(self):
        if not self.is_available():
            raise StorLeverError("File system is unavailable", 400)
        check_output(["/sbin/resize2fs", self.fs_conf["dev_file"]],
                     input_ret=[1])


ModuleManager.register_module(**MODULE_INFO)

# register to fs manager
FileSystemManager.add_fs_type("ext4", Ext4)
Example #5
0
from storlever.mngr.fs.fsmgr import FileSystemManager
from storlever.lib.exception import StorLeverError
from storlever.lib import logger
import logging
from storlever.mngr.system.modulemgr import ModuleManager

MODULE_INFO = {"module_name": "ext4", "rpms": ["e2fsprogs"], "comment": "Provides the ext4 filesystem type support"}


class Ext4(FileSystem):
    @classmethod
    def mkfs(cls, type, dev_file, fs_options=""):
        cmd = "/sbin/mkfs.ext4 -F -q %s %s" % (fs_options, dev_file)
        check_output(cmd, shell=True, input_ret=[1])

    def fs_meta_dump(self):
        if not self.is_available():
            raise StorLeverError("File system is unavailable", 400)
        return check_output(["/sbin/dumpe2fs", "-h", self.fs_conf["dev_file"]], input_ret=[1])

    def grow_size(self):
        if not self.is_available():
            raise StorLeverError("File system is unavailable", 400)
        check_output(["/sbin/resize2fs", self.fs_conf["dev_file"]], input_ret=[1])


ModuleManager.register_module(**MODULE_INFO)

# register to fs manager
FileSystemManager.add_fs_type("ext4", Ext4)
Example #6
0
                      self.fs_conf["dev_file"], self.fs_conf["mount_point"]],
                     input_ret=[32])
        # xfs does not support and no needs quota_check and quota_on

    def fs_meta_dump(self):
        if not self.is_available():
            raise StorLeverError("File system is unavailable", 500)
        return check_output(["/usr/sbin/xfs_info", self.fs_conf["mount_point"]],
                            input_ret=[1])

    def grow_size(self):
        if not self.is_available():
            raise StorLeverError("File system is unavailable", 500)
        check_output(["/usr/sbin/xfs_growfs", self.fs_conf["mount_point"]],
                     input_ret=[1])

    def quota_check(self):
        if not self.is_available():
            raise StorLeverError("File system is unavailable", 500)
        # xfs no needs and has no quota check function
        pass

ModuleManager.register_module(**MODULE_INFO)
# register to fs manager
FileSystemManager.add_fs_type("xfs", Xfs)