batch delete resoures

Bug #1585262 reported by gordon chung
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Gnocchi
Fix Released
Wishlist
PeterZhang
python-gnocchiclient
Fix Released
Wishlist
fengchaoyang

Bug Description

there are potentially millions of different resources that Gnocchi can track. it would be nice to have a way to delete more than one resource at a time. i don't have a recommendation on how to do this. ids? matching query? generic ttl?

Julien Danjou (jdanjou)
Changed in gnocchi:
status: New → Triaged
Revision history for this message
zhangguoqing (474751729-o) wrote :

Yes, that's good! And I think the matching query with attribute_filter is the better choice. :)

Changed in gnocchi:
assignee: nobody → zhaozhilong (zhaozhilong)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to gnocchi (master)

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

Changed in gnocchi:
assignee: zhaozhilong (zhaozhilong) → PeterZhang (zhangshengping2012)
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on gnocchi (master)

Change abandoned by gordon chung (<email address hidden>) on branch: master
Review: https://review.openstack.org/350479
Reason: https://review.openstack.org/#/c/351043

Changed in gnocchi:
assignee: PeterZhang (zhangshengping2012) → Mehdi Abaakouk (sileht)
Changed in gnocchi:
assignee: Mehdi Abaakouk (sileht) → PeterZhang (zhangshengping2012)
Changed in gnocchi:
assignee: PeterZhang (zhangshengping2012) → Julien Danjou (jdanjou)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to gnocchi (master)

Reviewed: https://review.openstack.org/351043
Committed: https://git.openstack.org/cgit/openstack/gnocchi/commit/?id=db2afd16939dcd9a01cc644b5e299aa958718ecc
Submitter: Jenkins
Branch: master

commit db2afd16939dcd9a01cc644b5e299aa958718ecc
Author: shengping zhang <email address hidden>
Date: Thu Aug 4 15:29:14 2016 +0800

    This patch is used to delete batch of resources

    1. Add a method delete in gnocchi/rest/__init__.py to
       accept an attribute filter to delete matched resources.
    2. Add method delete_resources in gnocchi/indexer/sqlalchemy.py
       to delete related data in db.
    3. Add a new rule in policy.
    4. Add document to descrbe the functions

    The HTTP request for deleting a batch of resources by ids
    is looks like:

        DELETE /v1/resource/<resource_type>
            Content-Type: application/json

                    {"in": {"id":[xx_id,yy_id...]}}.

    The HTTP request for deleting a batch of resources filter
    by resources started_data is looks like:

        DELETE /v1/resource/<resource_type>
            Content-Type: application/json

                    {">=": {"started_data": "2016-08-24"}}

    Or even more complicated for deleing a batch of resources:

        DELETE /v1/resource/<resource_type>
            Content-Type: application/json
                    {
                      "and": [
                         {">=": {"started_data":"2016-08-06"}},
                         {"=":{"id":"xxxx_id"}}
                            ]
                    }

    TODO:
        An corresponding gnocchi client CLI needs to
        be added later.

    Partial-Bug: #1585262

    Co-Authored-By: Mehdi Abaakouk <email address hidden>

    Change-Id: I2a21c9e76fe08819b60e1a198335213c3b32e96f

gordon chung (chungg)
Changed in gnocchi:
assignee: Julien Danjou (jdanjou) → PeterZhang (zhangshengping2012)
status: In Progress → Fix Released
Julien Danjou (jdanjou)
Changed in gnocchi:
milestone: none → 3.0.0
Changed in python-gnocchiclient:
assignee: nobody → fengchaoyang (fengchaoyang)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-gnocchiclient (master)

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

Changed in python-gnocchiclient:
status: New → In Progress
Julien Danjou (jdanjou)
Changed in python-gnocchiclient:
importance: Undecided → Wishlist
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-gnocchiclient (master)

Reviewed: https://review.openstack.org/390270
Committed: https://git.openstack.org/cgit/openstack/python-gnocchiclient/commit/?id=987ed3983c01cfe9029c40c035c9e992d90fdc27
Submitter: Jenkins
Branch: master

commit 987ed3983c01cfe9029c40c035c9e992d90fdc27
Author: fengchaoyang <email address hidden>
Date: Mon Oct 24 19:41:04 2016 +0800

    Add "batch delete resource client"

    example:
    input:
      gnocchi resource batch delete
      "id in [239d7f33-984e-5dee-8550-a4ed32a632f0,
      078aad64-2b7a-50ba-93d8-2fedd62b46e6,
      bdaaeec7-3307-52cd-90d4-bfb8c97eb45d]"
      --type instance
    output:
      +---------+-------+
    | Field | Value |
    +---------+-------+
    | deleted | 0 |
    +---------+-------+

    Change-Id: I3718e4990e306be723f8c888430ff28232a695ea
    Closes-Bug: #1585262

Changed in python-gnocchiclient:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-gnocchiclient 2.7.0

This issue was fixed in the openstack/python-gnocchiclient 2.7.0 release.

Julien Danjou (jdanjou)
Changed in python-gnocchiclient:
milestone: none → 2.7.0
status: Fix Committed → 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.