Virsh undefine

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

Internal

Overview

Undefines a guest (domain). If the domain is running, this converts it to a transient domain, without stopping it. If the domain is inactive, the domain configuration is removed.

virsh undefine <guest-name>

Options

--snapshots-metadata - will also clean up any snapshot data when undefining an inactive domain. Without the option, attempts to undefine an inactive domain with snapshot metadata will fail. If the domain is active, this flag is ignored.

--nvram - ensures no nvram (/domain/os/nvram/) file is left behind. If the domain has an nvram file and the flag is omitted, the undefine will fail.

--storage - this option takes a parameter volumes, which is a comma separated list of volume target names or source paths of storage volumes to be removed along with the undefined domain. Volumes can be undefined and thus removed only on inactive domains. Volume deletion is only attempted after the domain is undefined; if not all of the requested volumes could be deleted, the error message indicates what still remains behind. If a volume path is not found in the domain definition, it's treated as if the volume was successfully deleted. Only volumes managed by libvirt in storage pools can be removed this way. Example:

--storage vda,/path/to/storage.img

--remove-all-storage - all of the domain's storage volumes should be deleted.

--delete-snapshots - any snapshots associated with the storage volume should be deleted as well. Requires the --remove-all-storage flag to be provided. Not all storage drivers support this option.

--wipe-storage - specifies that the storage volumes should be wiped before removal.