Example #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)
Example #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)
Example #3
0
    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)
Example #4
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)
Example #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)
Example #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_cinder_conf_iscsi(self):
        local_config = copy.deepcopy(config_from_cinder_conf)

        local_config['services']['FS-CinderDev1']['iscsi_ip'] = '172.24.49.32'
        local_config['services']['default']['iscsi_ip'] = '172.24.49.21'

        out = hnas_utils.read_cinder_conf(self.fake_conf, 'iscsi')

        self.assertEqual(local_config, out)
    def test_read_cinder_conf_iscsi(self):
        local_config = copy.deepcopy(config_from_cinder_conf)

        local_config['services']['FS-CinderDev1']['iscsi_ip'] = '172.24.49.32'
        local_config['services']['default']['iscsi_ip'] = '172.24.49.21'

        out = hnas_utils.read_cinder_conf(self.fake_conf, 'iscsi')

        self.assertEqual(local_config, out)
 def test_read_cinder_conf_break(self):
     self.override_config('hnas_username', None, conf.SHARED_CONF_GROUP)
     self.override_config('hnas_password', None, conf.SHARED_CONF_GROUP)
     self.override_config('hnas_mgmt_ip0', None, conf.SHARED_CONF_GROUP)
     out = hnas_utils.read_cinder_conf(self.fake_conf)
     self.assertIsNone(out)
    def test_read_cinder_conf_nfs(self):
        out = hnas_utils.read_cinder_conf(self.fake_conf)

        self.assertEqual(config_from_cinder_conf, out)
 def test_read_cinder_conf_break(self):
     self.override_config('hnas_username', None)
     self.override_config('hnas_password', None)
     self.override_config('hnas_mgmt_ip0', None)
     out = hnas_utils.read_cinder_conf(self.fake_conf, 'nfs')
     self.assertIsNone(out)
    def test_read_cinder_conf_nfs(self):
        out = hnas_utils.read_cinder_conf(self.fake_conf, 'nfs')

        self.assertEqual(config_from_cinder_conf, out)
 def test_read_cinder_conf_break(self):
     self.override_config('hnas_username', None)
     self.override_config('hnas_password', None)
     self.override_config('hnas_mgmt_ip0', None)
     out = hnas_utils.read_cinder_conf(self.fake_conf, 'nfs')
     self.assertIsNone(out)