downshiftdata
downshiftdata

Reputation: 101

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

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?

Upvotes: 9

Views: 14772

Answers (4)

the-citto
the-citto

Reputation: 127

similar to @hdg1955's answer, the other way around

not wanting to change either virsh nor virt-manager's default for now, I've been using

virsh -c qemu:///system list --all
virsh --connect qemu:///system snapshot-list win11

etc.

when I'll get tired of the additional keystrokes, I'll change either of the default

Upvotes: 1

kdg1955
kdg1955

Reputation: 325

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

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

or

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

Upvotes: 3

Marc.2377
Marc.2377

Reputation: 8684

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.

Upvotes: 17

DonBale
DonBale

Reputation: 131

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!

Upvotes: 10

Related Questions