Exemple #1
0
    def __init__(self, *args, **kwargs):
        self._execute = None
        self.context = None
        self.configuration = kwargs.get('configuration', None)

        service_parameters = ['volume_type', 'hdp']
        optional_parameters = ['ssc_cmd', 'cluster_admin_ip0']

        if self.configuration:
            self.configuration.append_config_values(
                hnas_utils.drivers_common_opts)
            self.configuration.append_config_values(NFS_OPTS)
            self.config = {}

            # Trying to get HNAS configuration from cinder.conf
            self.config = hnas_utils.read_cinder_conf(
                self.configuration, 'nfs')

            # If HNAS configuration are not set on cinder.conf, tries to use
            # the deprecated XML configuration file
            if not self.config:
                self.config = hnas_utils.read_xml_config(
                    self.configuration.hds_hnas_nfs_config_file,
                    service_parameters,
                    optional_parameters)

        super(HNASNFSDriver, self).__init__(*args, **kwargs)
        self.backend = hnas_backend.HNASSSHBackend(self.config)
Exemple #2
0
    def __init__(self, *args, **kwargs):
        """Initializes and reads different config parameters."""
        self.configuration = kwargs.get('configuration', None)
        self.context = {}
        self.config = {}

        service_parameters = ['volume_type', 'hdp', 'iscsi_ip']
        optional_parameters = ['ssc_cmd', 'cluster_admin_ip0',
                               'chap_enabled']

        if self.configuration:
            self.configuration.append_config_values(
                hnas_utils.drivers_common_opts)
            self.configuration.append_config_values(iSCSI_OPTS)

            # Trying to get HNAS configuration from cinder.conf
            self.config = hnas_utils.read_cinder_conf(
                self.configuration, 'iscsi')

            # If HNAS configuration are not set on cinder.conf, tries to use
            # the deprecated XML configuration file
            if not self.config:
                self.config = hnas_utils.read_xml_config(
                    self.configuration.hds_hnas_iscsi_config_file,
                    service_parameters,
                    optional_parameters)

        super(HNASISCSIDriver, self).__init__(*args, **kwargs)
        self.backend = hnas_backend.HNASSSHBackend(self.config)
Exemple #3
0
    def __init__(self, *args, **kwargs):
        msg = _("The Hitachi NAS driver is deprecated and will be "
                "removed in a future release.")
        versionutils.report_deprecated_feature(LOG, msg)
        self._execute = None
        self.context = None
        self.configuration = kwargs.get('configuration', None)

        service_parameters = ['volume_type', 'hdp']
        optional_parameters = ['ssc_cmd', 'cluster_admin_ip0']

        if self.configuration:
            self.configuration.append_config_values(
                hnas_utils.drivers_common_opts)
            self.configuration.append_config_values(NFS_OPTS)
            self.config = {}

            # Trying to get HNAS configuration from cinder.conf
            self.config = hnas_utils.read_cinder_conf(self.configuration)

            # If HNAS configuration are not set on cinder.conf, tries to use
            # the deprecated XML configuration file
            if not self.config:
                self.config = hnas_utils.read_xml_config(
                    self.configuration.hds_hnas_nfs_config_file,
                    service_parameters, optional_parameters)

        super(HNASNFSDriver, self).__init__(*args, **kwargs)
        self.backend = hnas_backend.HNASSSHBackend(self.config)
    def __init__(self, *args, **kwargs):
        """Initializes and reads different config parameters."""
        super(HNASISCSIDriver, self).__init__(*args, **kwargs)
        self.configuration = kwargs.get('configuration', None)
        self.context = {}
        self.config = {}

        service_parameters = ['volume_type', 'hdp', 'iscsi_ip']
        optional_parameters = ['ssc_cmd', 'cluster_admin_ip0', 'chap_enabled']

        if self.configuration:
            self.configuration.append_config_values(
                hnas_utils.drivers_common_opts)
            self.configuration.append_config_values(iSCSI_OPTS)

            # Trying to get HNAS configuration from cinder.conf
            self.config = hnas_utils.read_cinder_conf(self.configuration,
                                                      'iscsi')

            # If HNAS configuration are not set on cinder.conf, tries to use
            # the deprecated XML configuration file
            if not self.config:
                self.config = hnas_utils.read_xml_config(
                    self.configuration.hds_hnas_iscsi_config_file,
                    service_parameters, optional_parameters)

            self.reserved_percentage = (
                self.configuration.safe_get('reserved_percentage'))
            self.max_osr = (
                self.configuration.safe_get('max_over_subscription_ratio'))

        self.backend = hnas_backend.HNASSSHBackend(self.config)
