service_type and service_name which is specified in nova_catalog_admin_info are not used

Bug #1724764 reported by takahara.kengo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
masakari
Fix Released
Undecided
takahara.kengo

Bug Description

[Bug]
When there are two endpoints v2 and v2.1, masakari execute nova api toward v2.
And then, host-failure recovery was failed.

As a result of investigating, we found that the exception occurred in the following code.
* masakari/engine/drivers/taskflow/host_failure.py
-----
    def _evacuate_and_confirm(self, context, instance, host_name,
                              failed_evacuation_instances, reserved_host=None):
        # Before locking the instance check whether it is already locked
        # by user, if yes don't lock the instance
        instance_already_locked = self.novaclient.get_server(
            context, instance.id).locked
-----

As bellow, we surrounded the get_server() call by try section in order to catch exception for debug.
-----
        try:
            instance_already_locked = self.novaclient.get_server(
                context, instance.id).locked
        except:
            import sys
            LOG.info(sys.exc_info())
-----

And then we found that the AttributeError was occurred.
(<type 'exceptions.AttributeError'>, AttributeError('locked',), <traceback object at 0x7fd7a1adbb90>)

[Environment]
There are both nova v2 endpoint and nova v2.1 endpoint.
v2 endpoint is opend to end users. And v2.1 endpoint is used only by masakari.
+-------------+---------------------------------------------------------------------------+
| novav21 | Value |
+-------------+---------------------------------------------------------------------------+
| adminURL | http://not.defined/ |
| id | 7b7d2578a22e42a2992a00d47a805827 |
| internalURL | http://****/v2.1/aee85dff980f4b0f94bed7861765acc7 |
| publicURL | http://not.defined/ |
| region | RegionOne |
+-------------+---------------------------------------------------------------------------+
+-------------+----------------------------------------------------------------------------+
| nova | Value |
+-------------+----------------------------------------------------------------------------+
| adminURL | https://****/v2/aee85dff980f4b0f94bed7861765acc7 |
| id | 468f6393fd2e429fac5d99eafbc73ab4 |
| internalURL | http://****/v2/aee85dff980f4b0f94bed7861765acc7 |
| publicURL | https://****/v2/aee85dff980f4b0f94bed7861765acc7 |
| region | RegionOne |
+-------------+----------------------------------------------------------------------------+
"****" is mask. Original endpoint url is valid.

And masakari.conf is set as bellow.
-----
 Match this value when searching for nova in the service catalog. Format is:
# separated values of the form: <service_type>:<service_name>:<endpoint_type>
# (string value)
#nova_catalog_admin_info = compute:Compute Service:publicURL
nova_catalog_admin_info = computev21:novav21:internalURL
-----

[Cause of the bug]
Masakari should use v2.1 since masakari.conf is set as described in [Environment].
But masakari-engine executed evacuate with v2 instead of v2.1.

So we modified the code masakari/compute/nova.py as bellow.
And then, evacuation succeeded.
-----
$ diff -u masakari/compute/nova.py.org masakari/compute/nova.py
--- masakari/compute/nova.py.org 2017-10-13 14:24:25.976000000 +0900
+++ masakari/compute/nova.py 2017-10-19 15:52:35.492000000 +0900
@@ -124,6 +124,8 @@
         global_request_id=context.global_id,
         region_name=CONF.os_region_name,
         endpoint_type=endpoint_type,
+ service_type=service_type,
+ service_name=service_name,
         cacert=CONF.nova_ca_certificates_file,
         extensions=nova_extensions)
-----
service_type and service_name were not used before modifying the code.
However, I think that they should be used as arguments when masakari creates a novaclient object.

Changed in masakari:
assignee: nobody → takahara.kengo (takahara.kengo)
Revision history for this message
takahara.kengo (takahara.kengo) wrote :

This bug was happend in the below environment.

* There are both nova v2 endpoint and nova v2.1 endpoint.
** v2 endpoint is opend to end users.
** v2.1 endpoint is used only by masakari.

+-------------+---------------------------------------------------------------------------+
| novav21 | Value |
+-------------+---------------------------------------------------------------------------+
| adminURL | http://not.defined/ |
| id | 7b7d2578a22e42a2992a00d47a805827 |
| internalURL | http://****/v2.1/aee85dff980f4b0f94bed7861765acc7 |
| publicURL | http://not.defined/ |
| region | RegionOne |
+-------------+---------------------------------------------------------------------------+
+-------------+----------------------------------------------------------------------------+
| nova | Value |
+-------------+----------------------------------------------------------------------------+
| adminURL | https://****/v2/aee85dff980f4b0f94bed7861765acc7 |
| id | 468f6393fd2e429fac5d99eafbc73ab4 |
| internalURL | http://****/v2/aee85dff980f4b0f94bed7861765acc7 |
| publicURL | https://****/v2/aee85dff980f4b0f94bed7861765acc7 |
| region | RegionOne |
+-------------+----------------------------------------------------------------------------+

"****" is mask. Original endpoint url is valid.

description: updated
description: updated
description: updated
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to masakari (master)

Reviewed: https://review.openstack.org/513299
Committed: https://git.openstack.org/cgit/openstack/masakari/commit/?id=99dd18d053dd0b06b959eae63b25f423ad9df19b
Submitter: Zuul
Branch: master

commit 99dd18d053dd0b06b959eae63b25f423ad9df19b
Author: Kengo Takahara <email address hidden>
Date: Thu Oct 19 16:41:33 2017 +0900

    Use service_type and service_name of nova_catalog_admin_info

    Masakari has never used service_type and service_name of
    nova_catalog_admin_info. However, these can be specified
    when masakari creates a novalient object.
    This patch modified so that masakari uses these.

    Change-Id: I7fdd3b47230bea004a9129234c88d20d611814bf
    Closes-Bug: #1724764

Changed in masakari:
status: New → Fix Released
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.