Should not delete host of another segment

Bug #1697629 reported by Eric Xie
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
masakari
Fix Released
Undecided
Dinesh Bhor

Bug Description

Description
===========
When i delete one host which not belongs to the segment in the url,
the operation was successful. The host was deleted.

Steps to reproduce
==================
* Create two segments
POST /v1/segments
{
  "segments": [
    {
      "uuid": "968632d6-6312-4480-91e0-5d471d45f15e",
       ...
    },
    {
      "uuid": "02481858-812a-4592-b333-49627aeec929",
      ...
    }
  ]
}
* Create one host '6219e981-f4f3-4573-a515-b7add6549684' of '968632d6-6312-4480-91e0-5d471d45f15e'
POST /v1/segments/<segment_uuid>/hosts
* Delete host '6219e981-f4f3-4573-a515-b7add6549684' with segment uuid '02481858-812a-4592-b333-49627aeec929'
DELETE /v1/segments/<segment_uuid>/hosts

Expected result
===============
The host can not be deleted.

Actual result
=============
The host was deleted.

Environment
===========
# ENV
devstack

# version
- devstack:
git log
commit 9234316794403e6ec422c3c9a766edbb1bae180f
Merge: 1ca22d5 bb436d3
Author: Jenkins <email address hidden>
Date: Fri Jun 9 01:55:36 2017 +0000

    Merge "Make use of Ubuntu Cloud Archive switchable"

- masakari:
$ git log
commit 00969f0bf21e5d3eda0f196dba2fd63abc7b28e9
Merge: 1e5fab1 171b4d2
Author: Jenkins <email address hidden>
Date: Tue Jun 6 05:08:01 2017 +0000

    Merge "Revert "Fix os_privileged_user_auth_url""

Revision history for this message
Eric Xie (eric-xie) wrote :
Changed in masakari:
assignee: nobody → Eric Xie (eric-xie)
status: New → In Progress
Revision history for this message
Dinesh Bhor (dinesh-bhor) wrote :

Hi Eric,

Are you working on this?
If not please let me know I can take up this.

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

Fix proposed to branch: master
Review: https://review.openstack.org/481515

Changed in masakari:
assignee: Eric Xie (eric-xie) → Dinesh Bhor (dinesh-bhor)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to masakari (master)

Reviewed: https://review.openstack.org/481515
Committed: https://git.openstack.org/cgit/openstack/masakari/commit/?id=a1bbcd4d985439aa94cc95fcb19c08e30a584d30
Submitter: Jenkins
Branch: master

commit a1bbcd4d985439aa94cc95fcb19c08e30a584d30
Author: Dinesh Bhor <email address hidden>
Date: Wed Jul 5 17:05:55 2017 +0530

    Fix 'host delete' delete's host of another segment

    Currently masakari delete's the host which doesn't belong to the
    segment requested in the 'host delete' API's request URL because
    host was not getting filtered on the basis of failover_segment_id.

    Filtered the host based on 'failover_segment_id'. Added a new
    exception 'HostNotFoundUnderFailoverSegment' which will be raised
    from db API 'host_get_by_uuid' if the host is not found under the
    requested failover_segment. This exception is not caught at API
    controller layer as it is a subclass of 'HostNotFound' which is
    already caught in controller.

    Closes-Bug: #1697629
    Change-Id: I3d3e8cffa2f8ea443ccd13b1db61fda55bc07a0d

Changed in masakari:
status: In Progress → 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.