From f6a487eee4348f77067a52eb76c3983027d7acc9 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 19 Sep 2016 16:45:06 +0200 Subject: [PATCH 1/3] buildserver: wipe snapshot from libvirt store on --clean --- makebuildserver | 3 +++ 1 file changed, 3 insertions(+) diff --git a/makebuildserver b/makebuildserver index 0f3123ba..5c29fbd9 100755 --- a/makebuildserver +++ b/makebuildserver @@ -96,6 +96,9 @@ if os.path.exists(boxfile): if options.clean: vagrant(['destroy', '-f'], cwd=serverdir, printout=options.verbose) + if config['vm_provider'] == 'libvirt': + subprocess.call(['virsh', 'undefine', 'buildserver_default']) + subprocess.call(['virsh', 'vol-delete', '/var/lib/libvirt/images/buildserver_default.img']) # Update cached files. cachedir = config['cachedir'] From 1e8fd01c1e5209e5bffb1c88a5b4641c3b1d4ea5 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Fri, 23 Sep 2016 15:19:15 +0200 Subject: [PATCH 2/3] buildserver: only check cache permissions when using libvirt VirtualBox runs as the same user as `fdroid`, so the cache does not need to be accessible by the world. On libvirt, libvirtd runs the VMs as its own user, so in that case, the cache dirs must have permissions to let that user access them. --- makebuildserver | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/makebuildserver b/makebuildserver index 5c29fbd9..a5328f87 100755 --- a/makebuildserver +++ b/makebuildserver @@ -105,14 +105,15 @@ cachedir = config['cachedir'] if not os.path.exists(cachedir): os.makedirs(cachedir, 0o755) -tmp = cachedir -while tmp != '/': - mode = os.stat(tmp).st_mode - if not (stat.S_IXUSR & mode and stat.S_IXGRP & mode and stat.S_IXOTH & mode): - print('ERROR:', tmp, 'will not be accessible to the VM! To fix, run:') - print(' chmod a+X', tmp) - sys.exit(1) - tmp = os.path.dirname(tmp) +if config['vm_provider'] == 'libvirt': + tmp = cachedir + while tmp != '/': + mode = os.stat(tmp).st_mode + if not (stat.S_IXUSR & mode and stat.S_IXGRP & mode and stat.S_IXOTH & mode): + print('ERROR:', tmp, 'will not be accessible to the VM! To fix, run:') + print(' chmod a+X', tmp) + sys.exit(1) + tmp = os.path.dirname(tmp) if config['apt_package_cache']: config['aptcachedir'] = cachedir + '/apt/archives' From 1001e5e9b902ade24e0debbee307a3e55ba6d3b6 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Fri, 23 Sep 2016 17:40:23 +0200 Subject: [PATCH 3/3] buildserver: bochs can also be used with KVM jenkins.debian.net is being detected as 'bochs' rather than 'qemu'. --- makebuildserver | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makebuildserver b/makebuildserver index a5328f87..14624b58 100755 --- a/makebuildserver +++ b/makebuildserver @@ -72,7 +72,7 @@ if os.path.isfile('/usr/bin/systemd-detect-virt'): virt = subprocess.check_output('/usr/bin/systemd-detect-virt').strip().decode('utf-8') except subprocess.CalledProcessError as e: virt = 'none' - if virt == 'qemu' or virt == 'kvm': + if virt == 'qemu' or virt == 'kvm' or virt == 'bochs': print('Running in a VM guest, defaulting to QEMU/KVM via libvirt') config['vm_provider'] = 'libvirt' elif virt != 'none':