Managing mismatches between Nova and libvirt
The Nagios sensor 'Nova Libvirt Mismatch' reports the (uuid, instance-id) mappings for VMs that appear in libvirt but not on Nova.
Check the status of this VM in the nova database using the uuid:
$ ssh root@mysql-cluster-01.cloud.pd.infn.it # mysql mysql> use nova_prod; mysql> select display_name,user_id,project_id,created_at,deleted_at from instances where uuid='a2d1589c-f40b-4701-b6d0-687055b8309d';
If the VM has been deleted according to nova (e.g. the deleted_at field has a value) it is safe to shutdown and then destroy the VM in libvirt. Log on the relevant compute node and issue the following commands (replace instance-000aba38 with the relevant instance-id):
virsh destroy instance-000aba38 virsh undefine instance-000aba38
If the first command fails with error error: Requested operation is not valid: domain is not running
, verify that the VM is already in shut off
state with:
virsh list --all
and then issue only the undefine
command above.
If the sensor is not installed and it is necessary to find the (uuid, instance-id) mappings for VMs that appear in libvirt but not on Nova:
- Find the VMs that, according to Nova, are hosted on a specific host (e.g. cld-nl-13.cloud.pd.infn.it):
nova list --all-tenants --host cld-nl-13.cloud.pd.infn.it --fields name,instance_name
- Log on that compute node, and see the VMs hosted on that node, according to libvirt:
[root@cld-nl-13 ~]# virsh list
- Lets's say that instance ```instance-000aba38``` appears in libvirt but not on Nova.
With the following command:
virsh dumpxml instance-000aba38
it is possible to see the UUID of this VM (e.g. a2d1589c-f40b-4701-b6d0-687055b8309d).