Human_id does not correspond to the same field when creating datamodel and updating datamodel

Bug #1833665 reported by chenker
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
watcher
Fix Released
Medium
chenker

Bug Description

In nova, the values of instance.name and instance.display_name are the same[1][2].
But they are different from the value of human_id[3].

Now Watcher creates datamodel use "human_id: instance.human_id".
This instance.human_id is from novaclient. In novaclient, human_id
have a little different with instance.name, beacuse it will do a case
conversion[3].

When updating datamodel, Watcher user the 'display_name' from notification
to update human_id[4].

Therefore, the value of human_id is not reliable.

[1]. https://github.com/openstack/nova/blob/master/nova/api/openstack/compute/servers.py#L685
[2]. https://github.com/openstack/nova/blob/master/nova/notifications/objects/instance.py#L31
[3]. https://github.com/openstack/python-novaclient/blob/master/novaclient/base.py#L152
[4]. https://github.com/openstack/watcher/blob/master/watcher/decision_engine/model/notification/nova.py#L77

chenker (chenker)
Changed in watcher:
importance: Undecided → Medium
status: New → In Progress
Revision history for this message
chenker (chenker) wrote :

The solution is to add a 'name' field to save the name of the
instance, and ensure that the value of this field is the same
when the datamodel is created and when the datamodel is updated.

About the 'human_id', We will remove it in the future.

Revision history for this message
Matt Riedemann (mriedem) wrote :

> In nova, the values of instance.name and instance.display_name are the same[1][2].

I see what you're saying but it could be confused from a nova standpoint because the nova.objects.Instance.name attribute is actually not the display_name in the notification (or what the user provided when creating or updating the server), it's generated based on config:

https://github.com/openstack/nova/blob/707deb158996d540111c23afd8c916ea1c18906a/nova/objects/instance.py#L284

That gets exposed out of the REST API with the OS-EXT-SRV-ATTR:instance_name parameter:

https://github.com/openstack/nova/blob/707deb158996d540111c23afd8c916ea1c18906a/nova/api/openstack/compute/views/servers.py#L290

But the novaclient.v2.servers.Server.name is the display name provided by the user that is correct:

https://github.com/openstack/nova/blob/707deb158996d540111c23afd8c916ea1c18906a/nova/api/openstack/compute/views/servers.py#L215

Revision history for this message
chenker (chenker) wrote :

Sorry, I didn't describe it clearly above. instance.name refers to the name what the user provided when creating or updating the server, not OS-EXT-SRV-ATTR:instance_name.

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

Reviewed: https://review.opendev.org/660295
Committed: https://git.openstack.org/cgit/openstack/watcher/commit/?id=b62965c2bf2706eb1ec5dd3e12bc8c339a98364e
Submitter: Zuul
Branch: master

commit b62965c2bf2706eb1ec5dd3e12bc8c339a98364e
Author: chenke <email address hidden>
Date: Tue May 21 16:28:23 2019 +0800

    Add name for instance in Watcher datamodel

    Now Watcher's datamodel uses human_id to store the display_name
    of the intance. But the value of human_id is not reliable. About
    the reason, please see[1].

    The solution is to add a 'name' field to save the display_name of
    the instance, and ensure that the value of this field is the same
    when the datamodel is created and when the datamodel is updated.

    About the 'human_id', We will remove it in the future.

    References:
    [1]. https://bugs.launchpad.net/watcher/+bug/1833665

    20190619 Watcher meeting IRC Log:
    [1]. http://eavesdrop.openstack.org/irclogs/%23openstack-watcher/%23openstack-watcher.2019-06-19.log.html
    [2]. http://eavesdrop.openstack.org/meetings/watcher/2019/watcher.2019-06-19-08.00.log.html#l-47

    Change-Id: I6976759629a4feedee09261cc1dac935e050202a
    Closes-Bug: #1833665

Changed in watcher:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to watcher (master)

Related fix proposed to branch: master
Review: https://review.opendev.org/669607

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

Reviewed: https://review.opendev.org/669607
Committed: https://git.openstack.org/cgit/openstack/watcher/commit/?id=6dd35a00580cf5b8de79ac8f9dc06cf143b5f819
Submitter: Zuul
Branch: master

commit 6dd35a00580cf5b8de79ac8f9dc06cf143b5f819
Author: chenke <email address hidden>
Date: Mon Jul 8 14:13:32 2019 +0800

    Remove redundant human_id fields when creating and updating datamodel

    For the reason, please see:
    [1]. http://eavesdrop.openstack.org/irclogs/%23openstack-watcher/%23openstack-watcher.2019-06-19.log.html
    [2]. http://eavesdrop.openstack.org/meetings/watcher/2019/watcher.2019-06-19-08.00.log.html#l-47

    Change-Id: I4284397aa987565f4cfc2697907a879d7d6492e9
    Related-Bug: #1833665

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/watcher 3.0.0.0rc1

This issue was fixed in the openstack/watcher 3.0.0.0rc1 release candidate.

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.