Difference between revisions of "Virsh list"

From wikieduonline
Jump to navigation Jump to search
Tags: Mobile web edit, Mobile edit
 
(14 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
{{lowercase}}
 +
* Man page: https://linux.die.net/man/1/virsh
 +
  
 
* <code>[[virsh]] list</code>
 
* <code>[[virsh]] list</code>
Line 4: Line 7:
 
* <code>[[virsh list]] --name</code>
 
* <code>[[virsh list]] --name</code>
 
* <code>virsh list --no-[[autostart]]</code>
 
* <code>virsh list --no-[[autostart]]</code>
* <code>virsh list --with-[[snapshot]]</code>
+
* <code>[[virsh list --with-snapshot]]</code>
 
* <code>virsh list --title</code>
 
* <code>virsh list --title</code>
 
* <code>[[virsh -c]] qemu:///system list</code>
 
* <code>[[virsh -c]] qemu:///system list</code>
  
  
 +
== Examples ==
 
<pre>
 
<pre>
 
virsh list
 
virsh list
Line 17: Line 21:
 
</pre>
 
</pre>
  
<pre>
+
virsh list --all
virsh list --all
+
  Id    Name                          State
Id    Name                          State
+
----------------------------------------------------
----------------------------------------------------
+
  4    VM_NAME_1                    running
4    VM_NAME_1                    running
+
  5    VM_NAME_2                    in shutdown
5    VM_NAME_2                    in shutdown
+
  -    VM_NAME_3                    [[shut off]]
-    VM_NAME_3                    shut off
+
 
</pre>
 
  
  
Line 31: Line 34:
 
  ----------------------------------------------------
 
  ----------------------------------------------------
  
 +
 +
virsh list
 +
  Id  Name          State
 +
-----------------------------
 +
  2    root_default  paused
  
 
<pre>
 
<pre>
Line 40: Line 48:
 
<code>virsh list --no-[[autostart]]</code>
 
<code>virsh list --no-[[autostart]]</code>
  
<pre>
+
 
virsh list
+
== Errors ==
error: failed to connect to the hypervisor
+
 
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied
+
virsh list
</pre>
+
error: failed to connect to the hypervisor
 +
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied
 +
 +
Check: <code>[[systemctl status libvirtd]]</code> or start it <code>[[systemctl start libvirtd]]</code>
 +
 
  
 
See man page https://linux.die.net/man/1/virsh for complete list of VMs States.
 
See man page https://linux.die.net/man/1/virsh for complete list of VMs States.
  
 
:'''shutdown''' The domain is in the process of shutting down, i.e. the guest operating system has been notified and should be in the process of stopping its operations gracefully
 
:'''shutdown''' The domain is in the process of shutting down, i.e. the guest operating system has been notified and should be in the process of stopping its operations gracefully
 
  
 
== Activities ==
 
== Activities ==
Line 58: Line 69:
 
* <code>[[virsh vol-list]] POOL_NAME</code>
 
* <code>[[virsh vol-list]] POOL_NAME</code>
 
* <code>[[virsh net-list]]</code>
 
* <code>[[virsh net-list]]</code>
 +
* <code>[[virsh reboot]]</code>
 
* <code>[[virsh shutdown]]</code> or <code>[[virsh destroy]]</code>
 
* <code>[[virsh shutdown]]</code> or <code>[[virsh destroy]]</code>
 
* <code>[[virt-list-filesystems]]</code>
 
* <code>[[virt-list-filesystems]]</code>
* <code>[[virsh vncdisplay]]</code>
+
* <code>[[virsh domdisplay]]</code>, <code>[[virsh vncdisplay]]</code>
 +
* <code>[[virsh capabilities]]</code>
 +
* <code>[[virsh nodedev-list]]</code>
  
 
== See also ==
 
== See also ==
 
* {{virsh}}
 
* {{virsh}}
 
* {{virsh information}}
 
* {{virsh information}}
 
+
* {{KVM}}
  
  

Latest revision as of 16:10, 10 December 2023



Examples[edit]

virsh list
 Id    Name                           State
----------------------------------------------------
 1     HostedEngineLocal              running
 2     VM_NAME_2                      in shutdown
virsh list --all
 Id    Name                           State
----------------------------------------------------
 4     VM_NAME_1                     running
 5     VM_NAME_2                     in shutdown
 -     VM_NAME_3                     shut off


virsh list --with-snapshot
Id    Name                           State
----------------------------------------------------


virsh list
 Id   Name           State
-----------------------------
 2    root_default   paused
virsh list --name
HostedEngineLocal
VM_NAME_2

virsh list --no-autostart


Errors[edit]

virsh list
error: failed to connect to the hypervisor
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied

Check: systemctl status libvirtd or start it systemctl start libvirtd


See man page https://linux.die.net/man/1/virsh for complete list of VMs States.

shutdown The domain is in the process of shutting down, i.e. the guest operating system has been notified and should be in the process of stopping its operations gracefully

Activities[edit]

  • Dump config for all running machines:
for NAME in `virsh list --name`; do virsh dumpxml $NAME > $NAME.xml; done

Related commands[edit]

See also[edit]

Advertising: