Delete flavor should raise error, if it is inuse (any existing vms booted with this flavor)

Bug #1456196 reported by Noel Nelson Dsouza
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Won't Fix
Undecided
Noel Nelson Dsouza

Bug Description

Version : Juno Devstack

Steps to reproduce.

Step1 : Create an instance with m1.tiny flavor.

stack@onecloud-Standard-PC-i440FX-PIIX-1996:~/nova/nova/compute$ nova boot --image cirros-0.3.4-x86_64-uec --flavor m1.tiny vm1

+--------------------------------------+----------------------------------------------------------------+
| Property | Value |
+--------------------------------------+----------------------------------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | nova |
| OS-EXT-SRV-ATTR:host | - |
| OS-EXT-SRV-ATTR:hypervisor_hostname | - |
| OS-EXT-SRV-ATTR:instance_name | instance-00000006 |
| OS-EXT-STS:power_state | 0 |
| OS-EXT-STS:task_state | scheduling |
| OS-EXT-STS:vm_state | building |
| OS-SRV-USG:launched_at | - |
| OS-SRV-USG:terminated_at | - |
| accessIPv4 | |
| accessIPv6 | |
| adminPass | Uaypcj6qKzbr |
| config_drive | |
| created | 2015-05-18T12:38:25Z |
| flavor | m1.tiny (6) |
| hostId | |
| id | 7b4fdada-6900-4836-9de7-3bda0f13dabf |
| image | cirros-0.3.4-x86_64-uec (a49af497-e336-4c5a-8508-6dabb70fe261) |
| key_name | - |
| metadata | {} |
| name | vm1 |
| os-extended-volumes:volumes_attached | [] |
| progress | 0 |
| security_groups | default |
| status | BUILD |
| tenant_id | d5a7933dfa98430abf7fcc37ff2661b1 |
| updated | 2015-05-18T12:38:26Z |
| user_id | a20aaf87a4344985ae17e378065858ed |
+--------------------------------------+----------------------------------------------------------------+

Before deleting flavor please note the above output.

Step 2: Once instance gets active delete the m1.tiny flavor.

stack@onecloud-Standard-PC-i440FX-PIIX-1996:~/nova/nova/compute$ nova flavor-delete m1.tiny
+----+------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+----+------+-----------+------+-----------+------+-------+-------------+-----------+
| 6 | m1.tiny | 512 | 1 | 0 | | 1 | 1.0 | True |
+----+------+-----------+------+-----------+------+-------+-------------+-----------+

Step 3 : Nova show vmname after deleting the flavor.

stack@onecloud-Standard-PC-i440FX-PIIX-1996:~/nova/nova/compute$ nova show vm1
+--------------------------------------+----------------------------------------------------------------+
| Property | Value |
+--------------------------------------+----------------------------------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | nova |
| OS-EXT-SRV-ATTR:host | onecloud-Standard-PC-i440FX-PIIX-1996 |
| OS-EXT-SRV-ATTR:hypervisor_hostname | onecloud-Standard-PC-i440FX-PIIX-1996 |
| OS-EXT-SRV-ATTR:instance_name | instance-00000006 |
| OS-EXT-STS:power_state | 1 |
| OS-EXT-STS:task_state | - |
| OS-EXT-STS:vm_state | active |
| OS-SRV-USG:launched_at | 2015-05-18T12:38:30.000000 |
| OS-SRV-USG:terminated_at | - |
| accessIPv4 | |
| accessIPv6 | |
| config_drive | True |
| created | 2015-05-18T12:38:25Z |
| flavor | m1.tiny (6) |
| hostId | b2f6e09e63c5ae998e9ad50cca85ac7ba506cee9159da4418e8893de |
| id | 7b4fdada-6900-4836-9de7-3bda0f13dabf |
| image | cirros-0.3.4-x86_64-uec (a49af497-e336-4c5a-8508-6dabb70fe261) |
| key_name | - |
| metadata | {} |
| name | vm1 |
| os-extended-volumes:volumes_attached | [] |
| private network | 10.0.0.2 |
| progress | 0 |
| security_groups | default |
| status | ACTIVE |
| tenant_id | d5a7933dfa98430abf7fcc37ff2661b1 |
| updated | 2015-05-18T12:38:31Z |
| user_id | a20aaf87a4344985ae17e378065858ed |
+--------------------------------------+----------------------------------------------------------------+

Please note after deleting flavor, nova show command output above.

flavor -- m1.tiny (6) still displaying the same before and after.

Regards
Noel

Revision history for this message
Xav Paice (xavpaice) wrote :

The old flavors, after having been deleted, still exist in the instance_types table, so this isn't necessarily a problem.

However, if a flavor is deleted, then the instance based on that deleted flavor is migrated, the migration fails.

Should we be discussing a check to make sure a flavor isn't in use before deleting, or making it possible to use deleted flavors for existing instances?

Revision history for this message
Bharat Kumar Kobagana (bharat-kobagana) wrote :

I agree with Xav Paice,

Raising error when flavor doesn't exist is incorrect.
We can adress the same issue by "Raising error while deleting flavor, if the flavor in in use(vms already booted with this flavor)."

