neutron purge - executing command on non existing tenant returns wrong message

Bug #1580440 reported by Alex Stafeyev
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Invalid
Undecided
Bathri Ajay Raj
openstack-manuals
Fix Released
Undecided
Matt Kassawara

Bug Description

I executed " neutron purge" command with a non existing tenant ID and received the following:

neutron purge 25a1c11e26354d7dbb5b204eb1310f33
Purging resources: 100% complete.
The following resources could not be deleted: 1 network

We do not have that tenant ID so the message should be :

There is not tenant with "SPECIFIED ID" id found.

python-neutron-8.0.0-1.el7ost.noarch
openstack-neutron-8.0.0-1.el7ost.noarch
python-neutron-lib-0.0.2-1.el7ost.noarch
openstack-neutron-metering-agent-8.0.0-1.el7ost.noarch
openstack-neutron-ml2-8.0.0-1.el7ost.noarch
openstack-neutron-openvswitch-8.0.0-1.el7ost.noarch
python-neutronclient-4.1.1-2.el7ost.noarch
openstack-neutron-common-8.0.0-1.el7ost.noarch

Changed in neutron:
assignee: nobody → Bathri Ajay Raj (bathri-s)
Revision history for this message
Brian Haley (brian-haley) wrote :

It looks like you're reporting this bug against RHEL7 based on the package names you listed.

On the neutron master branch this works as expected:

$ neutron purge 123456

Tenant has no supported resources.

If you can reproduce this on a stable branch then it could just be a backport is in order.

Changed in neutron:
status: New → Incomplete
Revision history for this message
Assaf Muller (amuller) wrote :

Added John, the author of the feature.

@John, I don't see any patches to the code after the feature was merged. Can you think of a patch that would modify the behavior exhibited in the bug report?

Revision history for this message
John Davidge (john-davidge) wrote :

@Alex When you say a "non existing tenant ID" do you mean a tenant that used to exist and has been deleted, or a tenant that never existed at all? It looks to me like that ID could belong to a deleted tenant that owns a shared network, in which case the command is working as intended. Can you confirm whether there is a shared network associated with that tenant ID? This command should never return "There is not tenant with 'SPECIFIED ID' id found" or similar, as it's intended for cleaning up orphaned resources of tenants that no longer exist.

@Assaf No, it doesn't look like anything has merged which would affect this. I suspect that this bug is invalid.

Revision history for this message
Alex Stafeyev (astafeye) wrote :

@John
Hi,
Until now I did not think it does matter. In my case it was an ID of a deleted tenant if I recall correctly.
Anyhow, "Tenant has no supported resources." is not a suitable message even in a case described by @Brian. When there is not tenant, I think, this is what the message should say.

Revision history for this message
John Davidge (john-davidge) wrote :

@Alex When the tenant does not exist but has resources, the output is as you describe in the bug report. This is intended and correct. This is because neutron resources belonging to a tenant can still exist after the tenant has been deleted in keystone, or the resources could have been created with a tenant_id that has never existed in keystone.

In the case Brian describes the tenant does not exist and also has no resources. Since the existence of the tenant has no bearing on whether or not there are resources associated with it, I don't think it's relevant information to include with the output of the purge command. Especially given that the tenant_id field of a neutron resource does not have to be a valid keystone tenant ID, I don't think it should be the job of neutron purge to report on the state of keystone.

In any case, a message like "There is no tenant with "SPECIFIED ID" id found" would be misleading, as it would imply that neutron purge cannot be used in this case. We'd need two different messages to cover both cases:

1. "There is no tenant with "SPECIFIED ID" id found, and it has no support resources."
2. "Tenant has no supported resources."

Since (1) does not contain any more relevant information than (2) where the purge command is concerned, I personally don't think it would add any value, and could in fact be confusing.

Revision history for this message
Alex Stafeyev (astafeye) wrote :

@John
Tnx for the explanation it is clearer now and I understand the gap.

Regarding the messages may be we can do something like this :

"Either there is no tenant with "SPECIFIED ID" id exists, or the tenant has no support resources."

Any how ,
The logic behind the current way is much clearer now . tnx

Revision history for this message
John Davidge (john-davidge) wrote :

@Alex Sure, glad I could help clarify things.

