Unity: failed to init driver because cannot connect to unity

Bug #1800985 reported by Ryan Liang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
New
Undecided
Unassigned

Bug Description

Failed to initialize the Unity driver because it cannot connect to the Unity system.

Env:
- OpenStack version: Stein
- storops version: 0.5.12
- requests version: 2.20.0

storops uses `requests` to send rest to the Unity system. `requests` handles the possible redirect if needed.

The connection to the Unity system could be redirected to the CAS if not authorized. But due to a bug `requests` drops the auth in the headers.

Detail description about this issue:
https://github.com/requests/requests/commit/ea9436a5d6a5934a906e91202349aabf9af75d15
https://github.com/requests/requests/pull/4851

And the symptom you would see about this issue is like:
>>> u = storops.UnitySystem('10.245.101.39', 'admin', 'xxxxxxxx')
>>> u.info
REQ URL: [GET] https://10.245.101.39:443/api/types/basicSystemInfo?compact=True&fields=attributes.description,attributes.displayValue,attributes.initialValue,attributes.name,attributes.type,description,documentation,name,type
/usr/local/lib/python2.7/dist-packages/urllib3/connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
/usr/local/lib/python2.7/dist-packages/urllib3/connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
REQ URL: [GET] https://10.245.101.39:443/api/types/basicSystemInfo?compact=True&fields=attributes.description,attributes.displayValue,attributes.initialValue,attributes.name,attributes.type,description,documentation,name,type, TIME: 0.143758058548, RESP CODE: 401
RESP BODY:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
    <head>
        <title>Unisphere</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

        <link type="text/css" rel="stylesheet" href="/cas/css/emc_cas.css;jsessionid=81AAB066EE1E0ECE67838E914BAC9EDA" />
        <script type="text/javascript" src="js/common_rosters.js"></script>
        <link rel="icon" href="/cas/favicon.ico" type="image/x-icon" />
        <style>
            #bg img{
                position:fixed;
                top:0;
                left:0;
                width:100%;
                height:100%;
                z-index:-1;
            }
        </style>
    </head>
    <body id="cas" onload="init();">

<div id="msg" class="errors">
        <h2>401 Unauthorized</h2>
        <p>You are not authorized to view this page.</p>
</div>
        </body>
</html>

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/sam/storops/storops/lib/common.py", line 54, in __repr__
    return self.json(indent=4)
  File "/home/sam/storops/storops/lib/common.py", line 51, in json
    return json.dumps(self.get_dict_repr(), indent=indent, sort_keys=True)
  File "/home/sam/storops/storops/lib/common.py", line 46, in get_dict_repr
    props = self._get_properties(dec)
  File "/home/sam/storops/storops/unity/resource/__init__.py", line 125, in _get_properties
    props = super(UnityResource, self)._get_properties(dec)
  File "/home/sam/storops/storops/lib/resource.py", line 147, in _get_properties
    value = getattr(self, name)
  File "/home/sam/storops/storops/lib/resource.py", line 172, in __getattr__
    ret = self._get_property_from_raw(item)
  File "/home/sam/storops/storops/unity/resource/__init__.py", line 143, in _get_property_from_raw
    value = super(UnityResource, self)._get_property_from_raw(item)
  File "/home/sam/storops/storops/lib/resource.py", line 186, in _get_property_from_raw
    self.update()
  File "/usr/local/lib/python2.7/dist-packages/cachez.py", line 206, in func_wrapper
    return func(*args, **kwargs)
  File "/home/sam/storops/storops/lib/resource.py", line 61, in update
    data = self._get_raw_resource()
  File "/home/sam/storops/storops/unity/resource/__init__.py", line 93, in _get_raw_resource
    nested_fields=nested_fields)
  File "/home/sam/storops/storops/unity/client.py", line 42, in _wrap
    ret = func(*args, **kwargs)
  File "/home/sam/storops/storops/unity/client.py", line 178, in get
    base_fields = self.get_fields(type_name, base_fields, nested_fields)
  File "/home/sam/storops/storops/unity/client.py", line 158, in get_fields
    ret = unity_type.fields
  File "/home/sam/storops/storops/unity/resource/type_resource.py", line 54, in fields
    ret = tuple(sorted(att['name'] for att in self.attributes))
  File "/home/sam/storops/storops/lib/resource.py", line 172, in __getattr__
    ret = self._get_property_from_raw(item)
  File "/home/sam/storops/storops/unity/resource/__init__.py", line 143, in _get_property_from_raw
    value = super(UnityResource, self)._get_property_from_raw(item)
  File "/home/sam/storops/storops/lib/resource.py", line 186, in _get_property_from_raw
    self.update()
  File "/usr/local/lib/python2.7/dist-packages/cachez.py", line 206, in func_wrapper
    return func(*args, **kwargs)
  File "/home/sam/storops/storops/lib/resource.py", line 61, in update
    data = self._get_raw_resource()
  File "/home/sam/storops/storops/unity/resource/type_resource.py", line 39, in _get_raw_resource
    resp = self._cli.rest_get(url, fields=self._fields)
  File "/home/sam/storops/storops/unity/client.py", line 124, in rest_get
    return RestResponse(self._rest.get(url))
  File "/home/sam/storops/storops/connection/connector.py", line 75, in get
    return self.http_client.get(url, **kwargs)
  File "/home/sam/storops/storops/connection/client.py", line 134, in get
    result = self._cs_request(url, 'GET', **kwargs)
  File "/home/sam/storops/storops/connection/client.py", line 122, in _cs_request
    **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/retryz/__init__.py", line 192, in func_wrapper
    ret = function(*args, **kwargs)
  File "/home/sam/storops/storops/connection/client.py", line 130, in _cs_request_with_retries
    return self.request(url, method, **kwargs)
  File "/home/sam/storops/storops/connection/client.py", line 114, in request
    raise exceptions.from_response(resp, method, full_url)
