openqa/worker: add boot script to fix KVM perms and disable SMT

For some reason /dev/kvm has 0600 perms after boot on the ppc64
worker host. Also, qemu won't run unless SMT is turned off, on
ppc64. I've just been doing this manually every time the box got
restarted, but that's dumb, so let's make it happen on boot with
a script and a service to run it.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2017-09-15 17:52:15 -07:00
parent 4005fd5929
commit 1e3d6deed8
3 changed files with 36 additions and 0 deletions

View file

@ -0,0 +1,12 @@
[Unit]
Description=openQA ppc64 worker prep script
[Service]
Type=oneshot
ExecStart=/usr/local/sbin/openqa-ppc64-prep.sh
ExecReload=/bin/true
ExecStop=/bin/true
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,7 @@
#!/bin/sh
# On boot, /dev/kvm perms are 0600 for some reason
chmod ugo+rw /dev/kvm
# SMT must be off for qemu to work properly
ppc64_cpu --smt=off

View file

@ -33,6 +33,23 @@
- packages
when: "ansible_architecture is defined and ansible_architecture == 'x86_64'"
- name: Install boot script (to set /dev/kvm perms and disable SMT) (ppc64 only)
copy: src=openqa-ppc64-prep.sh dest=/usr/local/sbin/openqa-ppc64-prep.sh owner=root group=root mode=0755
when: "ansible_architecture is defined and ansible_architecture == 'ppc64le'"
- name: Install systemd service to run boot script (ppc64 only)
copy: src=openqa-ppc64-prep.service dest=/etc/systemd/system/openqa-ppc64-prep.service
when: "ansible_architecture is defined and ansible_architecture == 'ppc64le'"
register: prepservice
- name: Do systemctl daemon-reload to register new service (ppc64 only)
command: "systemctl daemon-reload"
when: "prepservice is defined and prepservice|changed"
- name: Enable systemd service to run boot script (ppc64 only)
service: name=openqa-ppc64-prep enabled=yes state=started
when: "ansible_architecture is defined and ansible_architecture == 'ppc64le'"
- include: nfs-client.yml
when: openqa_hostname is defined and openqa_hostname != "localhost"