'Set the san_ip to active gpfs node IP'

def _get_active_gpfs_node_ip(self):

    active_gpfs_node_ip = None
    gpfs_node_ips = self.configuration.gpfs_hosts
    ssh = paramiko.SSHClient()
    if (not self.configuration.gpfs_hosts_key_file):
        raise exception.ParameterNotFound(param='gpfs_hosts_key_file')
    elif (not os.path.isfile(self.configuration.gpfs_hosts_key_file)):
        if (CONF.state_path in self.configuration.gpfs_hosts_key_file):
            open(self.configuration.gpfs_hosts_key_file, 'a').close()
        else:
            msg = (_('Unable    to    find    ssh_hosts_key_file:    %s') % self.configuration.gpfs_hosts_key_file)
            raise exception.InvalidInput(reason=msg)
    ssh.load_host_keys(self.configuration.gpfs_hosts_key_file)
    if self.configuration.gpfs_strict_host_key_policy:
        ssh.set_missing_host_key_policy(paramiko.RejectPolicy())
    else:
        ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    if ((not self.configuration.gpfs_user_password) and (not self.configuration.gpfs_private_key)):
        msg = _('Specify    a    password    or    private_key')
        raise exception.VolumeDriverException(msg)
    for ip in gpfs_node_ips:
        try:
            if self.configuration.gpfs_user_password:
                ssh.connect(ip, port=self.configuration.gpfs_ssh_port, username=self.configuration.gpfs_user_login, password=self.configuration.gpfs_user_password, timeout=self.configuration.ssh_conn_timeout)
            elif self.configuration.gpfs_private_key:
                pkfile = os.path.expanduser(self.configuration.gpfs_private_key)
                privatekey = paramiko.RSAKey.from_private_key_file(pkfile)
                ssh.connect(ip, port=self.configuration.gpfs_ssh_port, username=self.configuration.gpfs_user_login, pkey=privatekey, timeout=self.configuration.ssh_conn_timeout)
        except Exception as e:
            LOG.info('Cannot    connect    to    GPFS    node    %(ip)s.    Error    is:    %(err)s.    Continuing    to    next    node', {'ip': ip, 'err': e})
            continue
        try:
            (out, __) = processutils.ssh_execute(ssh, (self.GPFS_PATH + 'mmgetstate    -Y'))
            lines = out.splitlines()
            state_token = lines[0].split(':').index('state')
            gpfs_state = lines[1].split(':')[state_token]
            if (gpfs_state != 'active'):
                LOG.info('GPFS    is    not    active    on    node    %(ip)s.    Continuing    to    next    node', {'ip': ip})
                continue
            processutils.ssh_execute(ssh, ('df    ' + self.configuration.gpfs_mount_point_base))
        except processutils.ProcessExecutionError as e:
            LOG.info('GPFS    is    not    active    on    node    %(ip)s.    Error    is:    %(err)s.    Continuing    to    next    node', {'ip': ip, 'err': e})
            continue
        LOG.debug('Setting    active    GPFS    node    IP    to    %s', ip)
        active_gpfs_node_ip = ip
        break
    else:
        msg = _('No    GPFS    node    is    active')
        LOG.error(msg)
        raise exception.VolumeBackendAPIException(data=msg)
    return active_gpfs_node_ip
