17

I am running a virtual (kvm) MAAS/juju setup where most of the MAAS nodes (including MAAS master) are virtual, but some are also physical nodes. The physical Dell 1950 nodes configures automatically for boot in MAAS, so when i deploy via Juju they power on automatically. My problem lies in trying to set up boot for virtual systems. I see the posibility in the MAAS for power type. I can choose virsh. But i need to fill in information i do not know. What should i fill in for Driver and Power ID?

Anyone has experience with that?

1
  • 1
    i am trying to get that kvm and maas , please explain how you setup all the things to get working
    – riyush
    Jul 10, 2013 at 3:29

2 Answers 2

22
+125

In maas 1.2 through 1.8 the virsh power type requires only the Address and Power ID.

MAAS 1.8 Screenshot MAAS 1.8 virsh power settings

MAAS 1.2-1.4 Screenshot MAAS 1.2-1.4 virsh power settings

The libvirt-bin package needs to be installed to get the virsh command

$ sudo apt-get -y install libvirt-bin

the Power ID is the name of the virtual machine shown by sudo virsh list --all

The address is a normal libvirt connect string:

qemu+ssh://[email protected]/system

or

qemu:///system

If you want to use ssh you'll need to generate a ssh key pair for the maas user. By default there is no home directory created for the maas user.

$ sudo mkdir -p ~maas
$ sudo chown maas:maas ~maas

Add a login shell for the maas user (we'll only need this for the ssh-copy-id command later; if you're putting ssh keys in place manually or using a different mechanism, this step isn't strictly needed):

$ sudo chsh -s /bin/bash maas

Generate a SSH keypair as the maas user (hit enter three times to accept the default path and empty password):

$ sudo -u maas ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/maas/.ssh/id_rsa): 
Created directory '/home/maas/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/maas/.ssh/id_rsa.
Your public key has been saved in /home/maas/.ssh/id_rsa.pub.

Then add the public key to ~ubuntu/.ssh/authorized_keys on the vm server so virsh can use ssh without a password:

$ sudo -u maas -i ssh-copy-id [email protected]

As the maas user, test virsh commands against libvirt at 10.0.0.2:

$ sudo -u maas virsh -c qemu+ssh://[email protected]/system list --all
4
  • 1
    I'm putting this answer in the official MAAS docs. Thanks!
    – bigjools
    Nov 8, 2013 at 4:19
  • But what do you do if virsh -c qemu:///system list --all is an empty result set?
    – monokrome
    Aug 5, 2014 at 7:31
  • 1
    Running virsh -c qemu:///system list --all on the 10.0.0.2 machine is equivalent to running virsh -c qemu+ssh://[email protected]/system list --all on another machine, provided the "ubuntu" user on 10.0.0.2 is added to the "libvirtd" group (i.e. can access running KVM nodes) and has an authorized SSH key to allow you to connect to [email protected] without a password.
    – dimitern
    Oct 14, 2014 at 7:20
  • Your KVM virtual machines might be owned by the root account, not a normal user. Then you need to connect using qemu+ssh://[email protected]/system instead, and the SSH key needs to allow passwordless access to root, not the ubuntu user. Needless to say, this is rather insecure :)
    – qris
    May 28, 2015 at 9:05
1

Driver and Username are not required for virsh. They will be deleted eventually.b

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .