Volume Type deletion should not be allowed if volumes present with that type

Bug #1215329 reported by Swapnil Kulkarni
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
High
Unassigned

Bug Description

Currently the volume type deletion is allowed irrespective of volume present with the type or not. There should be a check for volumes present.
If the volumes are present for particular type it should throw an error restricting the type delete.
If there are no volumes present for the type, it should delete the type.

Changed in cinder:
assignee: nobody → Swapnil Kulkarni (swapnil.kulkarni)
Revision history for this message
John Griffith (john-griffith) wrote :

Swapnil, this seems like an appropriate answer, the only thing is we would need/want some way to disable said type so that further creates aren't issued. Perhaps quotas would be the correct way to go about this.

This may just just be a documenation task as far as disabling through quota managment, but regardless this is a change in behavior that we'll want to make sure we document. Be sure to add the doc-impact tag to the commit message please.

Thanks,
John

tags: added: documentation
Changed in cinder:
status: New → Triaged
importance: Undecided → High
milestone: none → havana-3
Revision history for this message
Swapnil Kulkarni (coolsvap-deactivatedaccount) wrote :

Updated volume_type_destroy method to throw exception for volume type delete with associated volumes.

Added method to retrieve volumes associated with type.

Following are the unit test results after changes

# cinder type-list
+--------------------------------------+----------+
| ID | Name |
+--------------------------------------+----------+
| 5933b988-f474-40d7-a525-9e03180eb1ba | LUKS |
| 5a0f9245-099b-463e-9643-c1630e9ea745 | dm-crypt |
| e4bf8b60-34a1-446b-b5c6-412ac6053034 | lvm |
+--------------------------------------+----------+

# cinder list
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
| ID | Status | Display Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
| 821e43be-afa0-47fe-a301-bb0fb0397348 | available | newlvmvol | 1 | lvm | False | |
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+

# cinder type-delete e4bf8b60-34a1-446b-b5c6-412ac6053034
ERROR: Volume Type deletion is not allowed with volumes present with the type.

# cinder delete 821e43be-afa0-47fe-a301-bb0fb0397348
# cinder list
+----+--------+--------------+------+-------------+----------+-------------+
| ID | Status | Display Name | Size | Volume Type | Bootable | Attached to |
+----+--------+--------------+------+-------------+----------+-------------+
+----+--------+--------------+------+-------------+----------+-------------+
# cinder type-delete e4bf8b60-34a1-446b-b5c6-412ac6053034
# cinder type-list
+--------------------------------------+----------+
| ID | Name |
+--------------------------------------+----------+
| 5933b988-f474-40d7-a525-9e03180eb1ba | LUKS |
| 5a0f9245-099b-463e-9643-c1630e9ea745 | dm-crypt |
+--------------------------------------+----------+

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

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

Revision history for this message
Swapnil Kulkarni (coolsvap-deactivatedaccount) wrote :

Please review the code changes and also let me know how to add the tags in commit messages. I have unit tested them, but I dont wanted to add any information in commit message, for which I dont know the syntax.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Thierry Carrez (ttx)
Changed in cinder:
milestone: havana-3 → havana-rc1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/44258
Committed: http://github.com/openstack/cinder/commit/0278a38153f9649aab1cc641bfabd8d5738d2d8c
Submitter: Jenkins
Branch: master

commit 0278a38153f9649aab1cc641bfabd8d5738d2d8c
Author: Swapnil Kulkarni <email address hidden>
Date: Mon Sep 2 22:06:02 2013 +0530

    Restrict Volume type deletion with volumes assoc

    Updated volume_type_destroy method to throw exception
    for volume type delete with associated volumes.

    Updated volume_type unit tests

    Closes-Bug: #1215329

    tag:doc-impact

    Change-Id: I7a5d4b473588757d21b461337df493e8046e1d09

Changed in cinder:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in cinder:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in cinder:
milestone: havana-rc1 → 2013.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.