20

virsh list returns an empty list but the gui virt-manager has 2 defined QEMU/KVM virtual machines. How come virsh list doesn't list anythng ?

ChiseledAbs
  • 2,243

1 Answers1

21

The virsh list command only runs things running.

If you want things defined but not running then

virsh list --all

And remember each type of namespace is distinct so you may need --connect as well

e.g.

$ virsh -c lxc:/// list      
 Id    Name                           State
----------------------------------------------------


$ virsh -c lxc:/// list --all
 Id    Name                           State
----------------------------------------------------
 -     helloworld                     shut off

$ virsh -c qemu:///system list
 Id    Name                           State
----------------------------------------------------
 37    fedora24                       running

$ virsh -c qemu:///system list --all
 Id    Name                           State
----------------------------------------------------
 37    fedora24                       running
 -     docker                         shut off
 -     kali                           shut off
 -     test1                          shut off
  • nice I also have a network defined but it doesn't appear in the list (i want to know the name I have to undefine). How could I list it ? edit : nvm it's net-list – ChiseledAbs Aug 03 '16 at 21:13
  • virsh net-list --all. virsh help gives a list of all the commands, so things like virsh help | grep network produces a list of network related commands; virsh net-list was one of them, and (just as with virsh list) you need --all to show inactive networks as well. – Stephen Harris Aug 03 '16 at 21:15