security group quota usage is wrong when the security group is deleted by admin

Bug #1260575 reported by Liyingjun
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Liyingjun

Bug Description

The quota usage for security group do not decrease when the security group is deleted by admin.

Use the attachment script to reproduce, here is what i got:

+ new_user
+ ATTEMPT_ID=27449
+ TENANT_NAME=tanant-27449
++ awk '/id/{print $4}'
++ keystone tenant-create --name tanant-27449
+ TENANT_ID=8e37a593f3234b6582f9e436a1b044c4
+ USER_NAME=user-27449
++ awk '/id/{print $4}'
++ keystone user-create --name user-27449 --tenant-id 8e37a593f3234b6582f9e436a1b044c4 --pass secret
+ USER_ID=373d946636324d53ba6161e065f68572
+ as_user nova quota-show
+ OS_USERNAME=user-27449
+ OS_TENANT_NAME=tanant-27449
+ OS_PASSWORD=secret
+ nova quota-show
+-----------------------------+-------+
| Quota | Limit |
+-----------------------------+-------+
| instances | 10 |
| cores | 20 |
| ram | 51200 |
| floating_ips | 10 |
| fixed_ips | -1 |
| metadata_items | 128 |
| injected_files | 5 |
| injected_file_content_bytes | 10240 |
| injected_file_path_bytes | 255 |
| key_pairs | 100 |
| security_groups | 10 |
| security_group_rules | 20 |
+-----------------------------+-------+
+ (( i=0 ))
+ (( i<10 ))
+ echo '** Creating security group sec-27449-0 by user-27449 **'
** Creating security group sec-27449-0 by user-27449 **
+ as_user nova secgroup-create sec-27449-0 sec-27449-0
+ OS_USERNAME=user-27449
+ OS_TENANT_NAME=tanant-27449
+ OS_PASSWORD=secret
+ nova secgroup-create sec-27449-0 sec-27449-0
+----+-------------+-------------+
| Id | Name | Description |
+----+-------------+-------------+
| 39 | sec-27449-0 | sec-27449-0 |
+----+-------------+-------------+
+ (( i++ ))
+ (( i<10 ))
+ echo '** Creating security group sec-27449-1 by user-27449 **'
** Creating security group sec-27449-1 by user-27449 **
+ as_user nova secgroup-create sec-27449-1 sec-27449-1
+ OS_USERNAME=user-27449
+ OS_TENANT_NAME=tanant-27449
+ OS_PASSWORD=secret
+ nova secgroup-create sec-27449-1 sec-27449-1
+----+-------------+-------------+
| Id | Name | Description |
+----+-------------+-------------+
| 40 | sec-27449-1 | sec-27449-1 |
+----+-------------+-------------+
+ (( i++ ))
+ (( i<10 ))
+ echo '** Creating security group sec-27449-2 by user-27449 **'
** Creating security group sec-27449-2 by user-27449 **
+ as_user nova secgroup-create sec-27449-2 sec-27449-2
+ OS_USERNAME=user-27449
+ OS_TENANT_NAME=tanant-27449
+ OS_PASSWORD=secret
+ nova secgroup-create sec-27449-2 sec-27449-2
+----+-------------+-------------+
| Id | Name | Description |
+----+-------------+-------------+
| 41 | sec-27449-2 | sec-27449-2 |
+----+-------------+-------------+
+ (( i++ ))
+ (( i<10 ))
+ echo '** Creating security group sec-27449-3 by user-27449 **'
** Creating security group sec-27449-3 by user-27449 **
+ as_user nova secgroup-create sec-27449-3 sec-27449-3
+ OS_USERNAME=user-27449
+ OS_TENANT_NAME=tanant-27449
+ OS_PASSWORD=secret
+ nova secgroup-create sec-27449-3 sec-27449-3
+----+-------------+-------------+
| Id | Name | Description |
+----+-------------+-------------+
| 42 | sec-27449-3 | sec-27449-3 |
+----+-------------+-------------+
+ (( i++ ))
+ (( i<10 ))
+ echo '** Creating security group sec-27449-4 by user-27449 **'
** Creating security group sec-27449-4 by user-27449 **
+ as_user nova secgroup-create sec-27449-4 sec-27449-4
+ OS_USERNAME=user-27449
+ OS_TENANT_NAME=tanant-27449
+ OS_PASSWORD=secret
+ nova secgroup-create sec-27449-4 sec-27449-4
+----+-------------+-------------+
| Id | Name | Description |
+----+-------------+-------------+
| 43 | sec-27449-4 | sec-27449-4 |
+----+-------------+-------------+
+ (( i++ ))
+ (( i<10 ))
+ echo '** Creating security group sec-27449-5 by user-27449 **'
** Creating security group sec-27449-5 by user-27449 **
+ as_user nova secgroup-create sec-27449-5 sec-27449-5
+ OS_USERNAME=user-27449
+ OS_TENANT_NAME=tanant-27449
+ OS_PASSWORD=secret
+ nova secgroup-create sec-27449-5 sec-27449-5
+----+-------------+-------------+
| Id | Name | Description |
+----+-------------+-------------+
| 44 | sec-27449-5 | sec-27449-5 |
+----+-------------+-------------+
+ (( i++ ))
+ (( i<10 ))
+ echo '** Creating security group sec-27449-6 by user-27449 **'
** Creating security group sec-27449-6 by user-27449 **
+ as_user nova secgroup-create sec-27449-6 sec-27449-6
+ OS_USERNAME=user-27449
+ OS_TENANT_NAME=tanant-27449
+ OS_PASSWORD=secret
+ nova secgroup-create sec-27449-6 sec-27449-6
+----+-------------+-------------+
| Id | Name | Description |
+----+-------------+-------------+
| 45 | sec-27449-6 | sec-27449-6 |
+----+-------------+-------------+
+ (( i++ ))
+ (( i<10 ))
+ echo '** Creating security group sec-27449-7 by user-27449 **'
** Creating security group sec-27449-7 by user-27449 **
+ as_user nova secgroup-create sec-27449-7 sec-27449-7
+ OS_USERNAME=user-27449
+ OS_TENANT_NAME=tanant-27449
+ OS_PASSWORD=secret
+ nova secgroup-create sec-27449-7 sec-27449-7
+----+-------------+-------------+
| Id | Name | Description |
+----+-------------+-------------+
| 46 | sec-27449-7 | sec-27449-7 |
+----+-------------+-------------+
+ (( i++ ))
+ (( i<10 ))
+ echo '** Creating security group sec-27449-8 by user-27449 **'
** Creating security group sec-27449-8 by user-27449 **
+ as_user nova secgroup-create sec-27449-8 sec-27449-8
+ OS_USERNAME=user-27449
+ OS_TENANT_NAME=tanant-27449
+ OS_PASSWORD=secret
+ nova secgroup-create sec-27449-8 sec-27449-8
+----+-------------+-------------+
| Id | Name | Description |
+----+-------------+-------------+
| 47 | sec-27449-8 | sec-27449-8 |
+----+-------------+-------------+
+ (( i++ ))
+ (( i<10 ))
+ echo '** Creating security group sec-27449-9 by user-27449 **'
** Creating security group sec-27449-9 by user-27449 **
+ as_user nova secgroup-create sec-27449-9 sec-27449-9
+ OS_USERNAME=user-27449
+ OS_TENANT_NAME=tanant-27449
+ OS_PASSWORD=secret
+ nova secgroup-create sec-27449-9 sec-27449-9
+----+-------------+-------------+
| Id | Name | Description |
+----+-------------+-------------+
| 48 | sec-27449-9 | sec-27449-9 |
+----+-------------+-------------+
+ (( i++ ))
+ (( i<10 ))
++ as_admin nova secgroup-list --all-tenants
++ OS_USERNAME=admin
++ OS_TENANT_NAME=admin
++ OS_PASSWORD=123123
++ nova secgroup-list --all-tenants
++ awk '-F|' '{print $2}'
++ grep 8e37a593f3234b6582f9e436a1b044c4
+ for id in '`as_admin nova secgroup-list --all-tenants|grep $TENANT_ID |awk -F'\''|'\'' '\''{print $2}'\''`'
+ echo '** Deleting security group 38 by admin. **'
** Deleting security group 38 by admin. **
+ as_admin nova secgroup-delete 38
+ OS_USERNAME=admin
+ OS_TENANT_NAME=admin
+ OS_PASSWORD=123123
+ nova secgroup-delete 38
ERROR: Unable to delete system group 'default' (HTTP 400) (Request-ID: req-7859a690-629d-4c5b-9da9-776132adf2e8)
+ for id in '`as_admin nova secgroup-list --all-tenants|grep $TENANT_ID |awk -F'\''|'\'' '\''{print $2}'\''`'
+ echo '** Deleting security group 39 by admin. **'
** Deleting security group 39 by admin. **
+ as_admin nova secgroup-delete 39
+ OS_USERNAME=admin
+ OS_TENANT_NAME=admin
+ OS_PASSWORD=123123
+ nova secgroup-delete 39
+----+-------------+-------------+
| Id | Name | Description |
+----+-------------+-------------+
| 39 | sec-27449-0 | sec-27449-0 |
+----+-------------+-------------+
+ for id in '`as_admin nova secgroup-list --all-tenants|grep $TENANT_ID |awk -F'\''|'\'' '\''{print $2}'\''`'
+ echo '** Deleting security group 40 by admin. **'
** Deleting security group 40 by admin. **
+ as_admin nova secgroup-delete 40
+ OS_USERNAME=admin
+ OS_TENANT_NAME=admin
+ OS_PASSWORD=123123
+ nova secgroup-delete 40
+----+-------------+-------------+
| Id | Name | Description |
+----+-------------+-------------+
| 40 | sec-27449-1 | sec-27449-1 |
+----+-------------+-------------+
+ for id in '`as_admin nova secgroup-list --all-tenants|grep $TENANT_ID |awk -F'\''|'\'' '\''{print $2}'\''`'
+ echo '** Deleting security group 41 by admin. **'
** Deleting security group 41 by admin. **
+ as_admin nova secgroup-delete 41
+ OS_USERNAME=admin
+ OS_TENANT_NAME=admin
+ OS_PASSWORD=123123
+ nova secgroup-delete 41
+----+-------------+-------------+
| Id | Name | Description |
+----+-------------+-------------+
| 41 | sec-27449-2 | sec-27449-2 |
+----+-------------+-------------+
+ for id in '`as_admin nova secgroup-list --all-tenants|grep $TENANT_ID |awk -F'\''|'\'' '\''{print $2}'\''`'
+ echo '** Deleting security group 42 by admin. **'
** Deleting security group 42 by admin. **
+ as_admin nova secgroup-delete 42
+ OS_USERNAME=admin
+ OS_TENANT_NAME=admin
+ OS_PASSWORD=123123
+ nova secgroup-delete 42
+----+-------------+-------------+
| Id | Name | Description |
+----+-------------+-------------+
| 42 | sec-27449-3 | sec-27449-3 |
+----+-------------+-------------+
+ for id in '`as_admin nova secgroup-list --all-tenants|grep $TENANT_ID |awk -F'\''|'\'' '\''{print $2}'\''`'
+ echo '** Deleting security group 43 by admin. **'
** Deleting security group 43 by admin. **
+ as_admin nova secgroup-delete 43
+ OS_USERNAME=admin
+ OS_TENANT_NAME=admin
+ OS_PASSWORD=123123
+ nova secgroup-delete 43
+----+-------------+-------------+
| Id | Name | Description |
+----+-------------+-------------+
| 43 | sec-27449-4 | sec-27449-4 |
+----+-------------+-------------+
+ for id in '`as_admin nova secgroup-list --all-tenants|grep $TENANT_ID |awk -F'\''|'\'' '\''{print $2}'\''`'
+ echo '** Deleting security group 44 by admin. **'
** Deleting security group 44 by admin. **
+ as_admin nova secgroup-delete 44
+ OS_USERNAME=admin
+ OS_TENANT_NAME=admin
+ OS_PASSWORD=123123
+ nova secgroup-delete 44
+----+-------------+-------------+
| Id | Name | Description |
+----+-------------+-------------+
| 44 | sec-27449-5 | sec-27449-5 |
+----+-------------+-------------+
+ for id in '`as_admin nova secgroup-list --all-tenants|grep $TENANT_ID |awk -F'\''|'\'' '\''{print $2}'\''`'
+ echo '** Deleting security group 45 by admin. **'
** Deleting security group 45 by admin. **
+ as_admin nova secgroup-delete 45
+ OS_USERNAME=admin
+ OS_TENANT_NAME=admin
+ OS_PASSWORD=123123
+ nova secgroup-delete 45
+----+-------------+-------------+
| Id | Name | Description |
+----+-------------+-------------+
| 45 | sec-27449-6 | sec-27449-6 |
+----+-------------+-------------+
+ for id in '`as_admin nova secgroup-list --all-tenants|grep $TENANT_ID |awk -F'\''|'\'' '\''{print $2}'\''`'
+ echo '** Deleting security group 46 by admin. **'
** Deleting security group 46 by admin. **
+ as_admin nova secgroup-delete 46
+ OS_USERNAME=admin
+ OS_TENANT_NAME=admin
+ OS_PASSWORD=123123
+ nova secgroup-delete 46
+----+-------------+-------------+
| Id | Name | Description |
+----+-------------+-------------+
| 46 | sec-27449-7 | sec-27449-7 |
+----+-------------+-------------+
+ for id in '`as_admin nova secgroup-list --all-tenants|grep $TENANT_ID |awk -F'\''|'\'' '\''{print $2}'\''`'
+ echo '** Deleting security group 47 by admin. **'
** Deleting security group 47 by admin. **
+ as_admin nova secgroup-delete 47
+ OS_USERNAME=admin
+ OS_TENANT_NAME=admin
+ OS_PASSWORD=123123
+ nova secgroup-delete 47
+----+-------------+-------------+
| Id | Name | Description |
+----+-------------+-------------+
| 47 | sec-27449-8 | sec-27449-8 |
+----+-------------+-------------+
+ for id in '`as_admin nova secgroup-list --all-tenants|grep $TENANT_ID |awk -F'\''|'\'' '\''{print $2}'\''`'
+ echo '** Deleting security group 48 by admin. **'
** Deleting security group 48 by admin. **
+ as_admin nova secgroup-delete 48
+ OS_USERNAME=admin
+ OS_TENANT_NAME=admin
+ OS_PASSWORD=123123
+ nova secgroup-delete 48
+----+-------------+-------------+
| Id | Name | Description |
+----+-------------+-------------+
| 48 | sec-27449-9 | sec-27449-9 |
+----+-------------+-------------+
+ echo '** Creating security group sec-27449-10 by user-27449 **'
** Creating security group sec-27449-10 by user-27449 **
+ as_user nova secgroup-create sec-27449-10 sec-27449-10
+ OS_USERNAME=user-27449
+ OS_TENANT_NAME=tanant-27449
+ OS_PASSWORD=secret
+ nova secgroup-create sec-27449-10 sec-27449-10
ERROR: Quota exceeded, too many security groups. (HTTP 413) (Request-ID: req-00ee6c83-232d-4fdf-94d1-cc950aacaba5)
+ set +x

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

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

Changed in nova:
status: New → In Progress
Changed in nova:
importance: Undecided → Low
Chris Behrens (cbehrens)
tags: added: icehouse-rc-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/61915
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=186e24850a1ddbc0c41499bd1bb26a41a963c806
Submitter: Jenkins
Branch: master

commit 186e24850a1ddbc0c41499bd1bb26a41a963c806
Author: liyingjun <email address hidden>
Date: Sun Mar 23 01:31:20 2014 +0800

    Fix inconsistent quota usage for security group

    The quota usage for security group do not decrease when the security
    group is deleted by admin. Fixes the issue by using the new quotas
    object.

    Change-Id: If82ee4edeca934c7be360e4129baa12b1c9a4da1
    Closes-bug: 1260575

Changed in nova:
status: In Progress → Fix Committed
Changed in nova:
milestone: none → icehouse-rc1
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: icehouse-rc1 → 2014.1
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.