Merge lp:~julian-edwards/maas/virsh-power-cleanup into lp:~maas-committers/maas/trunk

Proposed by Julian Edwards
Status: Merged
Approved by: Julian Edwards
Approved revision: no longer in the source branch.
Merged at revision: 1728
Proposed branch: lp:~julian-edwards/maas/virsh-power-cleanup
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 96 lines (+48/-7)
4 files modified
docs/nodes.rst (+46/-0)
etc/maas/templates/power/virsh.template (+0/-2)
src/maasserver/power_parameters.py (+0/-3)
src/provisioningserver/power/tests/test_poweraction.py (+2/-2)
To merge this branch: bzr merge lp:~julian-edwards/maas/virsh-power-cleanup
Reviewer Review Type Date Requested Status
Andres Rodriguez (community) Approve
Review via email: mp+194441@code.launchpad.net

Commit message

Two bugs for the price of one: Fix the virsh power parameters input boxes, plus document how to set up virsh.

To post a comment you must log in.
Revision history for this message
Andres Rodriguez (andreserl) wrote :

Lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'docs/media/virsh-config.png'
0Binary files docs/media/virsh-config.png 1970-01-01 00:00:00 +0000 and docs/media/virsh-config.png 2013-11-08 04:07:46 +0000 differ0Binary files docs/media/virsh-config.png 1970-01-01 00:00:00 +0000 and docs/media/virsh-config.png 2013-11-08 04:07:46 +0000 differ
=== modified file 'docs/nodes.rst'
--- docs/nodes.rst 2013-06-07 16:26:25 +0000
+++ docs/nodes.rst 2013-11-08 04:07:46 +0000
@@ -46,3 +46,49 @@
4646
47If you know the MAC address of a node, you can manually enter details47If you know the MAC address of a node, you can manually enter details
48about the node through the web interface.48about the node through the web interface.
49
50
51Virtual machine nodes
52---------------------
53
54If you're setting up virtual machines to use as nodes with MAAS, you need
55to configure the power type as ``virsh``. For MAAS to be able to use
56virsh, make sure you have the ``libvirt-bin`` package installed.
57
58The virsh power type takes two parameters:
59
60Power ID
61 The Power ID is the name of the virtual machine shown by
62 ``sudo virsh list --all``
63
64Address
65 This is a libvirt connection string, such as
66 ``qemu+ssh://ubuntu@10.0.0.2/system`` or ``qemu:///system``
67
68.. image:: media/virsh-config.png
69
70If you want to use ssh you'll need to generate a ssh key pair for the maas
71user. By default there is no home directory created for the maas user::
72
73 $ sudo mkdir /home/maas
74 $ sudo chown maas:maas /home/maas
75
76Add a login shell for the maas user::
77
78 $ sudo chsh maas
79 $ /bin/bash
80
81Become the maas user and generate a SSH keypair::
82
83 # sudo su - maas
84 $ ssh-keygen
85
86Then add the public key to ``/ubuntu/.ssh/authorized_keys`` on the vm server
87so virsh can use ssh without a password::
88
89 $ ssh-copy-id -i ~/.ssh/id_rsa ubuntu@10.0.0.2
90
91As the maas user, test virsh commands against libvirt at 10.0.0.2::
92
93 $ virsh -c qemu+ssh://ubuntu@10.0.0.2/system list --all
94
4995
=== modified file 'etc/maas/templates/power/virsh.template'
--- etc/maas/templates/power/virsh.template 2012-06-14 05:52:58 +0000
+++ etc/maas/templates/power/virsh.template 2013-11-08 04:07:46 +0000
@@ -7,8 +7,6 @@
7power_change={{power_change}}7power_change={{power_change}}
8power_address={{power_address}}8power_address={{power_address}}
9power_id={{power_id}}9power_id={{power_id}}
10username={{username}}
11system_id={{system_id}}
12virsh={{virsh}}10virsh={{virsh}}
1311
1412
1513
=== modified file 'src/maasserver/power_parameters.py'
--- src/maasserver/power_parameters.py 2013-10-18 09:54:17 +0000
+++ src/maasserver/power_parameters.py 2013-11-08 04:07:46 +0000
@@ -54,9 +54,6 @@
54 skip_check=True),54 skip_check=True),
55 POWER_TYPE.VIRSH: DictCharField(55 POWER_TYPE.VIRSH: DictCharField(
56 [56 [
57 ('driver', forms.CharField(label="Driver", required=False)),
58 ('username',
59 forms.CharField(label="Username", required=False)),
60 ('power_address',57 ('power_address',
61 forms.CharField(label="Address", required=False)),58 forms.CharField(label="Address", required=False)),
62 ('power_id',59 ('power_id',
6360
=== modified file 'src/provisioningserver/power/tests/test_poweraction.py'
--- src/provisioningserver/power/tests/test_poweraction.py 2013-10-15 11:35:10 +0000
+++ src/provisioningserver/power/tests/test_poweraction.py 2013-11-08 04:07:46 +0000
@@ -168,8 +168,8 @@
168 action = PowerAction(POWER_TYPE.VIRSH)168 action = PowerAction(POWER_TYPE.VIRSH)
169 script = action.render_template(169 script = action.render_template(
170 action.get_template(), power_change='on',170 action.get_template(), power_change='on',
171 power_address='qemu://example.com/', system_id='mysystem',171 power_address='qemu://example.com/',
172 power_id='mysystem', username='me', virsh='echo')172 power_id='mysystem', virsh='echo')
173 output = action.run_shell(script)173 output = action.run_shell(script)
174 self.assertIn("Got unknown power state from virsh", output)174 self.assertIn("Got unknown power state from virsh", output)
175175