Exemple #5
0
    def __init__(self, *args, **kwargs):
        msg = _("The Hitachi NAS driver is deprecated and will be "
                "removed in a future release.")
        versionutils.report_deprecated_feature(LOG, msg)
        self._execute = None
        self.context = None
        self.configuration = kwargs.get('configuration', None)

        service_parameters = ['volume_type', 'hdp']
        optional_parameters = ['ssc_cmd', 'cluster_admin_ip0']

        if self.configuration:
            self.configuration.append_config_values(
                hnas_utils.drivers_common_opts)
            self.configuration.append_config_values(NFS_OPTS)
            self.config = {}

            # Trying to get HNAS configuration from cinder.conf
            self.config = hnas_utils.read_cinder_conf(
                self.configuration)

            # If HNAS configuration are not set on cinder.conf, tries to use
            # the deprecated XML configuration file
            if not self.config:
                self.config = hnas_utils.read_xml_config(
                    self.configuration.hds_hnas_nfs_config_file,
                    service_parameters,
                    optional_parameters)

        super(HNASNFSDriver, self).__init__(*args, **kwargs)
        self.backend = hnas_backend.HNASSSHBackend(self.config)
Exemple #6
0
    def __init__(self, *args, **kwargs):
        self._execute = None
        self.context = None
        self.configuration = kwargs.get('configuration', None)

        service_parameters = ['volume_type', 'hdp']
        optional_parameters = ['ssc_cmd', 'cluster_admin_ip0']

        if self.configuration:
            self.configuration.append_config_values(
                hnas_utils.drivers_common_opts)
            self.configuration.append_config_values(NFS_OPTS)
            self.config = {}

            # Trying to get HNAS configuration from cinder.conf
            self.config = hnas_utils.read_cinder_conf(self.configuration,
                                                      'nfs')

            # If HNAS configuration are not set on cinder.conf, tries to use
            # the deprecated XML configuration file
            if not self.config:
                self.config = hnas_utils.read_xml_config(
                    self.configuration.hds_hnas_nfs_config_file,
                    service_parameters, optional_parameters)

        super(HNASNFSDriver, self).__init__(*args, **kwargs)
        self.backend = hnas_backend.HNASSSHBackend(self.config)
    def test_read_xml_config(self):
        self.mock_object(os, 'access', return_value=True)
        self.mock_object(ETree, 'parse', return_value=ETree.ElementTree)
        self.mock_object(ETree.ElementTree,
                         'getroot',
                         return_value=valid_XML_etree)

        xml_path = 'xml_file_found'
        out = hnas_utils.read_xml_config(xml_path, service_parameters,
                                         optional_parameters)

        self.assertEqual(parsed_xml, out)
    def test_read_xml_config(self):
        self.mock_object(os, 'access', mock.Mock(return_value=True))
        self.mock_object(ETree, 'parse',
                         mock.Mock(return_value=ETree.ElementTree))
        self.mock_object(ETree.ElementTree, 'getroot',
                         mock.Mock(return_value=valid_XML_etree))

        xml_path = 'xml_file_found'
        out = hnas_utils.read_xml_config(xml_path,
                                         service_parameters,
                                         optional_parameters)

        self.assertEqual(parsed_xml, out)