Ejemplo n.º 1
0
    def do_setup(self, context):
        """Any initialization the share driver does while starting."""

        LOG.info(_LI("Starting share driver %(driver_name)s (%(version)s)"), {
            'driver_name': self.__class__.__name__,
            'version': self.VERSION
        })

        if not self.driver_handles_share_servers:
            self.share_ip_address = self.configuration.hpe3par_share_ip_address
            if not self.share_ip_address:
                raise exception.HPE3ParInvalid(
                    _("Unsupported configuration. "
                      "hpe3par_share_ip_address must be set when "
                      "driver_handles_share_servers is False."))

        mediator = hpe_3par_mediator.HPE3ParMediator(
            hpe3par_username=self.configuration.hpe3par_username,
            hpe3par_password=self.configuration.hpe3par_password,
            hpe3par_api_url=self.configuration.hpe3par_api_url,
            hpe3par_debug=self.configuration.hpe3par_debug,
            hpe3par_san_ip=self.configuration.hpe3par_san_ip,
            hpe3par_san_login=self.configuration.hpe3par_san_login,
            hpe3par_san_password=self.configuration.hpe3par_san_password,
            hpe3par_san_ssh_port=self.configuration.hpe3par_san_ssh_port,
            hpe3par_fstore_per_share=(
                self.configuration.hpe3par_fstore_per_share),
            hpe3par_require_cifs_ip=self.configuration.hpe3par_require_cifs_ip,
            hpe3par_share_ip_address=(
                self.configuration.hpe3par_share_ip_address),
            hpe3par_cifs_admin_access_username=(
                self.configuration.hpe3par_cifs_admin_access_username),
            hpe3par_cifs_admin_access_password=(
                self.configuration.hpe3par_cifs_admin_access_password),
            hpe3par_cifs_admin_access_domain=(
                self.configuration.hpe3par_cifs_admin_access_domain),
            hpe3par_share_mount_path=(
                self.configuration.hpe3par_share_mount_path),
            my_ip=self.configuration.my_ip,
            ssh_conn_timeout=self.configuration.ssh_conn_timeout,
        )

        mediator.do_setup()

        # FPG must be configured and must exist.
        self.fpg = self.configuration.safe_get('hpe3par_fpg')
        # Validate the FPG and discover the VFS
        # This also validates the client, connection, firmware, WSAPI, FPG...
        self.vfs = mediator.get_vfs_name(self.fpg)

        # Don't set _hpe3par until it is ready. Otherwise _update_stats fails.
        self._hpe3par = mediator
Ejemplo n.º 2
0
    def do_setup(self, context):
        """Any initialization the share driver does while starting."""

        LOG.info(_LI("Starting share driver %(driver_name)s (%(version)s)"), {
            'driver_name': self.__class__.__name__,
            'version': self.VERSION
        })

        mediator = hpe_3par_mediator.HPE3ParMediator(
            hpe3par_username=self.configuration.hpe3par_username,
            hpe3par_password=self.configuration.hpe3par_password,
            hpe3par_api_url=self.configuration.hpe3par_api_url,
            hpe3par_debug=self.configuration.hpe3par_debug,
            hpe3par_san_ip=self.configuration.hpe3par_san_ip,
            hpe3par_san_login=self.configuration.hpe3par_san_login,
            hpe3par_san_password=self.configuration.hpe3par_san_password,
            hpe3par_san_ssh_port=self.configuration.hpe3par_san_ssh_port,
            hpe3par_fstore_per_share=(
                self.configuration.hpe3par_fstore_per_share),
            hpe3par_require_cifs_ip=self.configuration.hpe3par_require_cifs_ip,
            hpe3par_cifs_admin_access_username=(
                self.configuration.hpe3par_cifs_admin_access_username),
            hpe3par_cifs_admin_access_password=(
                self.configuration.hpe3par_cifs_admin_access_password),
            hpe3par_cifs_admin_access_domain=(
                self.configuration.hpe3par_cifs_admin_access_domain),
            hpe3par_share_mount_path=(
                self.configuration.hpe3par_share_mount_path),
            my_ip=self.configuration.my_ip,
            ssh_conn_timeout=self.configuration.ssh_conn_timeout,
        )

        mediator.do_setup()

        def _validate_pool_ips(addresses, conf_pool_ips):
            # Pool configured IP addresses should be subset of IP addresses
            # retured from vfs
            if not set(conf_pool_ips) <= set(addresses):
                msg = _("Incorrect configuration. "
                        "Configuration pool IP address did not match with "
                        "IP addresses at 3par array")
                raise exception.HPE3ParInvalid(err=msg)

        def _construct_fpg():
            # FPG must be configured and must exist.
            # self.configuration.safe_get('hpe3par_fpg') will have value in
            # following format:
            # [ {'pool_name':['ip_addr', 'ip_addr', ...]}, ... ]
            for fpg in self.configuration.safe_get('hpe3par_fpg'):
                pool_name = list(fpg)[0]
                conf_pool_ips = fpg[pool_name]

                # Validate the FPG and discover the VFS
                # This also validates the client, connection, firmware, WSAPI,
                # FPG...
                vfs_info = mediator.get_vfs(pool_name)
                if self.driver_handles_share_servers:
                    # Use discovered IP(s) from array
                    self.fpgs[pool_name] = {
                        vfs_info['vfsname']: vfs_info['vfsip']['address']
                    }
                elif conf_pool_ips == []:
                    # not DHSS and IPs not configured in manila.conf.
                    if not vfs_info['vfsip']['address']:
                        msg = _("Unsupported configuration. "
                                "hpe3par_fpg must have IP address "
                                "or be discoverable at 3PAR")
                        LOG.error(msg)
                        raise exception.HPE3ParInvalid(err=msg)
                    else:
                        # Use discovered pool ips
                        self.fpgs[pool_name] = {
                            vfs_info['vfsname']: vfs_info['vfsip']['address']
                        }
                else:
                    # not DHSS and IPs configured in manila.conf
                    _validate_pool_ips(vfs_info['vfsip']['address'],
                                       conf_pool_ips)
                    self.fpgs[pool_name] = {vfs_info['vfsname']: conf_pool_ips}

        _construct_fpg()

        # Don't set _hpe3par until it is ready. Otherwise _update_stats fails.
        self._hpe3par = mediator