instance name already exists error when launch a new instance

Asked by Daniel Fu

    I launched 3 instances successfully, with nova.conf instance_name_template=newTest-%08x, so the instance names would be: newTest-00000001, newTest-00000002, newTest-00000003. (I'm using powervm for testing, but this situation may happen on other platforms, in my case, the instances are in the hypervisor, not on my computer)

    the problem is: when I restart my computer, without deleting the instances.
    and then rerun openstack and launch instance, with the same config file, error ocures:

2013-05-14 14:48:37 TRACE nova.openstack.common.rpc.amqp raise exception.InstanceExists(name=instance['name'])
2013-05-14 14:48:37 TRACE nova.openstack.common.rpc.amqp InstanceExists: Instance newTest-00000001 already exists.

 newTest-00000001 still exists in hypervisor, but the default name will set from newTest-00000001, conflict occurs. after 3 times of error launching, the name would be newTest-00000004, then the fouth time of launching will success.

  I know it is because when my computer shut down, the data store in database would be lost, but the instances launched before would still in the hypervisor, so next time the openstack running, the local database is clean, and the instance name will begin with newTest-00000001, and confict with the instance name on the hypervisor.

  but does anyone know how to fix this problem, without deleting everthing I launched in the hypervisor? is this a bug? or I've done something wrong?

Question information

Language:
English Edit question
Status:
Solved
For:
OpenStack Compute (nova) Edit question
Assignee:
No assignee Edit question
Solved by:
Guangya Liu (Jay Lau)
Solved:
Last query:
Last reply:
Revision history for this message
Guangya Liu (Jay Lau) (jay-lau-513) said :
#1

Hi Daniel,

Are you using devstack? Which version of OpenStack are you using?

Can you describe your environment more clear?

Revision history for this message
Daniel Fu (lifubj) said :
#2

Hi, Jay,
Yes I'm using devstack to build Openstack on Ubuntu12.04.
Any more info do I need to provide, please let me know. thanks.

Revision history for this message
Guangya Liu (Jay Lau) (jay-lau-513) said :
#3

OK, when you compute restart, please do not relaunch devstack but try to restart all service directly.

Refer to http://www.scalegrid.net/blog/?p=52 for detail, you may want to do some update for the script to match your version for devstack. Thanks.

Revision history for this message
Daniel Fu (lifubj) said :
#4

Jay, Thanks for your answer, I think this may solve my problem, since I checked my mysql database. but could you tell me how to restart all services correctly, I still got some problems to manual start openstack services.
I use ps -ef | grep nova to check the services after I run devstack and keep the record for manual restarting.
 do you have any sugestions?
Thanks.

Revision history for this message
Best Guangya Liu (Jay Lau) (jay-lau-513) said :
#5

You may also want to start up keystone and glance.

Does the script help?

wget http://www.scalegrid.net/blog/wp-content/uploads/2012/06/restart_stack.txt
mv ./restart_stack.txt ./restart_stack.sh
chmod 775 ./restart_stack.sh
./restart_stack.sh

Revision history for this message
Daniel Fu (lifubj) said :
#6

I still need some time to get the script work, but I think your answers did solve this problem, thanks a lot.

Revision history for this message
Daniel Fu (lifubj) said :
#7

Thanks Jay Lau, that solved my question.