# Path: os_brick/exception.py
# LOG = logging.getLogger(__name__)
# class BrickException(Exception):
# class NotFound(BrickException):
# class Invalid(BrickException):
# class InvalidParameterValue(Invalid):
# class NoFibreChannelHostsFound(BrickException):
# class NoFibreChannelVolumeDeviceFound(BrickException):
# class VolumeNotDeactivated(BrickException):
# class VolumeDeviceNotFound(BrickException):
# class VolumePathsNotFound(BrickException):
# class VolumePathNotRemoved(BrickException):
# class ProtocolNotSupported(BrickException):
# class TargetPortalNotFound(BrickException):
# class TargetPortalsNotFound(TargetPortalNotFound):
# class FailedISCSITargetPortalLogin(BrickException):
# class BlockDeviceReadOnly(BrickException):
# class VolumeGroupNotFound(BrickException):
# class VolumeGroupCreationFailed(BrickException):
# class CommandExecutionFailed(BrickException):
# class VolumeDriverException(BrickException):
# class InvalidIOHandleObject(BrickException):
# class VolumeEncryptionNotSupported(Invalid):
# class VolumeLocalCacheNotSupported(Invalid):
# class InvalidConnectorProtocol(ValueError):
# class ExceptionChainer(BrickException):
# class ExecutionTimeout(putils.ProcessExecutionError):
#     def __init__(self, message=None, **kwargs):
#     def __init__(self, *args, **kwargs):
#     def __repr__(self):
#     def __nonzero__(self) -> bool:
#     def add_exception(self, exc_type, exc_val, exc_tb) -> None:
#     def context(self,
#                 catch_exception: bool,
#                 msg: str = '',
#                 *msg_args: Iterable):
#     def __enter__(self):
#     def __exit__(self, exc_type, exc_val, exc_tb):
# 
# Path: os_brick/i18n.py
# DOMAIN = 'os-brick'
# 
# Path: os_brick/remotefs/remotefs.py
# LOG = logging.getLogger(__name__)
# class RemoteFsClient(executor.Executor):
# class ScalityRemoteFsClient(RemoteFsClient):
# class VZStorageRemoteFSClient(RemoteFsClient):
#     def __init__(self, mount_type, root_helper,
#                  execute=None, *args, **kwargs):
#     def get_mount_base(self):
#     def _get_hash_str(self, base_str):
#     def get_mount_point(self, device_name: str):
#     def _read_mounts(self):
#     def mount(self, share, flags=None):
#     def _do_mount(self, mount_type, share, mount_path, mount_options=None,
#                   flags=None):
#     def _mount_nfs(self, nfs_share, mount_path, flags=None):
#     def _check_nfs_options(self):
#     def _option_exists(self, options, opt_pattern):
#     def _update_option(self, options, option, value=None):
#     def __init__(self, mount_type, root_helper,
#                  execute=None, *args, **kwargs):
#     def get_mount_point(self, device_name):
#     def mount(self, share, flags=None):
#     def _vzstorage_write_mds_list(self, cluster_name, mdss):
#     def _do_mount(self, mount_type, vz_share, mount_path,
#                   mount_options=None, flags=None):


import os
import re
from os_win import utilsfactory
from oslo_log import log as logging
from os_brick import exception
from os_brick.i18n import _
from os_brick.remotefs import remotefs
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

"""Windows remote filesystem client utilities."""




LOG = logging.getLogger(__name__)


class WindowsRemoteFsClient(remotefs.RemoteFsClient):
    _username_regex = re.compile(r'user(?:name)?=([^, ]+)')
    _password_regex = re.compile(r'pass(?:word)?=([^, ]+)')
    _loopback_share_map = {}

    def __init__(self, mount_type, root_helper=None,
                 execute=None, *args, **kwargs):
        mount_type_to_option_prefix = {
            'cifs': 'smbfs',
            'smbfs': 'smbfs',
        }

        self._local_path_for_loopback = kwargs.get('local_path_for_loopback',
                                                   True)

        if mount_type not in mount_type_to_option_prefix:

# Path: os_brick/exception.py
# LOG = logging.getLogger(__name__)
# class BrickException(Exception):
# class NotFound(BrickException):
# class Invalid(BrickException):
# class InvalidParameterValue(Invalid):
# class NoFibreChannelHostsFound(BrickException):
# class NoFibreChannelVolumeDeviceFound(BrickException):
# class VolumeNotDeactivated(BrickException):
# class VolumeDeviceNotFound(BrickException):
# class VolumePathsNotFound(BrickException):
# class VolumePathNotRemoved(BrickException):
# class ProtocolNotSupported(BrickException):
# class TargetPortalNotFound(BrickException):
# class TargetPortalsNotFound(TargetPortalNotFound):
# class FailedISCSITargetPortalLogin(BrickException):
# class BlockDeviceReadOnly(BrickException):
# class VolumeGroupNotFound(BrickException):
# class VolumeGroupCreationFailed(BrickException):
# class CommandExecutionFailed(BrickException):
# class VolumeDriverException(BrickException):
# class InvalidIOHandleObject(BrickException):
# class VolumeEncryptionNotSupported(Invalid):
# class VolumeLocalCacheNotSupported(Invalid):
# class InvalidConnectorProtocol(ValueError):
# class ExceptionChainer(BrickException):
# class ExecutionTimeout(putils.ProcessExecutionError):
#     def __init__(self, message=None, **kwargs):
#     def __init__(self, *args, **kwargs):
#     def __repr__(self):
#     def __nonzero__(self) -> bool:
#     def add_exception(self, exc_type, exc_val, exc_tb) -> None:
#     def context(self,
#                 catch_exception: bool,
#                 msg: str = '',
#                 *msg_args: Iterable):
#     def __enter__(self):
#     def __exit__(self, exc_type, exc_val, exc_tb):
# 
# Path: os_brick/i18n.py
# DOMAIN = 'os-brick'
# 
# Path: os_brick/remotefs/remotefs.py
# LOG = logging.getLogger(__name__)
# class RemoteFsClient(executor.Executor):
# class ScalityRemoteFsClient(RemoteFsClient):
# class VZStorageRemoteFSClient(RemoteFsClient):
#     def __init__(self, mount_type, root_helper,
#                  execute=None, *args, **kwargs):
#     def get_mount_base(self):
#     def _get_hash_str(self, base_str):
#     def get_mount_point(self, device_name: str):
#     def _read_mounts(self):
#     def mount(self, share, flags=None):
#     def _do_mount(self, mount_type, share, mount_path, mount_options=None,
#                   flags=None):
#     def _mount_nfs(self, nfs_share, mount_path, flags=None):
#     def _check_nfs_options(self):
#     def _option_exists(self, options, opt_pattern):
#     def _update_option(self, options, option, value=None):
#     def __init__(self, mount_type, root_helper,
#                  execute=None, *args, **kwargs):
#     def get_mount_point(self, device_name):
#     def mount(self, share, flags=None):
#     def _vzstorage_write_mds_list(self, cluster_name, mdss):
#     def _do_mount(self, mount_type, vz_share, mount_path,
#                   mount_options=None, flags=None):


# Path: os_brick/remotefs/windows_remotefs.py
import os
import re
from os_win import utilsfactory
from oslo_log import log as logging
from os_brick import exception
from os_brick.i18n import _
from os_brick.remotefs import remotefs

#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

"""Windows remote filesystem client utilities."""




LOG = logging.getLogger(__name__)


class WindowsRemoteFsClient(remotefs.RemoteFsClient):
    _username_regex = re.compile(r'user(?:name)?=([^, ]+)')
    _password_regex = re.compile(r'pass(?:word)?=([^, ]+)')
    _loopback_share_map = {}

    def __init__(self, mount_type, root_helper=None,
                 execute=None, *args, **kwargs):
        mount_type_to_option_prefix = {
            'cifs': 'smbfs',
            'smbfs': 'smbfs',
        }

        self._local_path_for_loopback = kwargs.get('local_path_for_loopback',
                                                   True)

        if mount_type not in mount_type_to_option_prefix:

            raise exception.ProtocolNotSupported(protocol=mount_type)