6

here's a question for you that's been driving me round the bend. I've managed to find plenty of resource from folk that want to do the opposite from me i.e see a machine they created using virsh in virt-manager.

However, I have a couple of VMs that I created through virt-manager that I now need to control using virsh.

When I use e.g. virsh start <vm-name> it fails claiming the domain isn't found.

virsh list --all returns nothing.

If it makes any difference, the storage volumes I created have been moved to a sub-directory on my /home partition.

Also, libvirtd is definitely running and the machines can still be controlled and accessed with virt-manager.

Any and all help would be greatly appreciated.

closed as off-topic by Stephen Harris, mdpc, Julie Pelletier, Archemar, Anthon Sep 1 '16 at 13:14

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Stephen Harris, mdpc, Julie Pelletier, Archemar, Anthon
If this question can be reworded to fit the rules in the help center, please edit the question.

3

You must have used different credentials when using virsh and virt-manager. Do everything under your user, or at least the same user every time instead. virt-manager and virsh are interfaces to the same libvirt VM database, but the user context makes a difference, so if you want to manage the same set of VMs, always use the same user with both utilities.

1

Okay, so I ran a find / -name <vm-name>.xml and discovered that the xml files for my VMs were stored in /etc/libvirt/qemu.

So I ran virsh create /etc/libvirt/qemu/<vm-name>.xml and the VM was immediately loaded into virsh along with all of my other VMs.

I cannot currently figure out exactly why this fixed the issue. However, perhaps carrying out the above gave virsh a new location to look for xml files that it wouldn't normally check before.

Leaving this up here in the likelihood that someone else ends up in a similar situation.

By all means, if you know the exact reasoning behind this, let me know or add your own answer.

  • Did you run virsh in cli and virt-manager in GUI under the same user? – dyasny Aug 31 '16 at 13:13
  • After your comment I went and checked. I ran virsh as root and virt-manager as my regular user but after doing the virsh create I mentioned it works for root but not my regular user. I have no way of knowing now whether it worked for the regular user beforehand. – I_GNU_it_all_along Aug 31 '16 at 17:49
  • in short - do everything under your user, or at least the same user every time. virt-manager and virsh are interfaces to the same libvirt VM database, but the user context makes a difference, so if you want to manage the same set of VMs, always use the same user with both utilities – dyasny Aug 31 '16 at 18:17
  • Cheers man, it was more a mistake that came as a by-product of trying to do several things at once. – I_GNU_it_all_along Aug 31 '16 at 18:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.