virsh
Comprehensive command reference for virsh covering domain lifecycle management, networking, storage pools, snapshots, migration, performance tuning, and hypervisor administration
Check system libvirt
virsh -c qemu:///system net-list --all
Name State Autostart Persistent
--------------------------------------------
default active yes yes
- Then run below and you should see changes has been done
virsh -c qemu:///system net-destroy default
virsh -c qemu:///system net-undefine default
virsh -c qemu:///system net-define win10.xml
virsh -c qemu:///system net-start win10
virsh -c qemu:///system net-autostart win10
Network default destroyed
Network default has been undefined
Network win10 defined from win10.xml
Network win10 started
Network win10 marked as autostarted
- Remember if you using
Virtual Manager enable xml editing and change default under network to win10
How edit hostname for the host
virsh -c qemu:///system net-dumpxml default \
| sed 's|<name>default</name>|<name>new_hostname</name>|' \
> new_hostname.xml
Command Examples
Check user libvirt
virsh -c qemu:///session net-list --all
Start network manually
virsh -c qemu:///system net-start <hostname>
Autostart network
virsh net-autostart default
attach device from an XML file
Set or query a block device I/O tuning parameters.
Add or update a throttling group.
virsh domthrottlegroupset
Delete a throttling group.
virsh domthrottlegroupdel
Get a throttling group.
virsh domthrottlegroupinfo
list all domain throttlegroups.
virsh domthrottlegrouplist
Get or set blkio parameters
Start a block commit operation.
Start a block copy operation.
Manage active block operations
Populate a disk from its backing image.
Resize block device of domain.
Change media of CD or floppy drive
connect to the guest console
show domain cpu statistics
create a domain from an XML file
define (but don't start) a domain from an XML file
show or set domain's description or title
detach device from an XML file
detach device from an alias
virsh detach-device-alias
domain display connection URI
Freeze domain's mounted filesystems.
Thaw domain's mounted filesystems.
Get information of domain's mounted filesystems.
Invoke fstrim on domain's mounted filesystems.
print the domain's hostname
convert a domain name or UUID to domain id
set link state of a virtual interface
get/set parameters of a virtual interface
Get domain launch security info
Set domain launch security state
virsh domsetlaunchsecstate
convert a domain id or UUID to domain name
suspend a domain gracefully using power management functions
wakeup a domain from pmsuspended state
convert a domain name or id to domain UUID
Convert native config to domain XML
Convert domain XML to native config
dump the core of a domain to a file for analysis
domain information in XML
edit XML configuration for a domain
list authorized SSH keys for given user (via agent)
control domain IOThread affinity
add an IOThread to the guest domain
modifies an existing IOThread of the guest domain
delete an IOThread from the guest domain
Send keycodes to the guest
Send signals to processes
virsh send-process-signal
LXC Guest Enter Namespace
virsh lxc-enter-namespace
managed save of a domain state
Remove managed save of a domain
edit XML for a domain's managed save state file
Domain information of managed save state file in XML
virsh managedsave-dumpxml
redefine the XML for a domain's managed save state file
Get or set memory parameters
show or set domain's custom XML metadata
migrate domain to another host
set maximum tolerable downtime
virsh migrate-setmaxdowntime
get maximum tolerable downtime
virsh migrate-getmaxdowntime
get/set compression cache size
Set the maximum migration bandwidth
Get the maximum migration bandwidth
Switch running migration from pre-copy to post-copy
Get or set numa parameters
QEMU Monitor Command
virsh qemu-monitor-command
Set the guest agent timeout
virsh guest-agent-timeout
restore a domain from a saved state in a file
save a domain state to a file
redefine the XML for a domain's saved state file
saved state domain information in XML
edit XML for a domain's saved state file
show/set scheduler parameters
take a screenshot of a current domain console and store it into a file
change lifecycle actions
virsh set-lifecycle-action
manipulate authorized SSH keys file for given user (via agent)
set the user password inside the domain
change maximum memory limit
change number of virtual CPUs
gracefully shutdown a domain
start a (previously defined) inactive domain
update device from an XML file
update memory device of a domain
virsh update-memory-device
detailed domain vcpu information
control or query domain vcpu affinity
control or query domain emulator affinity
query or modify state of vcpu in the guest (via agent)
attach/detach vcpu or groups of threads
set the threshold for block-threshold event for a given block device or it's backing chain element
query information about the guest (via agent)
Calculate a vm's memory dirty rate
associate a FD with a domain
Reload domain's graphics display certificates
Show errors on block devices
domain block device size information
get device block stats for a domain
domain control interface state
get link state of a virtual interface
Get network interfaces' addresses for a running domain
list all domain virtual interfaces
get network interface stats for a domain
get memory statistics for a domain
get statistics about one or multiple domains
Manipulate pages pool size
compare host CPU with a CPU described by an XML file
print the hypervisor hostname
compute baseline CPU usable by a specific hypervisor
virsh hypervisor-cpu-baseline
compare a CPU with the CPU created by a hypervisor on the host
virsh hypervisor-cpu-compare
Hypervisor reported CPU models
virsh hypervisor-cpu-models
Get or set node memory parameters
Prints cpu stats of the node.
Prints memory stats of the node.
suspend the host node for a given time duration
print the hypervisor sysinfo
print the hypervisor canonical URI
Create a checkpoint from XML
Create a checkpoint from a set of args
virsh checkpoint-create-as
Delete a domain checkpoint
Dump XML for a domain checkpoint
edit XML for a checkpoint
List checkpoints for a domain
Get the name of the parent of a checkpoint
create a snapshot of current interfaces settings, which can be later committed (iface-commit) or restored (iface-rollback)
create a bridge device and attach an existing network device to it
commit changes made since iface-begin and free restore point
define an inactive persistent physical host interface or modify an existing persistent one from an XML file
destroy a physical host interface (disable it / "if-down")
interface information in XML
edit XML configuration for a physical host interface
list physical host interfaces
convert an interface name to interface MAC address
convert an interface MAC address to interface name
rollback to previous saved configuration created via iface-begin
start a physical host interface (enable it / "if-up")
undefine a bridge device after detaching its device(s)
undefine a physical host interface (remove it from configuration)
define or update a network filter from an XML file
network filter information in XML
edit XML configuration for a network filter
undefine a network filter
create a network filter binding from an XML file
virsh nwfilter-binding-create
delete a network filter binding
virsh nwfilter-binding-delete
network filter information in XML
virsh nwfilter-binding-dumpxml
list network filter bindings
virsh nwfilter-binding-list
create a network from an XML file
define an inactive persistent virtual network or modify an existing persistent one from an XML file
show or set network's description or title
print lease info for a given network
network information in XML
edit XML configuration for a network
show or set network's custom XML metadata
convert a network UUID to network name
start a (previously defined) inactive network
undefine a persistent network
update parts of an existing network's configuration
convert a network name to network UUID
create a network port from an XML file
network port information in XML
delete the specified network port
create a device defined by an XML file on the node
destroy (stop) a device on the node
detach node device from its device driver
node device details in XML
enumerate devices on this host
reattach node device to its device driver
Define or modify a device by an xml file on a node
Undefine an inactive node device
Start an inactive node device
autostart a defined node device
Update a active and/or inactive node device
define or modify a secret from an XML file
Create a snapshot from XML
Create a snapshot from a set of args
Get or set the current snapshot
Dump XML for a domain snapshot
List snapshots for a domain
Get the name of the parent of a snapshot
Revert a domain to a snapshot
Start a disk backup of a live domain
Dump XML for an ongoing domain block backup job
find potential storage pool sources
virsh find-storage-pool-sources-as
discover potential storage pool sources
virsh find-storage-pool-sources
create a pool from a set of args
create a pool from an XML file
define a pool from a set of args
define an inactive persistent storage pool or modify an existing persistent one from an XML file
edit XML configuration for a storage pool
convert a pool UUID to pool name
start a (previously defined) inactive pool
undefine an inactive pool
convert a pool name to pool UUID
storage pool capabilities
create a volume from a set of args
create a vol from an XML file
create a vol, using another volume as input
download volume contents to a file
returns the volume key for a given volume name or path
returns the volume name for a given volume key or path
returns the volume path for a given volume name or key
returns the storage pool for a given volume key or path
upload file contents to a volume
change the current directory
echo arguments. Used for internal testing.
quit this interactive terminal
print the current directory
quit this interactive terminal
(re)connect to hypervisor