Comment 1 for bug 1947010

Revision history for this message
Nobuto Murata (nobuto) wrote :

1st example: if a second request is 6 seconds after the first request (> KeepAliveTimeout=5), tcp connection is not reused under keystoneauth1.session.Session.

The line to highlight is "urllib3.connectionpool:Resetting dropped connection" which is resetting the TCP connection and to re-establish another TCP connection.

https://docs.openstack.org/python-novaclient/latest/user/python-api.html
====
from keystoneauth1.identity import v3
from keystoneauth1 import session
from novaclient import client

import logging

logging.basicConfig(level=logging.DEBUG)

from time import sleep

auth = v3.Password(auth_url="https://192.168.151.112:5000/v3",
                   username="admin", password="MY_PASSWORD",
                   project_name="admin",
                   user_domain_name="admin_domain",
                   project_domain_name="admin_domain")

sess = session.Session(auth=auth,
    verify="/home/ubuntu/snap/openstackclients/common/root-ca.crt")
nova = client.Client(2, session=sess)

nova.servers.list()
sleep(6)
nova.flavors.list()
====

>>> nova.flavors.list()
DEBUG:keystoneauth.session:REQ: curl -g -i --cacert "/home/ubuntu/snap/openstackclients/common/root-ca.crt" -X GET https://192.168.151.115:8774/v2.1/flavors/detail -H "Accept: application/json" -H "User-Agent: python-novaclient" -H "X-Auth-Token: {SHA256}5849e99d70d26ae11c4c62e49401059c89a66c6a1172b9bd867e1b36477a07f8"
DEBUG:urllib3.connectionpool:Resetting dropped connection: 192.168.151.115
DEBUG:urllib3.connectionpool:https://192.168.151.115:8774 "GET /v2.1/flavors/detail HTTP/1.1" 200 478
DEBUG:keystoneauth.session:RESP: [200] Connection: Keep-Alive Content-Length: 478 Content-Type: application/json Date: Wed, 13 Oct 2021 15:41:02 GMT Keep-Alive: timeout=5, max=100 OpenStack-API-Version: compute 2.1 Server: Apache/2.4.41 (Ubuntu) Vary: OpenStack-API-Version,X-OpenStack-Nova-API-Version X-OpenStack-Nova-API-Version: 2.1 x-compute-request-id: req-f299ee15-cad8-429a-954c-a1b79047e35f x-openstack-request-id: req-f299ee15-cad8-429a-954c-a1b79047e35f

...