libvirtError that domain already exists, but virsh list doesn't show it

When I try to launch an instance with OpenStack, I get the following error in nova-compute.log:

(nova.rpc): TRACE: libvirtError: operation failed: domain 'instance-0000000a' already exists with uuid 5f81a7d2-1b0f-8c72-4e1e-377c275e9289

However, virsh doesn't show any domains:

$ sudo virsh list
 Id Name                 State
----------------------------------

Why isn't that domain showing up in virsh if it's there?


Your domain may be shut down. Run virsh list --all to see all domains.


Not yet familiar with OpenStack, but in regular old libvirt, that error usually implies not that there's a RUNNING instance, but that there's a DEFINED instance. "virsh list" only shows currently active VM's, not every defined VM. Try:

virsh edit instance-0000000a

If that pops open vim and has a bunch of XML in there, there's already a defined 'instance-0000000a' VM. If you are 100% sure you don't want it, quit out of the editor and use:

virsh undefine instance-0000000a

And then have OpenStack try whatever you were doing again, and it should work.

By the way, if you DO want what's there, you can start it with:

virsh start instance-0000000a

But again, not familiar with OpenStack, it may not like you doing that, no idea.


Scenario 1:

Are you certain that virsh on the command line is talking to the same hypervisor as your OpenStack controller? This would be the simplest explanation as two why virsh is not showing the running instance.

Scenario 2:

If you use ps, do you see any qemu-kvm instances running? Try:

ps -fe | grep qemu-kvm

If there are qemu-kvm instances running, they'll have a -name parameter that should match the name used in virsh. You can just kill -9 these processes if they're supposed to be dead anyway.