4

I'm trying to automate checking several nodes running KVM domains. I was simply using ssh to run the commands directly instead of doing a full login:

ssh user@kvmhost "virsh list --all" 

But it was simply producing output like this:

 Id Name State -------------------- 

When I login interactively I can run virsh list --all and it shows me the domains. So what am I doing wrong?

1 Answer 1

4

There is an environment variable called LIBVIRT_DEFAULT_URI that is being set when you login interactively and probably it's not being set when you run the command directly through ssh. That variable is probably normally set like this:

LIBVIRT_DEFAULT_URI=qemu:///system 

So probably all you need to do is prepend your virsh command in ssh with setting that environment variable, like this:

ssh user@kvmhost "LIBVIRT_DEFAULT_URI=qemu:///system virsh list --all" 
0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.