storops.connection.exceptions.HTTPClientError: HTTP Client Error (HTTP 401)

Tags: dellemc unity
Ryan Liang (ryan-liang)
description: updated
Revision history for this message
Sam Wan (sam-wan) wrote :

can we pin 'requests!=2.20.0' in requirements/upper-constraints.txt

Revision history for this message
Daniel (nowx) wrote :

running into the same issue with nagios-unity script.
https://github.com/thecodeteam/nagios-unity

Revision history for this message
Ryan Liang (ryan-liang) wrote :

Workaround the issue by
1. downgrading `requests` to the version before 2.20.0. Or
2. patch the fix from requests master branch before 2.20.1 is released.

Revision history for this message
Sam Wan (sam-wan) wrote :

Hi,
submitted a patch to pump requests to 2.20.1
https://review.openstack.org/617296

Revision history for this message
Matthew Thode (prometheanfire) wrote :

I think the best option here would be to request requests to tag and move to that. rolling back has caused problems in the past that I'd like to avoid.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to cinder (master)

Reviewed: https://review.openstack.org/617345
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=37091909c83d5504d159039b27937f44327fbe71
Submitter: Zuul
Branch: master

commit 37091909c83d5504d159039b27937f44327fbe71
Author: Tony Breeds <email address hidden>
Date: Mon Nov 12 15:58:36 2018 +0100

    Block broken requests 2.20.0

    Change-Id: I2889804a19499e1238b9b8cec9ebaea2c037d7d7
    Related-Bug: 1800985
    Depends-On: https://review.openstack.org/617296

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/requirements pike-eol

This issue was fixed in the openstack/requirements pike-eol release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/requirements queens-eol

This issue was fixed in the openstack/requirements queens-eol release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/requirements rocky-eol

This issue was fixed in the openstack/requirements rocky-eol release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/requirements stein-eol

This issue was fixed in the openstack/requirements stein-eol release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/requirements yoga-eom

This issue was fixed in the openstack/requirements yoga-eom release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/requirements train-eol

This issue was fixed in the openstack/requirements train-eol release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/requirements ussuri-eol

This issue was fixed in the openstack/requirements ussuri-eol release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/requirements victoria-eom

This issue was fixed in the openstack/requirements victoria-eom release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/requirements wallaby-eom

This issue was fixed in the openstack/requirements wallaby-eom release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/requirements xena-eom

This issue was fixed in the openstack/requirements xena-eom release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/requirements zed-eom

This issue was fixed in the openstack/requirements zed-eom release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.