Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Removing Stale Virtual Machines and Virtual Machine Interfaces

 

This topic gives examples for removing stale VMs (virtual machines) and VMIs (virtual machine interfaces). Before you can remove a stale VM or VMI, you must first remove any back references associated to the VM or VMI.

Problem Example

The troubleshooting examples in this topic are based on the following problem example. A net-delete of the virtual machine 2a8120ec-bd18-49f4-aca0-acfc6e8fe74f returned the following messages that there are two VMIs that still have back-references to the stale VM.

The two VMIs must be deleted first, then the Neutron net-delete <vm_ID> command will complete without errors.

Show Virtual Machines

Use the following command to show all of the virtual machines known to the Contrail API server. Replace the variable <config-node-IP> shown in the example with the IP address of the config-node in your setup.

http://<config-node-IP>:8082/virtual-machines

Example

In the following example, 03443891-99cc-4784-89bb-9d1e045f8aa6 is a stale VM that needs to be removed.

When the user attempts to delete the stale VM, a message displays that children to the VM still exist:

The user opens http: //example-node:8082/virtual-machine/ 03443891-99cc-4784-89bb-9d1e045f8aa6, and sees a virtual-machine-interface (VMI) attached to it. The VMI must be removed before the VM can be removed.

However, when the user attempts to delete the VMI from the stale VM, they get a message that there is still a back-reference:

Because there is a back-reference from an instance-ip object still present, the instance-ip object must first be deleted, as follows:

When the instance-ip is deleted, then the VMI and the VM can be deleted.

Note

To prevent inconsistency, be certain that the VM is not present in the Nova database before deleting the VM.

Delete Methods

Use help (vh) to show all delete methods supported.

Typical commands for deleting VMs and VMIs include:

  • virtual_machine_delete() to delete a virtual machine

  • instance_ip_delete() to delete an instance-ip.