示例#1
0
    def __init__(self, mount_type, root_helper,
                 execute=putils.execute, *args, **kwargs):

        self._mount_type = mount_type
        if mount_type == "nfs":
            self._mount_base = kwargs.get('nfs_mount_point_base', None)
            if not self._mount_base:
                raise exception.InvalidParameterValue(
                    err=_('nfs_mount_point_base required'))
            self._mount_options = kwargs.get('nfs_mount_options', None)
            self._check_nfs_options()
        elif mount_type == "cifs":
            self._mount_base = kwargs.get('smbfs_mount_point_base', None)
            if not self._mount_base:
                raise exception.InvalidParameterValue(
                    err=_('smbfs_mount_point_base required'))
            self._mount_options = kwargs.get('smbfs_mount_options', None)
        elif mount_type == "glusterfs":
            self._mount_base = kwargs.get('glusterfs_mount_point_base', None)
            if not self._mount_base:
                raise exception.InvalidParameterValue(
                    err=_('glusterfs_mount_point_base required'))
            self._mount_options = None
        else:
            raise exception.ProtocolNotSupported(protocol=mount_type)
        self.root_helper = root_helper
        self.set_execute(execute)
示例#2
0
文件: remotefs.py 项目: pipul/cinder
    def __init__(self,
                 mount_type,
                 execute=putils.execute,
                 root_helper="sudo",
                 *args,
                 **kwargs):

        self._mount_type = mount_type
        if mount_type == "nfs":
            self._mount_base = CONF.nfs_mount_point_base
            self._mount_options = CONF.nfs_mount_options
        elif mount_type == "glusterfs":
            self._mount_base = CONF.glusterfs_mount_point_base
            self._mount_options = None
        else:
            raise exception.ProtocolNotSupported(protocol=mount_type)
        self.root_helper = root_helper
        self.set_execute(execute)