def create_configuration(self):
        """Configuration specific to SAN context values."""
        config = self.configuration

        fabric_names = [x.strip() for x in config.fc_fabric_names.split(',')]
        LOG.debug('Fabric Names: %s', fabric_names)

        # There can be more than one SAN in the network and we need to
        # get credentials for each for SAN context lookup later.
        # Cisco Zonesets require VSANs
        if fabric_names:
            self.fabric_configs = fabric_opts.load_fabric_configurations(
                fabric_names)
Example #2
0
    def __init__(self, **kwargs):
        super(CiscoFCZoneDriver, self).__init__(**kwargs)
        self.configuration = kwargs.get('configuration', None)
        if self.configuration:
            self.configuration.append_config_values(cisco_opts)

            # Adding a hack to handle parameters from super classes
            # in case configured with multi backends.
            fabric_names = self.configuration.safe_get('fc_fabric_names')
            activate = self.configuration.safe_get('cisco_zone_activate')
            prefix = self.configuration.safe_get('cisco_zone_name_prefix')
            base_san_opts = []
            if not fabric_names:
                base_san_opts.append(
                    cfg.StrOpt('fc_fabric_names',
                               default=None,
                               help='Comma separated list of fibre channel '
                               'fabric names. This list of names is used to'
                               ' retrieve other SAN credentials for connecting'
                               ' to each SAN fabric'))
            if not activate:
                base_san_opts.append(
                    cfg.BoolOpt('cisco_zone_activate',
                                default=True,
                                help='Indicates whether zone should '
                                'be activated or not'))
            if not prefix:
                base_san_opts.append(
                    cfg.StrOpt('cisco_zone_name_prefix',
                               default="openstack",
                               help="A prefix to be used when naming zone"))
            if len(base_san_opts) > 0:
                CONF.register_opts(base_san_opts)
                self.configuration.append_config_values(base_san_opts)
            fabric_names = [
                x.strip()
                for x in self.configuration.fc_fabric_names.split(',')
            ]

            # There can be more than one SAN in the network and we need to
            # get credentials for each SAN.
            if fabric_names:
                self.fabric_configs = fabric_opts.load_fabric_configurations(
                    fabric_names)
    def __init__(self, **kwargs):
        super(CiscoFCZoneDriver, self).__init__(**kwargs)
        self.configuration = kwargs.get("configuration", None)
        if self.configuration:
            self.configuration.append_config_values(cisco_opts)

            # Adding a hack to handle parameters from super classes
            # in case configured with multi backends.
            fabric_names = self.configuration.safe_get("fc_fabric_names")
            activate = self.configuration.safe_get("cisco_zone_activate")
            prefix = self.configuration.safe_get("cisco_zone_name_prefix")
            base_san_opts = []
            if not fabric_names:
                base_san_opts.append(
                    cfg.StrOpt(
                        "fc_fabric_names",
                        default=None,
                        help="Comma separated list of fibre channel "
                        "fabric names. This list of names is used to"
                        " retrieve other SAN credentials for connecting"
                        " to each SAN fabric",
                    )
                )
            if not activate:
                base_san_opts.append(
                    cfg.BoolOpt(
                        "cisco_zone_activate", default=True, help="Indicates whether zone should " "be activated or not"
                    )
                )
            if not prefix:
                base_san_opts.append(
                    cfg.StrOpt(
                        "cisco_zone_name_prefix", default="openstack", help="A prefix to be used when naming zone"
                    )
                )
            if len(base_san_opts) > 0:
                CONF.register_opts(base_san_opts)
                self.configuration.append_config_values(base_san_opts)
            fabric_names = [x.strip() for x in self.configuration.fc_fabric_names.split(",")]

            # There can be more than one SAN in the network and we need to
            # get credentials for each SAN.
            if fabric_names:
                self.fabric_configs = fabric_opts.load_fabric_configurations(fabric_names)