add(app-emulation/xenserver-pv-version): Fake XenServer PV drivers

XenServer expects virtual machines to run their own version of the Xen
para-virtualized drivers and will not attach disks otherwise. This is
pretty silly considering the ones bundled in Linux are perfectly fine.
In order to work around this write the latest version of XenServer to
special variables in xenstore. This will be included in all images
rather than OEM since this could impact any XenServer user and I want to
write to xenstore as early as possible, possibly even in the initrd.
This commit is contained in:
Michael Marineau 2014-04-14 17:31:49 -04:00
parent 0d75a04fe8
commit 30ae893a5e
2 changed files with 53 additions and 0 deletions

View File

@ -0,0 +1,18 @@
[Unit]
Description=Set fake PV driver version for XenServer
DefaultDependencies=false
Requires=proc-xen.mount
After=proc-xen.mount
IgnoreOnIsolate=true
ConditionVirtualization=xen
[Service]
Type=oneshot
RemainAfterExit=true
# Only attempt the write if 'attr' exists, it may not.
ExecStart=/bin/sh -c \
'if xenstore exists attr; then xenstore write \
attr/PVAddons/MajorVersion @@MAJOR@@ \
attr/PVAddons/MinorVersion @@MINOR@@ \
attr/PVAddons/MicroVersion @@MICRO@@ \
data/updated 1; fi'

View File

@ -0,0 +1,35 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI=5
inherit systemd versionator
DESCRIPTION="Fake data for XenServer's PV driver version detection."
HOMEPAGE="http://xenserver.org/"
SRC_URI=""
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64"
IUSE=""
DEPEND=""
RDEPEND="app-emulation/xenstore"
S="${WORKDIR}"
src_prepare() {
local split=($(get_version_components))
sed -e "s/@@MAJOR@@/${split[0]}/" \
-e "s/@@MINOR@@/${split[1]}/" \
-e "s/@@MICRO@@/${split[2]}/" \
"${FILESDIR}"/xenserver-pv-version.service \
> "${T}"/xenserver-pv-version.service || die
}
src_install() {
systemd_dounit "${T}"/xenserver-pv-version.service
systemd_enable_service sysinit.target xenserver-pv-version.service
}