summary: - Nova show command should throw an error if flavor doesnot exist
+ Delete flavor should raise error, if it is in use (any existing vms
+ booted with this flavor)
summary: - Delete flavor should raise error, if it is in use (any existing vms
+ Delete flavor should raise error, if it is inuse (any existing vms
booted with this flavor)
Changed in nova:
status: New → Confirmed
Changed in nova:
assignee: nobody → Bhavaniprasad (bhavaniprasadadapaka)
Revision history for this message
Harshada Mangesh Kakad (harshada-kakad) wrote :

Are you working on this bug Bhavaniprasad else I would like to pick this.

Revision history for this message
Noel Nelson Dsouza (noelnelson) wrote : Re: [Bug 1456196] Re: Delete flavor should raise error, if it is inuse (any existing vms booted with this flavor)
Download full text (8.0 KiB)

*I am not working on that. I have provided the patch for some other bug,
that should be solution this bug also.. *

On Mon, Jun 15, 2015 at 3:21 PM, Harshada Mangesh Kakad <
<email address hidden>> wrote:

> Are you working on this bug Bhavaniprasad else I would like to pick
> this.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1456196
>
> Title:
> Delete flavor should raise error, if it is inuse (any existing vms
> booted with this flavor)
>
> Status in OpenStack Compute (Nova):
> Confirmed
>
> Bug description:
> Version : Juno Devstack
>
> Steps to reproduce.
>
> Step1 : Create an instance with m1.tiny flavor.
>
> stack@onecloud-Standard-PC-i440FX-PIIX-1996:~/nova/nova/compute$ nova
> boot --image cirros-0.3.4-x86_64-uec --flavor m1.tiny vm1
>
>
> +--------------------------------------+----------------------------------------------------------------+
> | Property | Value
> |
>
> +--------------------------------------+----------------------------------------------------------------+
> | OS-DCF:diskConfig | MANUAL
> |
> | OS-EXT-AZ:availability_zone | nova
> |
> | OS-EXT-SRV-ATTR:host | -
> |
> | OS-EXT-SRV-ATTR:hypervisor_hostname | -
> |
> | OS-EXT-SRV-ATTR:instance_name | instance-00000006
> |
> | OS-EXT-STS:power_state | 0
> |
> | OS-EXT-STS:task_state | scheduling
> |
> | OS-EXT-STS:vm_state | building
> |
> | OS-SRV-USG:launched_at | -
> |
> | OS-SRV-USG:terminated_at | -
> |
> | accessIPv4 |
> |
> | accessIPv6 |
> |
> | adminPass | Uaypcj6qKzbr
> |
> | config_drive |
> |
> | created | 2015-05-18T12:38:25Z
> |
> | flavor | m1.tiny (6)
> |
> | hostId |
> |
> | id |
> 7b4fdada-6900-4836-9de7-3bda0f13dabf |
> | image | cirros-0.3.4-x86_64-uec
> (a49af497-e336-4c5a-8508-6dabb70fe261) |
> | key_name | -
> |
> | metadata | {}
> |
> | name | vm1
> |
> | os-extended-volumes:volumes_attached | []
> ...

Read more...

Revision history for this message
Jeffrey Zhang (jeffrey4l) wrote :

is anybody still working on this? I want to take over this.

Revision history for this message
Markus Zoeller (markus_z) (mzoeller) wrote :

@Jeffrey Zhang:
If this bug is still valid and since there doesn't seem to be a patch set for 2 months, I think it is fair to take over from Bhavaniprasad.

@Bhavaniprasad:
I couldn't find your IRC handle in your Launchpad account to ask you directly.

Changed in nova:
assignee: Bhavaniprasad (bhavaniprasadadapaka) → nobody
Revision history for this message
Markus Zoeller (markus_z) (mzoeller) wrote :

A related bug to this is bug 1485767.

Revision history for this message
jichenjc (jichenjc) wrote :

unless we have a reference count mechanism, it's hard to prevent this action
and flavor belongs to admin usually, instance belongs to user usually, user actions might not block admin's

This is not very related , but I guess here some changes are helpful to the resize case for the old, new flavor stuff?
http://specs.openstack.org/openstack/nova-specs/specs/kilo/approved/flavor-from-sysmeta-to-blob.html

Changed in nova:
assignee: nobody → Noel Nelson Dsouza (noelnelson)
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/217674

Changed in nova:
status: Confirmed → In Progress
Revision history for this message
Andrew Laski (alaski) wrote :

Not allowing the deletion of flavors seems like the wrong approach to me. Instead I think we could consider exposing flavor information with the instance rather than just exposing a flavor id for a flavor which may no longer exist. We store a copy of flavor information in the instance_extra table so it would be easy enough to get access to it. However this solution or that solution would need a spec so that we can discuss the proper approach to this problem. If you are unfamiliar with the process there is some documentation on it at http://git.openstack.org/cgit/openstack/nova-specs/tree/README.rst

Sean Dague (sdague)
Changed in nova:
status: In Progress → Confirmed
status: Confirmed → Won't Fix
Revision history for this message
Matt Riedemann (mriedem) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by Matt Riedemann (<email address hidden>) on branch: master
Review: https://review.openstack.org/217674
Reason: See https://review.openstack.org/#/c/265282/

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related blueprints

Remote bug watches

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