openqa/server: set up a cron job to do createhdds daily

instead of just relying on it getting run when we do an
ansible run, since that's intermittent and it's annoying
when you want to do an ansible run and it sits there for
hours creating disk images. This way we'll know they'll
get updated regularly and ansible runs should never get
blocked on image creation, though we still do it in the
ansible plays just in case (and for initial deployment).
This should now be safe, with the recent changes to make it
time out gracefully and run atomically. We also use withlock
to make sure we don't stack jobs.
This commit is contained in:
Adam Williamson 2016-05-24 11:38:46 -07:00
parent a0a335ed4d
commit ac35a48d8c
2 changed files with 9 additions and 5 deletions

View file

@ -0,0 +1,4 @@
#!/bin/sh
cd /var/lib/openqa/share/factory/hdd
LIBGUESTFS_BACKEND=direct withlock /var/lock/createhdds.lock /root/openqa_fedora_tools/tools/createhdds.py all --clean

View file

@ -89,6 +89,7 @@
- python3-fedfind
- python3-libguestfs
- python3-pexpect
- withlock
tags:
- packages
@ -113,6 +114,9 @@
- /var/lib/openqa/share/factory/repo
- /var/lib/openqa/share/factory/other
- name: Set up createhdds cron job
copy: src=createhdds dest=/etc/cron.daily/createhdds owner=root group=root mode=0755
- name: Check if any hard disk images need (re)building
command: "/root/openqa_fedora_tools/tools/createhdds.py check"
args:
@ -123,11 +127,7 @@
always_run: true
- name: Create hard disk images (this may take a long time!)
command: "/root/openqa_fedora_tools/tools/createhdds.py all --clean"
args:
chdir: /var/lib/openqa/share/factory/hdd/
environment:
LIBGUESTFS_BACKEND: direct
command: "/etc/cron.daily/createhdds"
when: "diskcheck.rc > 0"
- name: Create exports file