8

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?

WitVault
  • 23,445
  • 19
  • 103
  • 133
downshiftdata
  • 91
  • 1
  • 1
  • 3
  • 3
    Does `virsh uri` show the same connection URI as you see when you look at the connection details in virt-manager? – larsks Feb 28 '16 at 15:49
  • 1
    No, and now I understand a bit more about the connection URI's. By default, virsh was using qemu:///system, and I needed to change it to xen:///. Thank you. – downshiftdata Feb 28 '16 at 17:20

3 Answers3

15

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.

Garrett Hyde
  • 5,409
  • 8
  • 49
  • 55
Marc.2377
  • 7,807
  • 7
  • 51
  • 95
  • To add "QEMU/KVM user session" in virt-manager, click File > Add Connection..., under "Hypervisor" select "QEMU/KVM user session", check "Autoconnect", and click "Connect". – Garrett Hyde Jan 16 '20 at 17:56
10

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!

DonBale
  • 131
  • 1
  • 3
0

You can connect to qemu:///session with the cmd:

$> virt-manager -c qemu:///session

or

$> virt-manager --connect=qemu:///session

kdg1955
  • 305
  • 2
  • 12