Using virsh
If you are using virsh
, than there are commands:
define
-- This command takes an XML file as it's parameter and makes the domain known to libvirt (you can reference that domain by using its name or UUID).start
-- This command takes the domain name or UUID as its parameter and starts (boots) the domain.create
-- This command takes an XML file as it's parameter and creates (starts) the domain with settings described in that file. Depending on whether the domain is known to libvirt (previously defined with that UUID) it may result in two things:if it is already defined, the known domain is marked as started, it is persistent domain, but it is started with the settings supplied and not those it was defined with).
in case it is not defined, the domain started is now a transient domain (it disappears when it is destroyed, shuts down, etc.).
undefine
-- This command takes a domain name or UUID (or ID if it's started) and makes it unknown to libvirt, but if that domain is running it doesn't destroy it, just marks it transient.
C functions
In C, the APIs that virsh is using for these commands are:
define
-- virDomainDefineXMLstart
-- virDomainCreatecreate
-- virDomainCreateXMLundefine
-- virDomainUndefine
Notes:
The names may be a little bit confusing, but due to backward compatibility it is kept from Xen times.
Most of those mention commands have parameters which may alter the behavior, these may cause using different C functions for the purpose.