Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

linux

xen

virsh

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?

like image 842
downshiftdata Avatar asked Feb 28 '16 14:02

downshiftdata


2 Answers

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.

like image 76
Marc.2377 Avatar answered Oct 05 '22 23:10

Marc.2377


Another way to change your connection URI and use qemu:///system as default is to edit your .bahsrc and add:

export LIBVIRT_DEFAULT_URI="qemu:///system"

logout and login again and virsh and virt-manager will be friends!

like image 41
DonBale Avatar answered Oct 06 '22 01:10

DonBale