Difference between revisions of "Virsh list"

From wikieduonline
Jump to navigation Jump to search
Line 49: Line 49:
  
  
== Error
+
== Errors ==
  
 
  virsh list
 
  virsh list
Line 55: Line 55:
 
  error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied
 
  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]]
+
  Check: <code>[[systemctl status libvirtd]]</code> or start it <code>systemctl start libvirtd]]</code>
  
  

Revision as of 16:10, 10 December 2023



Examples

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

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

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

Related commands

See also

Advertising: