# 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/executor.py
# class Executor(object):
# class Thread(threading.Thread):
#     def __init__(self, root_helper, execute=None,
#                  *args, **kwargs):
#     def safe_decode(string):
#     def make_putils_error_safe(cls, exc):
#     def _execute(self, *args, **kwargs) -> Tuple[str, str]:
#     def set_execute(self, execute):
#     def set_root_helper(self, helper):
#     def __init__(self, *args, **kwargs):
#     def run(self):
# 
# Path: os_brick/privileged/rootwrap.py
# LOG = logging.getLogger(__name__)
# def custom_execute(*cmd, **kwargs):
#     def on_timeout(proc):
#     def on_execute(proc):
#     def on_completion(proc):
# def execute(*cmd, **kwargs):
# def execute_root(*cmd, **kwargs):
# def unlink_root(*links, **kwargs):
# 
# Path: os_brick/utils.py
# def _sleep(secs: float) -> None:
#     def __init__(self, codes: Union[int, Tuple[int, ...]]):
#     def _check_exit_code(self, exc: Type[Exception]) -> bool:
# def retry(retry_param: Union[None,
#                              Type[Exception],
#                              Tuple[Type[Exception], ...],
#                              int,
#                              Tuple[int, ...]],
#           interval: float = 1,
#           retries: int = 3,
#           backoff_rate: float = 2,
#           retry: Callable = tenacity.retry_if_exception_type) -> Callable:
#     def _decorator(f):
#         def _wrapper(*args, **kwargs):
# def platform_matches(current_platform: str, connector_platform: str) -> bool:
# def os_matches(current_os: str, connector_os: str) -> bool:
# def merge_dict(dict1: dict, dict2: dict) -> dict:
# def trace(f: Callable) -> Callable:
#     def trace_logging_wrapper(*args, **kwargs):
# def convert_str(text: Union[bytes, str]) -> str:
# def get_host_nqn():
# LOG = logging.getLogger(__name__)
# class retry_if_exit_code(tenacity.retry_if_exception):


import math
import os
import re
from oslo_concurrency import processutils as putils
from oslo_log import log as logging
from oslo_utils import excutils
from os_brick import exception
from os_brick import executor
from os_brick.privileged import rootwrap as priv_rootwrap
from os_brick import utils
        self.vg_lv_count = 0
        self.vg_uuid = None
        self.vg_thin_pool = None
        self.vg_thin_pool_size = 0.0
        self.vg_thin_pool_free_space = 0.0
        self._supports_snapshot_lv_activation = None
        self._supports_lvchange_ignoreskipactivation = None
        self.vg_provisioned_capacity = 0.0

        # Ensure LVM_SYSTEM_DIR has been added to LVM.LVM_CMD_PREFIX
        # before the first LVM command is executed, and use the directory
        # where the specified lvm_conf file is located as the value.

        # NOTE(jdg): We use the temp var here becuase LVM_CMD_PREFIX is a
        # class global and if you use append here, you'll literally just keep
        # appending values to the global.
        _lvm_cmd_prefix = ['env', 'LC_ALL=C']

        if lvm_conf and os.path.isfile(lvm_conf):
            lvm_sys_dir = os.path.dirname(lvm_conf)
            _lvm_cmd_prefix.append('LVM_SYSTEM_DIR=' + lvm_sys_dir)

        if suppress_fd_warn:
            _lvm_cmd_prefix.append('LVM_SUPPRESS_FD_WARNINGS=1')
        LVM.LVM_CMD_PREFIX = _lvm_cmd_prefix

        if create_vg and physical_volumes is not None:
            try:
                self._create_vg(physical_volumes)
            except putils.ProcessExecutionError as err:

# 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/executor.py
# class Executor(object):
# class Thread(threading.Thread):
#     def __init__(self, root_helper, execute=None,
#                  *args, **kwargs):
#     def safe_decode(string):
#     def make_putils_error_safe(cls, exc):
#     def _execute(self, *args, **kwargs) -> Tuple[str, str]:
#     def set_execute(self, execute):
#     def set_root_helper(self, helper):
#     def __init__(self, *args, **kwargs):
#     def run(self):
# 
# Path: os_brick/privileged/rootwrap.py
# LOG = logging.getLogger(__name__)
# def custom_execute(*cmd, **kwargs):
#     def on_timeout(proc):
#     def on_execute(proc):
#     def on_completion(proc):
# def execute(*cmd, **kwargs):
# def execute_root(*cmd, **kwargs):
# def unlink_root(*links, **kwargs):
# 
# Path: os_brick/utils.py
# def _sleep(secs: float) -> None:
#     def __init__(self, codes: Union[int, Tuple[int, ...]]):
#     def _check_exit_code(self, exc: Type[Exception]) -> bool:
# def retry(retry_param: Union[None,
#                              Type[Exception],
#                              Tuple[Type[Exception], ...],
#                              int,
#                              Tuple[int, ...]],
#           interval: float = 1,
#           retries: int = 3,
#           backoff_rate: float = 2,
#           retry: Callable = tenacity.retry_if_exception_type) -> Callable:
#     def _decorator(f):
#         def _wrapper(*args, **kwargs):
# def platform_matches(current_platform: str, connector_platform: str) -> bool:
# def os_matches(current_os: str, connector_os: str) -> bool:
# def merge_dict(dict1: dict, dict2: dict) -> dict:
# def trace(f: Callable) -> Callable:
#     def trace_logging_wrapper(*args, **kwargs):
# def convert_str(text: Union[bytes, str]) -> str:
# def get_host_nqn():
# LOG = logging.getLogger(__name__)
# class retry_if_exit_code(tenacity.retry_if_exception):


# Path: os_brick/local_dev/lvm.py
import math
import os
import re
from oslo_concurrency import processutils as putils
from oslo_log import log as logging
from oslo_utils import excutils
from os_brick import exception
from os_brick import executor
from os_brick.privileged import rootwrap as priv_rootwrap
from os_brick import utils

        self.vg_lv_count = 0
        self.vg_uuid = None
        self.vg_thin_pool = None
        self.vg_thin_pool_size = 0.0
        self.vg_thin_pool_free_space = 0.0
        self._supports_snapshot_lv_activation = None
        self._supports_lvchange_ignoreskipactivation = None
        self.vg_provisioned_capacity = 0.0

        # Ensure LVM_SYSTEM_DIR has been added to LVM.LVM_CMD_PREFIX
        # before the first LVM command is executed, and use the directory
        # where the specified lvm_conf file is located as the value.

        # NOTE(jdg): We use the temp var here becuase LVM_CMD_PREFIX is a
        # class global and if you use append here, you'll literally just keep
        # appending values to the global.
        _lvm_cmd_prefix = ['env', 'LC_ALL=C']

        if lvm_conf and os.path.isfile(lvm_conf):
            lvm_sys_dir = os.path.dirname(lvm_conf)
            _lvm_cmd_prefix.append('LVM_SYSTEM_DIR=' + lvm_sys_dir)

        if suppress_fd_warn:
            _lvm_cmd_prefix.append('LVM_SUPPRESS_FD_WARNINGS=1')
        LVM.LVM_CMD_PREFIX = _lvm_cmd_prefix

        if create_vg and physical_volumes is not None:
            try:
                self._create_vg(physical_volumes)
            except putils.ProcessExecutionError as err:

                LOG.exception('Error creating Volume Group')