Why are my VM's visible to either virsh virt-manager, but not both?

downshiftdata picture downshiftdata · Feb 28, 2016 · Viewed 7.3k times · Source

I have an Ubuntu 14.04 host running xen, with a couple of VM's (win7 and another 14.04). I created these remotely using virt-manager. They've been running nicely for quite some time.

But when I try "virsh list --all" on the host, I get nothing in the list.

I attempted to import one of the VM's, like this:

virt-install -n my_name -r 512 --os-type=linux --os-variant=ubuntutrusty --disk /var/lib/libvirt/images/my_name.img --import

As far as virsh was concerned, this looked like it worked. It showed up as "running" on virsh list. However, I couldn't connect to it, not even ping it. Looking at virt-manager, it still thought the VM was shut off.

I ran "virsh destroy my_name" to halt it, then started it in virt-manager. It's running as normal there, but virsh list shows as shut off.

The two apps seem to be pulling from different sources to get their info, but I don't know where those are, and don't know how to get them to get along.

How do I get virsh and virt-manager to be friends?

Answer

Marc.2377 picture Marc.2377 · Jul 13, 2017

I posted an answer at Server Fault about this. Reproducing it here:

Check the output of virsh uri. If it returns qemu:///session, but you're using a qemu:///system connection in Virt-Manager, you found the cause.

In order to fix it, you should either create a "QEMU/KVM user session" connection in virt-manager, or run virsh define ~/.config/libvirt/qemu/<filename>.xml as root. This will create the xml definition under /etc/libvirt/qemu which will then be picked up by virt-manager.