Non managed Instance deleted during create

Bug #1350790 reported by Kravchenko Pavel
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Opinion
Wishlist
Unassigned

Bug Description

When you have on compute node unmanaged instance (not created with OS) it would be expected that it's ignored by OpenStack, but in case when it's name (e.g. instance-00000015) is same as the name openstack allocated to the new instance it will act very bad.

At first attempt the deployment will fail, and the unmanaged instance will be destroyed (probably because compute wants to remove leftovers of the failed deployment). After that at the next attempt the instance will be created.

At the end user will have a new instance managed by openstack that replaced former unmanaged instance (has same name) in libvirt without single notification to user.

Tags: libvirt
Tracy Jones (tjones-i)
tags: added: libvirt
Revision history for this message
Thang Pham (thang-pham) wrote :

Might be a simple fix: verify that the domain name does not exist before attempting to create the domain. However, there might be a performance hit, since there is an extra look up now :(

Changed in nova:
assignee: nobody → Thang Pham (thang-pham)
importance: Undecided → Low
Revision history for this message
Kravchenko Pavel (kravchenko-pavel) wrote :

Few concerns:
Should it fully fail the deployment in this case giving some appropriate message to the user?
If not, should the instance generated name be regenerated and updated in db to continue the deployment on retry (maybe instead the instance could be destroyed in db and created again)?
Not sure if it's only libvirt case, maybe other drivers affected as well.

Revision history for this message
Kravchenko Pavel (kravchenko-pavel) wrote :

I think your simple fix will work.
The real problem is that "build_and_run_instance" missing the call to _prebuild_instance that contains the driver call for _check_instance_exists.

Revision history for this message
Thang Pham (thang-pham) wrote :

I digged into this a little more, and here is what I found:
    1. The instance name is determined by instance_name_template in nova.conf, e.g. instance_name_template = instance-%08x.
    2. The digit appended at the end (i.e. %08x) is determined by the id column in the nova.instances table, which is set to auto_increment.
It is unlikely that you can regenerate the instance name without actually destroying the instance.

A possible solution, as you indicated above, is to perform _check_instance_exists in nova/compute/manager.py _build_and_run_instance. However, as I observed (with _check_instance_exists in place), it will fail on create an instance if there is an existing instance of the same name in libvirt. When you go to destroy the instance, it will destroy the existing instance, which is not what you want to happen.

It must say somewhere that you should select an instance_name_template that does not conflict with existing naming schemes, so that this case would not occur. Since this is very unlikely to occur, I do not believe that it is worth fixing this bug because it might be more trouble than it is worth, but that is just my opinion. If you have another suggestion or want to fix it, please take the bug and assign it to yourself.

Changed in nova:
assignee: Thang Pham (thang-pham) → nobody
Sean Dague (sdague)
Changed in nova:
status: New → Opinion
importance: Low → Wishlist
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.