Still though, you're proposed message wouldn't make sense for neutron purge. It would only be returned to the user in cases where the tenant has no supported resources. So a message stating that either the tenant doesn't exist or they have no resources would be incorrect. I hope that makes sense.

Revision history for this message
Assaf Muller (amuller) wrote :

Perhaps the docs should be expanded to include a couple of examples? For example what happens if you call neutron purge on a tenant that's already been deleted (I imagine a common use case) that:
a) Has resources
b) Doesn't have resources

Revision history for this message
John Davidge (john-davidge) wrote :

@Assaf neutron purge does not differentiate between tenants that do and do not exist. In fact, it never checks if the tenant is valid at all, as it only cares about what's in the tenant_id field of the neutron resource. I could certainly update the docs to make that clear. Thanks for the suggestion.

Revision history for this message
Assaf Muller (amuller) wrote :

> @Assaf neutron purge does not differentiate between tenants that do and do not exist.

I know, I reviewed the code remember :)

It is clearly a source of confusion and a couple of examples could clarify that to users that didn't look at the code (Which I would hope is the majority).

Revision history for this message
Assaf Muller (amuller) wrote :

Another thing to note would be the way we treat shared resources which was not an obvious decision at all.

Revision history for this message
John Davidge (john-davidge) wrote :

I've posted a patch to improve the documentation here:

https://review.openstack.org/#/c/321012

Please review and let me know if those changes help to clarify the expected behavior.

@Assaf Could you expand on your thoughts about shared resources? Perhaps on the doc review. Thanks

Changed in neutron:
status: Incomplete → Invalid
Revision history for this message
Assaf Muller (amuller) wrote :

@John - Done. Thank you!

Changed in openstack-manuals:
status: New → In Progress
Changed in openstack-manuals:
assignee: nobody → John Davidge (john-davidge)
Alex Stafeyev (astafeye)
summary: - neutron purge - executing command on non existing tenant print wrong
- command
+ neutron purge - executing command on non existing tenant returns wrong
+ message
Changed in openstack-manuals:
assignee: John Davidge (john-davidge) → Matt Kassawara (ionosphere80)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to openstack-manuals (master)

Reviewed: https://review.openstack.org/321012
Committed: https://git.openstack.org/cgit/openstack/openstack-manuals/commit/?id=37677ff861de75f78ecdf752a6931e13a44ee537
Submitter: Jenkins
Branch: master

commit 37677ff861de75f78ecdf752a6931e13a44ee537
Author: John Davidge <email address hidden>
Date: Wed May 25 14:55:09 2016 +0100

    [network] Improve neutron purge

    This patch makes additions to the neutron purge page to clarify
    that the command can be used with tenants that have been deleted
    or otherwise do not exist in keystone.

    It also documents the expected output when no supported resources
    are found.

    backport: mitaka
    Co-Authored-By: Matt Kassawara <email address hidden>
    Closes-Bug: 1580440
    Change-Id: I562eb081630e124d690c27ae16d13f9793c5cafe

Changed in openstack-manuals:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to openstack-manuals (stable/mitaka)

Fix proposed to branch: stable/mitaka
Review: https://review.openstack.org/336816

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to openstack-manuals (stable/mitaka)

Reviewed: https://review.openstack.org/336816
Committed: https://git.openstack.org/cgit/openstack/openstack-manuals/commit/?id=c8cb1dcc5814d131face6cc2e80bc81305976f3a
Submitter: Jenkins
Branch: stable/mitaka

commit c8cb1dcc5814d131face6cc2e80bc81305976f3a
Author: John Davidge <email address hidden>
Date: Wed May 25 14:55:09 2016 +0100

    [network] Improve neutron purge

    This patch makes additions to the neutron purge page to clarify
    that the command can be used with tenants that have been deleted
    or otherwise do not exist in keystone.

    It also documents the expected output when no supported resources
    are found.

    backport: mitaka
    Co-Authored-By: Matt Kassawara <email address hidden>
    Closes-Bug: 1580440
    Change-Id: I562eb081630e124d690c27ae16d13f9793c5cafe
    (cherry picked from commit 37677ff861de75f78ecdf752a6931e13a44ee537)

tags: added: in-stable-mitaka
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/openstack-manuals 15.0.0

This issue was fixed in the openstack/openstack-manuals 15.0.0 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.