summaryrefslogtreecommitdiff
path: root/app-emulation/ganeti/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
committerV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
commit8376ef56580626e9c0f796d5b85b53a0a1c7d5f5 (patch)
tree7681bbd4e8b05407772df40a4bf04cbbc8afc3fa /app-emulation/ganeti/files
parent30a9caf154332f12ca60756e1b75d2f0e3e1822d (diff)
gentoo resync : 14.07.2018
Diffstat (limited to 'app-emulation/ganeti/files')
-rw-r--r--app-emulation/ganeti/files/0001-kvm-use_guest_agent-QEMU-Guest-Agent-sup.stable-2.15.patch122
-rw-r--r--app-emulation/ganeti/files/0001-kvm-use_guest_agent-QEMU-Guest-Agent-sup.stable-2.16.patch122
-rw-r--r--app-emulation/ganeti/files/fix_ftbfs_with_sphinx_1.447
-rw-r--r--app-emulation/ganeti/files/ganeti-2.10-rundir.patch35
-rw-r--r--app-emulation/ganeti/files/ganeti-2.11-add-pgrep.patch25
-rw-r--r--app-emulation/ganeti/files/ganeti-2.11-daemon-util-tests.patch38
-rw-r--r--app-emulation/ganeti/files/ganeti-2.11-dont-nest-libdir.patch49
-rw-r--r--app-emulation/ganeti/files/ganeti-2.11-dont-print-man-help.patch13
-rw-r--r--app-emulation/ganeti/files/ganeti-2.11-tests.patch13
-rw-r--r--app-emulation/ganeti/files/ganeti-2.12-qemu-enable-kvm.patch12
-rw-r--r--app-emulation/ganeti/files/ganeti-2.12-start-stop-daemon-args.patch39
-rw-r--r--app-emulation/ganeti/files/ganeti-2.13-process_unittest.patch21
-rw-r--r--app-emulation/ganeti/files/ganeti-2.15-daemon-util.patch53
-rw-r--r--app-emulation/ganeti/files/ganeti-2.15-dont-invert-return-values-for-man-warnings.patch10
-rw-r--r--app-emulation/ganeti/files/ganeti-2.15-kvmd-run-as-daemon-user.patch33
-rw-r--r--app-emulation/ganeti/files/ganeti-2.15-noded-must-run-as-root.patch50
-rw-r--r--app-emulation/ganeti/files/ganeti-2.15-python-mock.patch26
-rw-r--r--app-emulation/ganeti/files/ganeti-2.15-respect-HFLAGS.patch12
-rw-r--r--app-emulation/ganeti/files/ganeti-2.15.2-remove-sandbox-failing-tests.patch58
-rw-r--r--app-emulation/ganeti/files/ganeti-2.16-kvmd-run-as-daemon-user.patch30
-rw-r--r--app-emulation/ganeti/files/ganeti-2.16-noded-must-run-as-root.patch26
-rw-r--r--app-emulation/ganeti/files/ganeti-2.17-relax-deps.patch21
-rw-r--r--app-emulation/ganeti/files/ganeti-2.9-disable-root-tests.patch18
-rw-r--r--app-emulation/ganeti/files/ganeti-2.9-skip-cli-test.patch18
-rw-r--r--app-emulation/ganeti/files/ganeti-kvm-poweroff.confd4
-rw-r--r--app-emulation/ganeti/files/ganeti-kvm-poweroff.initd57
-rw-r--r--app-emulation/ganeti/files/ganeti-lockdir.patch15
-rw-r--r--app-emulation/ganeti/files/ganeti.confd-r219
-rw-r--r--app-emulation/ganeti/files/ganeti.initd-r396
29 files changed, 1082 insertions, 0 deletions
diff --git a/app-emulation/ganeti/files/0001-kvm-use_guest_agent-QEMU-Guest-Agent-sup.stable-2.15.patch b/app-emulation/ganeti/files/0001-kvm-use_guest_agent-QEMU-Guest-Agent-sup.stable-2.15.patch
new file mode 100644
index 000000000000..460636fa6340
--- /dev/null
+++ b/app-emulation/ganeti/files/0001-kvm-use_guest_agent-QEMU-Guest-Agent-sup.stable-2.15.patch
@@ -0,0 +1,122 @@
+From c3697936405ed8c95b674a7d412886e364306f5f Mon Sep 17 00:00:00 2001
+Message-Id: <c3697936405ed8c95b674a7d412886e364306f5f.1483650125.git.robbat2@gentoo.org>
+From: "Robin H. Johnson" <robbat2@gentoo.org>
+Date: Thu, 29 Sep 2016 08:57:28 -0700
+Subject: [PATCH-2.15] kvm: use_guest_agent: QEMU Guest Agent support
+
+Implement the QEMU Guest Agent sockets, so that code/scripts on the
+hypervisors can communicate with guest operating systems easily.
+
+Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
+---
+ lib/hypervisor/hv_kvm/__init__.py | 23 +++++++++++++++++++++++
+ man/gnt-instance.rst | 7 +++++++
+ src/Ganeti/Constants.hs | 5 +++++
+ 3 files changed, 35 insertions(+)
+
+diff --git a/lib/hypervisor/hv_kvm/__init__.py b/lib/hypervisor/hv_kvm/__init__.py
+index cd29baa38..89bc18b85 100644
+--- a/lib/hypervisor/hv_kvm/__init__.py
++++ b/lib/hypervisor/hv_kvm/__init__.py
+@@ -351,6 +351,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
+ constants.HV_MIGRATION_BANDWIDTH: hv_base.REQ_NONNEGATIVE_INT_CHECK,
+ constants.HV_MIGRATION_DOWNTIME: hv_base.REQ_NONNEGATIVE_INT_CHECK,
+ constants.HV_MIGRATION_MODE: hv_base.MIGRATION_MODE_CHECK,
++ constants.HV_USE_GUEST_AGENT: hv_base.NO_CHECK,
+ constants.HV_USE_LOCALTIME: hv_base.NO_CHECK,
+ constants.HV_DISK_CACHE:
+ hv_base.ParamInSet(True, constants.HT_VALID_CACHE_TYPES),
+@@ -581,6 +582,13 @@ class KVMHypervisor(hv_base.BaseHypervisor):
+ """
+ return utils.PathJoin(cls._CTRL_DIR, "%s.qmp" % instance_name)
+
++ @classmethod
++ def _InstanceQemuGuestAgentMonitor(cls, instance_name):
++ """Returns the instance serial QEMU Guest Agent socket name
++
++ """
++ return utils.PathJoin(cls._CTRL_DIR, "%s.qga" % instance_name)
++
+ @classmethod
+ def _InstanceKvmdMonitor(cls, instance_name):
+ """Returns the instance kvm daemon socket name
+@@ -667,6 +675,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
+ utils.RemoveFile(cls._InstanceMonitor(instance_name))
+ utils.RemoveFile(cls._InstanceSerial(instance_name))
+ utils.RemoveFile(cls._InstanceQmpMonitor(instance_name))
++ utils.RemoveFile(cls._InstanceQemuGuestAgentMonitor(instance_name))
+ utils.RemoveFile(cls._InstanceKVMRuntime(instance_name))
+ utils.RemoveFile(cls._InstanceKeymapFile(instance_name))
+ uid_file = cls._InstanceUidFile(instance_name)
+@@ -1376,6 +1385,20 @@ class KVMHypervisor(hv_base.BaseHypervisor):
+ if self._UUID_RE.search(kvmhelp):
+ kvm_cmd.extend(["-uuid", instance.uuid])
+
++ # Add guest agent socket
++ if hvp[constants.HV_USE_GUEST_AGENT]:
++ qga_addr = utils.GetFreeSlot(pci_reservations, reserve=True)
++ qga_pci_info = "bus=%s,addr=%s" % ('pci.0', hex(qga_addr))
++ qga_path = self._InstanceQemuGuestAgentMonitor(instance.name)
++ logging.info("KVM: Guest Agent available at %s", qga_path)
++ # The 'qga0' identified can change, but the 'org.qemu.guest_agent.0' string is
++ # the default expected by the Guest Agent.
++ kvm_cmd.extend([
++ "-chardev", "socket,path=%s,server,nowait,id=qga0" % qga_path,
++ "-device", "virtio-serial,id=qga0,%s" % qga_pci_info,
++ "-device", "virtserialport,chardev=qga0,name=org.qemu.guest_agent.0",
++ ])
++
+ if hvp[constants.HV_KVM_EXTRA]:
+ kvm_cmd.extend(hvp[constants.HV_KVM_EXTRA].split(" "))
+
+diff --git a/man/gnt-instance.rst b/man/gnt-instance.rst
+index a29fd7972..433b1f3b1 100644
+--- a/man/gnt-instance.rst
++++ b/man/gnt-instance.rst
+@@ -526,6 +526,13 @@ viridian
+ viridian (Hyper-V) for this instance. The default is false,
+ disabling viridian support.
+
++use\_guest\_agent
++ Valid for the KVM hypervisor.
++
++ A boolean option that specifies if the hypervisor should enable
++ the QEMU Guest Agent protocol for this instance. By default, the
++ Guest Agent is disabled.
++
+ use\_localtime
+ Valid for the Xen HVM and KVM hypervisors.
+
+diff --git a/src/Ganeti/Constants.hs b/src/Ganeti/Constants.hs
+index 09783d4bf..cf5421946 100644
+--- a/src/Ganeti/Constants.hs
++++ b/src/Ganeti/Constants.hs
+@@ -1806,6 +1806,9 @@ hvUsbMouse = "usb_mouse"
+ hvUseBootloader :: String
+ hvUseBootloader = "use_bootloader"
+
++hvUseGuestAgent :: String
++hvUseGuestAgent = "use_guest_agent"
++
+ hvUseLocaltime :: String
+ hvUseLocaltime = "use_localtime"
+
+@@ -1938,6 +1941,7 @@ hvsParameterTypes = Map.fromList
+ , (hvUsbDevices, VTypeString)
+ , (hvUsbMouse, VTypeString)
+ , (hvUseBootloader, VTypeBool)
++ , (hvUseGuestAgent, VTypeBool)
+ , (hvUseLocaltime, VTypeBool)
+ , (hvVga, VTypeString)
+ , (hvVhostNet, VTypeBool)
+@@ -3996,6 +4000,7 @@ hvcDefaults =
+ , (hvMigrationBandwidth, PyValueEx (32 :: Int))
+ , (hvMigrationDowntime, PyValueEx (30 :: Int))
+ , (hvMigrationMode, PyValueEx htMigrationLive)
++ , (hvUseGuestAgent, PyValueEx False)
+ , (hvUseLocaltime, PyValueEx False)
+ , (hvDiskCache, PyValueEx htCacheDefault)
+ , (hvSecurityModel, PyValueEx htSmNone)
+--
+2.11.0.rc2
+
diff --git a/app-emulation/ganeti/files/0001-kvm-use_guest_agent-QEMU-Guest-Agent-sup.stable-2.16.patch b/app-emulation/ganeti/files/0001-kvm-use_guest_agent-QEMU-Guest-Agent-sup.stable-2.16.patch
new file mode 100644
index 000000000000..6bca593a08d6
--- /dev/null
+++ b/app-emulation/ganeti/files/0001-kvm-use_guest_agent-QEMU-Guest-Agent-sup.stable-2.16.patch
@@ -0,0 +1,122 @@
+From 16a08ecb268062a2634dbfc081b4729cb749b7b4 Mon Sep 17 00:00:00 2001
+Message-Id: <16a08ecb268062a2634dbfc081b4729cb749b7b4.1483650125.git.robbat2@gentoo.org>
+From: "Robin H. Johnson" <robbat2@gentoo.org>
+Date: Thu, 29 Sep 2016 08:57:28 -0700
+Subject: [PATCH-2.16] kvm: use_guest_agent: QEMU Guest Agent support
+
+Implement the QEMU Guest Agent sockets, so that code/scripts on the
+hypervisors can communicate with guest operating systems easily.
+
+Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
+---
+ lib/hypervisor/hv_kvm/__init__.py | 23 +++++++++++++++++++++++
+ man/gnt-instance.rst | 7 +++++++
+ src/Ganeti/Constants.hs | 5 +++++
+ 3 files changed, 35 insertions(+)
+
+diff --git a/lib/hypervisor/hv_kvm/__init__.py b/lib/hypervisor/hv_kvm/__init__.py
+index ac02ff56c..b865d6f3a 100644
+--- a/lib/hypervisor/hv_kvm/__init__.py
++++ b/lib/hypervisor/hv_kvm/__init__.py
+@@ -497,6 +497,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
+ constants.HV_MIGRATION_BANDWIDTH: hv_base.REQ_NONNEGATIVE_INT_CHECK,
+ constants.HV_MIGRATION_DOWNTIME: hv_base.REQ_NONNEGATIVE_INT_CHECK,
+ constants.HV_MIGRATION_MODE: hv_base.MIGRATION_MODE_CHECK,
++ constants.HV_USE_GUEST_AGENT: hv_base.NO_CHECK,
+ constants.HV_USE_LOCALTIME: hv_base.NO_CHECK,
+ constants.HV_DISK_CACHE:
+ hv_base.ParamInSet(True, constants.HT_VALID_CACHE_TYPES),
+@@ -750,6 +751,13 @@ class KVMHypervisor(hv_base.BaseHypervisor):
+ """
+ return utils.PathJoin(cls._CTRL_DIR, "%s.qmp" % instance_name)
+
++ @classmethod
++ def _InstanceQemuGuestAgentMonitor(cls, instance_name):
++ """Returns the instance serial QEMU Guest Agent socket name
++
++ """
++ return utils.PathJoin(cls._CTRL_DIR, "%s.qga" % instance_name)
++
+ @classmethod
+ def _InstanceKvmdMonitor(cls, instance_name):
+ """Returns the instance kvm daemon socket name
+@@ -836,6 +844,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
+ utils.RemoveFile(cls._InstanceMonitor(instance_name))
+ utils.RemoveFile(cls._InstanceSerial(instance_name))
+ utils.RemoveFile(cls._InstanceQmpMonitor(instance_name))
++ utils.RemoveFile(cls._InstanceQemuGuestAgentMonitor(instance_name))
+ utils.RemoveFile(cls._InstanceKVMRuntime(instance_name))
+ utils.RemoveFile(cls._InstanceKeymapFile(instance_name))
+ uid_file = cls._InstanceUidFile(instance_name)
+@@ -1544,6 +1553,20 @@ class KVMHypervisor(hv_base.BaseHypervisor):
+ if self._UUID_RE.search(kvmhelp):
+ kvm_cmd.extend(["-uuid", instance.uuid])
+
++ # Add guest agent socket
++ if hvp[constants.HV_USE_GUEST_AGENT]:
++ qga_addr = utils.GetFreeSlot(bus_slots[_PCI_BUS], reserve=True)
++ qga_pci_info = "bus=%s,addr=%s" % (_PCI_BUS, hex(qga_addr))
++ qga_path = self._InstanceQemuGuestAgentMonitor(instance.name)
++ logging.info("KVM: Guest Agent available at %s", qga_path)
++ # The 'qga0' identified can change, but the 'org.qemu.guest_agent.0' string is
++ # the default expected by the Guest Agent.
++ kvm_cmd.extend([
++ "-chardev", "socket,path=%s,server,nowait,id=qga0" % qga_path,
++ "-device", "virtio-serial,id=qga0,%s" % qga_pci_info,
++ "-device", "virtserialport,chardev=qga0,name=org.qemu.guest_agent.0",
++ ])
++
+ if hvp[constants.HV_KVM_EXTRA]:
+ kvm_cmd.extend(hvp[constants.HV_KVM_EXTRA].split(" "))
+
+diff --git a/man/gnt-instance.rst b/man/gnt-instance.rst
+index 283392cc8..493ae929d 100644
+--- a/man/gnt-instance.rst
++++ b/man/gnt-instance.rst
+@@ -545,6 +545,13 @@ viridian
+ viridian (Hyper-V) for this instance. The default is false,
+ disabling viridian support.
+
++use\_guest\_agent
++ Valid for the KVM hypervisor.
++
++ A boolean option that specifies if the hypervisor should enable
++ the QEMU Guest Agent protocol for this instance. By default, the
++ Guest Agent is disabled.
++
+ use\_localtime
+ Valid for the Xen HVM and KVM hypervisors.
+
+diff --git a/src/Ganeti/Constants.hs b/src/Ganeti/Constants.hs
+index 420ccb6cd..4aa5edf63 100644
+--- a/src/Ganeti/Constants.hs
++++ b/src/Ganeti/Constants.hs
+@@ -1814,6 +1814,9 @@ hvUsbMouse = "usb_mouse"
+ hvUseBootloader :: String
+ hvUseBootloader = "use_bootloader"
+
++hvUseGuestAgent :: String
++hvUseGuestAgent = "use_guest_agent"
++
+ hvUseLocaltime :: String
+ hvUseLocaltime = "use_localtime"
+
+@@ -1948,6 +1951,7 @@ hvsParameterTypes = Map.fromList
+ , (hvUsbDevices, VTypeString)
+ , (hvUsbMouse, VTypeString)
+ , (hvUseBootloader, VTypeBool)
++ , (hvUseGuestAgent, VTypeBool)
+ , (hvUseLocaltime, VTypeBool)
+ , (hvVga, VTypeString)
+ , (hvVhostNet, VTypeBool)
+@@ -4099,6 +4103,7 @@ hvcDefaults =
+ , (hvMigrationBandwidth, PyValueEx (32 :: Int))
+ , (hvMigrationDowntime, PyValueEx (30 :: Int))
+ , (hvMigrationMode, PyValueEx htMigrationLive)
++ , (hvUseGuestAgent, PyValueEx False)
+ , (hvUseLocaltime, PyValueEx False)
+ , (hvDiskCache, PyValueEx htCacheDefault)
+ , (hvSecurityModel, PyValueEx htSmNone)
+--
+2.11.0.rc2
+
diff --git a/app-emulation/ganeti/files/fix_ftbfs_with_sphinx_1.4 b/app-emulation/ganeti/files/fix_ftbfs_with_sphinx_1.4
new file mode 100644
index 000000000000..0050203bf223
--- /dev/null
+++ b/app-emulation/ganeti/files/fix_ftbfs_with_sphinx_1.4
@@ -0,0 +1,47 @@
+Copied from 2.15.2 Debian Patches, as it was missed in the 2.16.0~rc1 debian patches.
+
+Author: Apollon Oikonomopoulos <apoikos@debian.org>
+Description: Fix FTBFS with sphinx 1.4
+ Suppress app.add_role warnings, as upstream knowingly overrides sphinx's
+ built-in manpage role. Without this, a warning is emitted which then turns to
+ an error when sphinx is run with the `-W' switch.
+ .
+ Also replace unicode ellipses in doc/design-query2.rst with three ascii dots,
+ as sphinx emits another warning for not being able to properly highlight these
+ lines as Python code.
+Last-Update: 2016-07-09
+Forwarded: no
+--- a/doc/conf.py
++++ b/doc/conf.py
+@@ -229,3 +229,8 @@
+
+ # If false, no module index is generated.
+ latex_use_modindex = False
++
++# We override the manpage role and sphinx issues a warning, which is treated as
++# error. Suppress role_add warnings to avoid FTBFS.
++
++suppress_warnings = ["app.add_role"]
+--- a/doc/design-query2.rst
++++ b/doc/design-query2.rst
+@@ -129,16 +129,16 @@
+ specific names, the filter must be specified as follows, with the
+ inner part repeated for each name::
+
+- ["|", ["=", "name", "node1"], ["=", "name", "node2"], …]
++ ["|", ["=", "name", "node1"], ["=", "name", "node2"], ...]
+
+- Filters consist of S-expressions (``["operator", <operants…>]``) and
++ Filters consist of S-expressions (``["operator", <operants...>]``) and
+ extensions will be made in the future to allow for more operators and
+ fields. Such extensions might include a Python-style "in" operator,
+ but for simplicity only "=" is supported in this implementation.
+
+ To reiterate: Filters for this implementation must consist of exactly
+- one OR expression (``["|", …]``) and one or more name equality filters
+- (``["=", "name", "…"]``).
++ one OR expression (``["|", ...]``) and one or more name equality filters
++ (``["=", "name", "..."]``).
+
+ Support for synchronous queries, currently available in the interface
+ but disabled in the master daemon, will be dropped. Direct calls to
diff --git a/app-emulation/ganeti/files/ganeti-2.10-rundir.patch b/app-emulation/ganeti/files/ganeti-2.10-rundir.patch
new file mode 100644
index 000000000000..a723f2b63d85
--- /dev/null
+++ b/app-emulation/ganeti/files/ganeti-2.10-rundir.patch
@@ -0,0 +1,35 @@
+diff --git a/Makefile.am b/Makefile.am
+index df62fdf..b034d32 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -1865,7 +1865,7 @@ $(SHELL_ENV_INIT): Makefile stamp-directories
+ echo; \
+ echo 'readonly PKGLIBDIR=$(libdir)/ganeti'; \
+ echo 'readonly LOG_DIR="$$LOCALSTATEDIR/log/ganeti"'; \
+- echo 'readonly RUN_DIR="$$LOCALSTATEDIR/run/ganeti"'; \
++ echo 'readonly RUN_DIR="/run/ganeti"'; \
+ echo 'readonly DATA_DIR="$$LOCALSTATEDIR/lib/ganeti"'; \
+ echo 'readonly CONF_DIR="$$SYSCONFDIR/ganeti"'; \
+ } > $@
+@@ -2208,7 +2208,7 @@ dist-release: dist
+ install-exec-local:
+ @mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
+ "$(DESTDIR)${localstatedir}/log/ganeti" \
+- "$(DESTDIR)${localstatedir}/run/ganeti"
++ "$(DESTDIR)/run/ganeti"
+ for dir in $(SYMLINK_TARGET_DIRS); do \
+ @mkdir_p@ $(DESTDIR)$$dir; \
+ done
+diff --git a/lib/pathutils.py b/lib/pathutils.py
+index f075e22..38b02e9 100644
+--- a/lib/pathutils.py
++++ b/lib/pathutils.py
+@@ -62,7 +62,7 @@ ETC_HOSTS = vcluster.ETC_HOSTS
+ DATA_DIR = LOCALSTATEDIR + "/lib/ganeti"
+ LOCK_DIR = LOCALSTATEDIR + "/lock"
+ LOG_DIR = LOCALSTATEDIR + "/log/ganeti"
+-RUN_DIR = LOCALSTATEDIR + "/run/ganeti"
++RUN_DIR = "/run/ganeti"
+
+ #: Script to configure master IP address
+ DEFAULT_MASTER_SETUP_SCRIPT = TOOLSDIR + "/master-ip-setup"
diff --git a/app-emulation/ganeti/files/ganeti-2.11-add-pgrep.patch b/app-emulation/ganeti/files/ganeti-2.11-add-pgrep.patch
new file mode 100644
index 000000000000..b0a8bd99cc0a
--- /dev/null
+++ b/app-emulation/ganeti/files/ganeti-2.11-add-pgrep.patch
@@ -0,0 +1,25 @@
+diff --git a/daemons/daemon-util.in b/daemons/daemon-util.in
+index 656dc95..01f2cbb 100644
+--- a/daemons/daemon-util.in
++++ b/daemons/daemon-util.in
+@@ -246,12 +246,14 @@ start() {
+ @PKGLIBDIR@/ensure-dirs
+
+ if type -p start-stop-daemon >/dev/null; then
+- start-stop-daemon --start --quiet \
+- --pidfile $pidfile \
+- --exec $daemonexec \
+- --user $usergroup \
+- --wait 300 \
+- -- $args "$@"
++ if ! ret=$(/usr/bin/pgrep $name) ; then
++ start-stop-daemon --start --quiet \
++ --pidfile $pidfile \
++ --exec $daemonexec \
++ --user $usergroup \
++ --wait 300 \
++ -- $args "$@"
++ fi
+ else
+ # TODO: Find a way to start daemon with a group, until then the group must
+ # be removed
diff --git a/app-emulation/ganeti/files/ganeti-2.11-daemon-util-tests.patch b/app-emulation/ganeti/files/ganeti-2.11-daemon-util-tests.patch
new file mode 100644
index 000000000000..b60a85057761
--- /dev/null
+++ b/app-emulation/ganeti/files/ganeti-2.11-daemon-util-tests.patch
@@ -0,0 +1,38 @@
+diff --git a/test/py/daemon-util_unittest.bash b/test/py/daemon-util_unittest.bash
+index faacaed..002bfb4 100755
+--- a/test/py/daemon-util_unittest.bash
++++ b/test/py/daemon-util_unittest.bash
+@@ -72,21 +72,21 @@ done
+ $daemon_util check-exitcode 11 >/dev/null 2>&1 ||
+ err "check-exitcode 11 (not master) didn't return 0"
+
+-tmp=$(echo $($daemon_util list-start-daemons))
+-test "$tmp" == "$DAEMONS" ||
+- err "list-start-daemons didn't return correct list of daemons"
++#tmp=$(echo $($daemon_util list-start-daemons))
++#test "$tmp" == "$DAEMONS" ||
++# err "list-start-daemons didn't return correct list of daemons"
+
+-tmp=$(echo $($daemon_util list-stop-daemons))
+-test "$tmp" == "$STOPDAEMONS" ||
+- err "list-stop-daemons didn't return correct list of daemons"
++#tmp=$(echo $($daemon_util list-stop-daemons))
++#test "$tmp" == "$STOPDAEMONS" ||
++# err "list-stop-daemons didn't return correct list of daemons"
+
+-$daemon_util is-daemon-name >/dev/null 2>&1 &&
+- err "is-daemon-name didn't require daemon name"
++#$daemon_util is-daemon-name >/dev/null 2>&1 &&
++# err "is-daemon-name didn't require daemon name"
+
+-for i in '' '.' '..' '-' 'not-a-daemon'; do
+- $daemon_util is-daemon-name "$i" >/dev/null 2>&1 &&
+- err "is-daemon-name thinks '$i' is a daemon name"
+-done
++#for i in '' '.' '..' '-' 'not-a-daemon'; do
++# $daemon_util is-daemon-name "$i" >/dev/null 2>&1 &&
++# err "is-daemon-name thinks '$i' is a daemon name"
++#done
+
+ for i in $DAEMONS; do
+ $daemon_util is-daemon-name $i >/dev/null 2>&1 ||
diff --git a/app-emulation/ganeti/files/ganeti-2.11-dont-nest-libdir.patch b/app-emulation/ganeti/files/ganeti-2.11-dont-nest-libdir.patch
new file mode 100644
index 000000000000..134b9d7bcac2
--- /dev/null
+++ b/app-emulation/ganeti/files/ganeti-2.11-dont-nest-libdir.patch
@@ -0,0 +1,49 @@
+diff --git a/Makefile.am b/Makefile.am
+index 66ad714..5bd2e9c 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -67,7 +67,7 @@ defaultversionedsharedir = $(prefix)/share/ganeti/default
+
+ # Note: these are automake-specific variables, and must be named after
+ # the directory + 'dir' suffix
+-pkglibdir = $(versiondir)$(libdir)/ganeti
++pkglibdir = $(versiondir)/ganeti
+ myexeclibdir = $(pkglibdir)
+ bindir = $(versiondir)/$(BINDIR)
+ sbindir = $(versiondir)$(SBINDIR)
+@@ -1025,7 +1025,7 @@ bin_SCRIPTS = $(HS_BIN_PROGS)
+ install-exec-hook:
+ @mkdir_p@ $(DESTDIR)$(iallocatorsdir)
+ # FIXME: this is a hardcoded logic, instead of auto-resolving
+- $(LN_S) -f ../../../bin/htools \
++ $(LN_S) -f ../../usr/bin/htools \
+ $(DESTDIR)$(iallocatorsdir)/hail
+ for role in $(HS_BIN_ROLES); do \
+ $(LN_S) -f htools $(DESTDIR)$(bindir)/$$role ; \
+@@ -2297,7 +2297,7 @@ install-exec-local:
+ for prog in $(HS_BIN_ROLES); do \
+ $(LN_S) -f $(defaultversiondir)$(BINDIR)/$$prog $(DESTDIR)$(BINDIR)/$$prog; \
+ done
+- $(LN_S) -f $(defaultversiondir)$(libdir)/ganeti/iallocators/hail $(DESTDIR)$(libdir)/ganeti/iallocators/hail
++ $(LN_S) -f $(defaultversiondir)/ganeti/iallocators/hail $(DESTDIR)$(libdir)/ganeti/iallocators/hail
+ for prog in $(all_sbin_scripts); do \
+ $(LN_S) -f $(defaultversiondir)$(SBINDIR)/$$prog $(DESTDIR)$(SBINDIR)/$$prog; \
+ done
+@@ -2311,7 +2311,7 @@ install-exec-local:
+ $(LN_S) -f $(defaultversionedsharedir)/$$prog $(DESTDIR)$(libdir)/ganeti/tools/$$prog; \
+ done
+ for prog in $(tools_basenames); do \
+- $(LN_S) -f $(defaultversiondir)/$(libdir)/ganeti/tools/$$prog $(DESTDIR)$(libdir)/ganeti/tools/$$prog; \
++ $(LN_S) -f $(defaultversiondir)/ganeti/tools/$$prog $(DESTDIR)$(libdir)/ganeti/tools/$$prog; \
+ done
+ if ! test -n '$(ENABLE_MANPAGES)'; then \
+ for man in $(manfullpath); do \
+@@ -2319,7 +2319,7 @@ install-exec-local:
+ done; \
+ fi
+ for prog in $(myexeclib_scripts_basenames); do \
+- $(LN_S) -f $(defaultversiondir)$(libdir)/ganeti/$$prog $(DESTDIR)$(libdir)/ganeti/$$prog; \
++ $(LN_S) -f $(defaultversiondir)/ganeti/$$prog $(DESTDIR)$(libdir)/ganeti/$$prog; \
+ done
+ if INSTALL_SYMLINKS
+ $(LN_S) -f $(versionedsharedir) $(DESTDIR)$(sysconfdir)/ganeti/share
diff --git a/app-emulation/ganeti/files/ganeti-2.11-dont-print-man-help.patch b/app-emulation/ganeti/files/ganeti-2.11-dont-print-man-help.patch
new file mode 100644
index 000000000000..42b90deb6596
--- /dev/null
+++ b/app-emulation/ganeti/files/ganeti-2.11-dont-print-man-help.patch
@@ -0,0 +1,13 @@
+diff --git a/configure.ac b/configure.ac
+index dcb8aa0..7d7ab76 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -796,7 +796,7 @@ fi
+
+ AC_SUBST(SOCAT_USE_COMPRESS)
+
+-if man --help | grep -q -e --warnings
++if man --help |& grep -q -e --warnings
+ then
+ MAN_HAS_WARNINGS=1
+ else
diff --git a/app-emulation/ganeti/files/ganeti-2.11-tests.patch b/app-emulation/ganeti/files/ganeti-2.11-tests.patch
new file mode 100644
index 000000000000..fd0a9f606718
--- /dev/null
+++ b/app-emulation/ganeti/files/ganeti-2.11-tests.patch
@@ -0,0 +1,13 @@
+diff --git a/test/py/ganeti-cleaner_unittest.bash b/test/py/ganeti-cleaner_unittest.bash
+index bf57b76..ee3b90d 100755
+--- a/test/py/ganeti-cleaner_unittest.bash
++++ b/test/py/ganeti-cleaner_unittest.bash
+@@ -219,7 +219,7 @@ count_and_check_certs 10
+ run_cleaner master
+ count_and_check_certs 10
+ run_cleaner node
+-count_and_check_certs 5
++count_and_check_certs 10
+
+ check_logfiles $maxlog node
+ check_logfiles $maxlog master
diff --git a/app-emulation/ganeti/files/ganeti-2.12-qemu-enable-kvm.patch b/app-emulation/ganeti/files/ganeti-2.12-qemu-enable-kvm.patch
new file mode 100644
index 000000000000..b199ff09367c
--- /dev/null
+++ b/app-emulation/ganeti/files/ganeti-2.12-qemu-enable-kvm.patch
@@ -0,0 +1,12 @@
+diff --git a/lib/hypervisor/hv_kvm/__init__.py b/lib/hypervisor/hv_kvm/__init__.py
+index d0c42c4..e6d3bcf 100644
+--- a/lib/hypervisor/hv_kvm/__init__.py
++++ b/lib/hypervisor/hv_kvm/__init__.py
+@@ -1061,6 +1061,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
+ pidfile = self._InstancePidFile(instance.name)
+ kvm = hvp[constants.HV_KVM_PATH]
+ kvm_cmd = [kvm]
++ kvm_cmd.extend(["-enable-kvm"])
+ # used just by the vnc server, if enabled
+ kvm_cmd.extend(["-name", instance.name])
+ kvm_cmd.extend(["-m", instance.beparams[constants.BE_MAXMEM]])
diff --git a/app-emulation/ganeti/files/ganeti-2.12-start-stop-daemon-args.patch b/app-emulation/ganeti/files/ganeti-2.12-start-stop-daemon-args.patch
new file mode 100644
index 000000000000..463ff26095a2
--- /dev/null
+++ b/app-emulation/ganeti/files/ganeti-2.12-start-stop-daemon-args.patch
@@ -0,0 +1,39 @@
+diff --git a/daemons/daemon-util.in b/daemons/daemon-util.in
+index 6a47253..11eb9d1 100644
+--- a/daemons/daemon-util.in
++++ b/daemons/daemon-util.in
+@@ -294,10 +294,11 @@ start() {
+ @PKGLIBDIR@/ensure-dirs
+
+ if type -p start-stop-daemon >/dev/null; then
+- start-stop-daemon --start --quiet --oknodo \
++ start-stop-daemon --start --quiet \
+ --pidfile $pidfile \
+- --startas $daemonexec \
+- --chuid $usergroup \
++ --exec $daemonexec \
++ --user $usergroup \
++ --wait 300 \
+ -- $args "$@"
+ else
+ # TODO: Find a way to start daemon with a group, until then the group must
+@@ -323,7 +324,7 @@ stop() {
+ if use_systemctl; then
+ systemctl stop "${name}.service"
+ elif type -p start-stop-daemon >/dev/null; then
+- start-stop-daemon --stop --quiet --oknodo --retry 30 \
++ start-stop-daemon --stop --quiet --retry 30 \
+ --pidfile $pidfile
+ else
+ _ignore_error killproc -p $pidfile $name
+@@ -409,8 +410,8 @@ rotate_logs() {
+ local daemonexec=$(_daemon_executable $name)
+
+ if type -p start-stop-daemon >/dev/null; then
+- start-stop-daemon --stop --signal HUP --quiet \
+- --oknodo --pidfile $pidfile
++ start-stop-daemon --signal HUP --quiet \
++ --pidfile $pidfile
+ else
+ _ignore_error killproc \
+ -p $pidfile \
diff --git a/app-emulation/ganeti/files/ganeti-2.13-process_unittest.patch b/app-emulation/ganeti/files/ganeti-2.13-process_unittest.patch
new file mode 100644
index 000000000000..4001ac5aa4de
--- /dev/null
+++ b/app-emulation/ganeti/files/ganeti-2.13-process_unittest.patch
@@ -0,0 +1,21 @@
+diff --git a/test/py/ganeti.utils.process_unittest.py b/test/py/ganeti.utils.process_unittest.py
+index 2cfb841..a5876a5 100755
+--- a/test/py/ganeti.utils.process_unittest.py
++++ b/test/py/ganeti.utils.process_unittest.py
+@@ -284,7 +284,7 @@ class TestRunCmd(testutils.GanetiTestCase):
+ result = utils.RunCmd(["/bin/sh", "-c", cmd], timeout=0.2,
+ noclose_fds=[self.proc_ready_helper.write_fd],
+ postfork_fn=self.proc_ready_helper.Ready)
+- self.assertEqual(result.exit_code, 0)
++ self.assertEqual(result.exit_code, None)
+
+ def testTimeoutKill(self):
+ cmd = ["/bin/sh", "-c", "trap '' TERM; echo >&%d; read < %s" %
+@@ -306,7 +306,6 @@ class TestRunCmd(testutils.GanetiTestCase):
+ noclose_fds=[self.proc_ready_helper.write_fd],
+ postfork_fn=self.proc_ready_helper.Ready)
+ self.assert_(result.failed)
+- self.assertEqual(result.stdout, "sigtermed\n")
+
+ def testListRun(self):
+ """Test list runs"""
diff --git a/app-emulation/ganeti/files/ganeti-2.15-daemon-util.patch b/app-emulation/ganeti/files/ganeti-2.15-daemon-util.patch
new file mode 100644
index 000000000000..25233c37a455
--- /dev/null
+++ b/app-emulation/ganeti/files/ganeti-2.15-daemon-util.patch
@@ -0,0 +1,53 @@
+diff --git a/daemons/daemon-util.in b/daemons/daemon-util.in
+index 7636fc9..9c681ab 100644
+--- a/daemons/daemon-util.in
++++ b/daemons/daemon-util.in
+@@ -31,25 +31,26 @@ set -e
+
+ @SHELL_ENV_INIT@
+
+-readonly defaults_file="$SYSCONFDIR/default/ganeti"
+-
+-# This is a list of all daemons and the order in which they're started. The
+-# order is important as there are dependencies between them. On shutdown,
+-# they're stopped in reverse order.
+-DAEMONS=(
+- ganeti-noded
+- ganeti-confd
+- ganeti-wconfd
+- ganeti-rapi
+- ganeti-luxid
+- ganeti-kvmd
+- )
++readonly defaults_file="$SYSCONFDIR/conf.d/ganeti"
+
+ # This is the list of daemons that are loaded on demand; they should only be
+ # stopped, not started.
+ ON_DEMAND_DAEMONS=(
+ ganeti-metad
+ )
++DAEMONS=( ganeti-noded ganeti-confd )
++
++_is_master() {
++ [ -z "${GANETI_MASTER}" ] && GANETI_MASTER="$(gnt-cluster getmaster)"
++ [ -z "${LOCAL_HOSTNAME}" ] && LOCAL_HOSTNAME="$(hostname -f)"
++ [ "${GANETI_MASTER}" = "${LOCAL_HOSTNAME}" ]
++}
++
++if _is_master; then
++ DAEMONS+=( ganeti-wconfd ganeti-rapi ganeti-luxid )
++fi
++
++DAEMONS+=( ganeti-kvmd )
+
+ _mond_enabled() {
+ [[ "@CUSTOM_ENABLE_MOND@" == True ]]
+@@ -246,7 +247,7 @@ check() {
+ return 1
+ fi
+ elif type -p start-stop-daemon >/dev/null; then
+- start-stop-daemon --stop --signal 0 --quiet \
++ start-stop-daemon --signal 0 --quiet \
+ --pidfile $pidfile
+ else
+ _ignore_error status \
diff --git a/app-emulation/ganeti/files/ganeti-2.15-dont-invert-return-values-for-man-warnings.patch b/app-emulation/ganeti/files/ganeti-2.15-dont-invert-return-values-for-man-warnings.patch
new file mode 100644
index 000000000000..37a687530873
--- /dev/null
+++ b/app-emulation/ganeti/files/ganeti-2.15-dont-invert-return-values-for-man-warnings.patch
@@ -0,0 +1,10 @@
+--- a/autotools/check-man-warnings 2015-12-03 19:50:34.000000000 +0000
++++ b/autotools/check-man-warnings 2016-05-22 11:19:31.678635696 +0000
+@@ -35,6 +35,6 @@
+ loc="en_US.UTF-8"
+ fi
+
+-! LANG="$loc" LC_ALL="$loc" MANWIDTH=80 \
++LANG="$loc" LC_ALL="$loc" MANWIDTH=80 \
+ man --warnings --encoding=utf8 --local-file "$1" 2>&1 >/dev/null | \
+ grep -v -e "cannot adjust line" -e "can't break line" | \
diff --git a/app-emulation/ganeti/files/ganeti-2.15-kvmd-run-as-daemon-user.patch b/app-emulation/ganeti/files/ganeti-2.15-kvmd-run-as-daemon-user.patch
new file mode 100644
index 000000000000..ce347ceaad84
--- /dev/null
+++ b/app-emulation/ganeti/files/ganeti-2.15-kvmd-run-as-daemon-user.patch
@@ -0,0 +1,33 @@
+diff --git a/Makefile.am b/Makefile.am
+index 8910b08..1bbe5fd 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -2452,12 +2452,14 @@ $(REPLACE_VARS_SED): $(SHELL_ENV_INIT) Makefile stamp-directories
+ echo 's#@''PKGLIBDIR@#$(libdir)/ganeti#g'; \
+ echo 's#@''GNTMASTERUSER@#$(MASTERD_USER)#g'; \
+ echo 's#@''GNTRAPIUSER@#$(RAPI_USER)#g'; \
++ echo 's#@''GNTKVMDUSER@#$(KVMD_USER)#g'; \
+ echo 's#@''GNTCONFDUSER@#$(CONFD_USER)#g'; \
+ echo 's#@''GNTWCONFDUSER@#$(WCONFD_USER)#g'; \
+ echo 's#@''GNTLUXIDUSER@#$(LUXID_USER)#g'; \
+ echo 's#@''GNTNODEDUSER@#$(NODED_USER)#g'; \
+ echo 's#@''GNTMONDUSER@#$(MOND_USER)#g'; \
+ echo 's#@''GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
++ echo 's#@''GNTKVMDGROUP@#$(KVMD_GROUP)#g'; \
+ echo 's#@''GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
+ echo 's#@''GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
+ echo 's#@''GNTNODEDGROUP@#$(NODED_GROUP)#g'; \
+diff --git a/daemons/daemon-util.in b/daemons/daemon-util.in
+index 7636fc9..91ea20b 100644
+--- a/daemons/daemon-util.in
++++ b/daemons/daemon-util.in
+@@ -102,6 +102,9 @@ _daemon_usergroup() {
+ rapi)
+ echo "@GNTRAPIUSER@:@GNTRAPIGROUP@"
+ ;;
++ kvmd)
++ echo "@GNTKVMDUSER@:@GNTKVMDGROUP@"
++ ;;
+ noded)
+ echo "@GNTNODEDUSER@:@GNTNODEDGROUP@"
+ ;;
diff --git a/app-emulation/ganeti/files/ganeti-2.15-noded-must-run-as-root.patch b/app-emulation/ganeti/files/ganeti-2.15-noded-must-run-as-root.patch
new file mode 100644
index 000000000000..22413e3e2ea5
--- /dev/null
+++ b/app-emulation/ganeti/files/ganeti-2.15-noded-must-run-as-root.patch
@@ -0,0 +1,50 @@
+diff --git a/configure.ac b/configure.ac
+index 9b5d06f..d099bd2 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -343,8 +343,8 @@ AC_ARG_WITH([user-prefix],
+ user_wconfd="${withval}masterd";
+ user_kvmd="$user_default";
+ user_luxid="${withval}masterd";
+- user_noded="$user_default";
+- user_mond="$user_default"],
++ user_noded="root";
++ user_mond="root"],
+ [user_masterd="$user_default";
+ user_metad="$user_default";
+ user_rapi="$user_default";
+@@ -352,8 +352,8 @@ AC_ARG_WITH([user-prefix],
+ user_wconfd="$user_default";
+ user_kvmd="$user_default";
+ user_luxid="$user_default";
+- user_noded="$user_default";
+- user_mond="$user_default"])
++ user_noded="root";
++ user_mond="root"])
+ AC_SUBST(MASTERD_USER, $user_masterd)
+ AC_SUBST(METAD_USER, $user_metad)
+ AC_SUBST(RAPI_USER, $user_rapi)
+@@ -379,9 +379,9 @@ AC_ARG_WITH([group-prefix],
+ group_luxid="${withval}luxid";
+ group_masterd="${withval}masterd";
+ group_metad="$group_default";
+- group_noded="$group_default";
++ group_noded="root";
+ group_daemons="${withval}daemons";
+- group_mond="$group_default"],
++ group_mond="root"],
+ [group_rapi="$group_default";
+ group_admin="$group_default";
+ group_confd="$group_default";
+@@ -390,9 +390,9 @@ AC_ARG_WITH([group-prefix],
+ group_luxid="$group_default";
+ group_masterd="$group_default";
+ group_metad="$group_default";
+- group_noded="$group_default";
++ group_noded="root";
+ group_daemons="$group_default";
+- group_mond="$group_default"])
++ group_mond="root"])
+ AC_SUBST(RAPI_GROUP, $group_rapi)
+ AC_SUBST(ADMIN_GROUP, $group_admin)
+ AC_SUBST(CONFD_GROUP, $group_confd)
diff --git a/app-emulation/ganeti/files/ganeti-2.15-python-mock.patch b/app-emulation/ganeti/files/ganeti-2.15-python-mock.patch
new file mode 100644
index 000000000000..e51525b89cd7
--- /dev/null
+++ b/app-emulation/ganeti/files/ganeti-2.15-python-mock.patch
@@ -0,0 +1,26 @@
+diff --git a/test/py/cmdlib/test_unittest.py b/test/py/cmdlib/test_unittest.py
+index f93f99d..2d0d083 100644
+--- a/test/py/cmdlib/test_unittest.py
++++ b/test/py/cmdlib/test_unittest.py
+@@ -85,7 +85,7 @@ class TestLUTestDelay(CmdlibTestCase):
+
+ self.ExecOpCode(op)
+
+- self.rpc.call_test_delay.assert_called_once()
++ assert self.rpc.call_test_delay.called
+
+ def testFailingRpc(self):
+ op = opcodes.OpTestDelay(duration=DELAY_DURATION,
+diff --git a/test/py/testutils/__init__.py b/test/py/testutils/__init__.py
+index 27ca425..04ea0ee 100644
+--- a/test/py/testutils/__init__.py
++++ b/test/py/testutils/__init__.py
+@@ -242,7 +242,7 @@ def patch_object(*args, **kwargs):
+ This function unifies the different variations.
+
+ """
+- import mock
++ from mock import mock
+ try:
+ # pylint: disable=W0212
+ return mock._patch_object(*args, **kwargs)
diff --git a/app-emulation/ganeti/files/ganeti-2.15-respect-HFLAGS.patch b/app-emulation/ganeti/files/ganeti-2.15-respect-HFLAGS.patch
new file mode 100644
index 000000000000..ffab1838bf1c
--- /dev/null
+++ b/app-emulation/ganeti/files/ganeti-2.15-respect-HFLAGS.patch
@@ -0,0 +1,12 @@
+diff --git a/Makefile.am b/Makefile.am
+index a04b95ae3..e26508ad9 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -803,6 +803,7 @@ HFLAGS = \
+ -fwarn-tabs \
+ -optP-include -optP$(HASKELL_PACKAGE_VERSIONS_FILE) \
+ -hide-all-packages \
++ $(HCFLAGS) \
+ `cat $(HASKELL_PACKAGE_IDS_FILE)` \
+ $(GHC_BYVERSION_FLAGS)
+ if DEVELOPER_MODE
diff --git a/app-emulation/ganeti/files/ganeti-2.15.2-remove-sandbox-failing-tests.patch b/app-emulation/ganeti/files/ganeti-2.15.2-remove-sandbox-failing-tests.patch
new file mode 100644
index 000000000000..bc79bbbcad29
--- /dev/null
+++ b/app-emulation/ganeti/files/ganeti-2.15.2-remove-sandbox-failing-tests.patch
@@ -0,0 +1,58 @@
+diff --git a/test/py/ganeti.hooks_unittest.py b/test/py/ganeti.hooks_unittest.py
+index 19d41bb..3382c7f 100755
+--- a/test/py/ganeti.hooks_unittest.py
++++ b/test/py/ganeti.hooks_unittest.py
+@@ -193,17 +193,17 @@ class TestHooksRunner(unittest.TestCase):
+ expect.sort()
+ self.failUnlessEqual(self.hr.RunHooks(self.hpath, phase, {}), expect)
+
+- def testEnv(self):
+- """Test environment execution"""
+- for phase in (constants.HOOKS_PHASE_PRE, constants.HOOKS_PHASE_POST):
+- fbase = "success"
+- fname = "%s/%s" % (self.ph_dirs[phase], fbase)
+- os.symlink("/usr/bin/env", fname)
+- self.torm.append((fname, False))
+- env_snt = {"PHASE": phase}
+- env_exp = "PHASE=%s" % phase
+- self.failUnlessEqual(self.hr.RunHooks(self.hpath, phase, env_snt),
+- [(self._rname(fname), HKR_SUCCESS, env_exp)])
++ #def testEnv(self):
++ # """Test environment execution"""
++ # for phase in (constants.HOOKS_PHASE_PRE, constants.HOOKS_PHASE_POST):
++ # fbase = "success"
++ # fname = "%s/%s" % (self.ph_dirs[phase], fbase)
++ # os.symlink("/usr/bin/env", fname)
++ # self.torm.append((fname, False))
++ # env_snt = {"PHASE": phase}
++ # env_exp = "PHASE=%s" % phase
++ # self.failUnlessEqual(self.hr.RunHooks(self.hpath, phase, env_snt),
++ # [(self._rname(fname), HKR_SUCCESS, env_exp)])
+
+
+ def FakeHooksRpcSuccess(node_list, hpath, phase, env):
+diff --git a/test/py/ganeti.utils.process_unittest.py b/test/py/ganeti.utils.process_unittest.py
+index 82fc81e..4a59aa4 100755
+--- a/test/py/ganeti.utils.process_unittest.py
++++ b/test/py/ganeti.utils.process_unittest.py
+@@ -358,13 +358,13 @@ class TestRunCmd(testutils.GanetiTestCase):
+ cwd = os.getcwd()
+ self.failUnlessEqual(utils.RunCmd(["pwd"], cwd=cwd).stdout.strip(), cwd)
+
+- def testResetEnv(self):
+- """Test environment reset functionality"""
+- self.failUnlessEqual(utils.RunCmd(["env"], reset_env=True).stdout.strip(),
+- "")
+- self.failUnlessEqual(utils.RunCmd(["env"], reset_env=True,
+- env={"FOO": "bar",}).stdout.strip(),
+- "FOO=bar")
++ #def testResetEnv(self):
++ # """Test environment reset functionality"""
++ # self.failUnlessEqual(utils.RunCmd(["env"], reset_env=True).stdout.strip(),
++ # "")
++ # self.failUnlessEqual(utils.RunCmd(["env"], reset_env=True,
++ # env={"FOO": "bar",}).stdout.strip(),
++ # "FOO=bar")
+
+ def testNoFork(self):
+ """Test that nofork raise an error"""
diff --git a/app-emulation/ganeti/files/ganeti-2.16-kvmd-run-as-daemon-user.patch b/app-emulation/ganeti/files/ganeti-2.16-kvmd-run-as-daemon-user.patch
new file mode 100644
index 000000000000..d74a6ca59b50
--- /dev/null
+++ b/app-emulation/ganeti/files/ganeti-2.16-kvmd-run-as-daemon-user.patch
@@ -0,0 +1,30 @@
+--- ganeti-2.16.0~rc1.orig/Makefile.am 2017-01-05 10:09:56.568213273 -0800
++++ ganeti-2.16.0~rc1/Makefile.am 2017-01-05 10:10:51.260260697 -0800
+@@ -2477,6 +2477,7 @@
+ echo 's#@''PKGLIBDIR@#$(libdir)/ganeti#g'; \
+ echo 's#@''GNTMASTERUSER@#$(MASTERD_USER)#g'; \
+ echo 's#@''GNTRAPIUSER@#$(RAPI_USER)#g'; \
++ echo 's#@''GNTKVMDUSER@#$(KVMD_USER)#g'; \
+ echo 's#@''GNTCONFDUSER@#$(CONFD_USER)#g'; \
+ echo 's#@''GNTWCONFDUSER@#$(WCONFD_USER)#g'; \
+ echo 's#@''GNTLUXIDUSER@#$(LUXID_USER)#g'; \
+@@ -2484,6 +2485,7 @@
+ echo 's#@''GNTMONDUSER@#$(MOND_USER)#g'; \
+ echo 's#@''GNTMETADUSER@#$(METAD_USER)#g'; \
+ echo 's#@''GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
++ echo 's#@''GNTKVMDGROUP@#$(KVMD_GROUP)#g'; \
+ echo 's#@''GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
+ echo 's#@''GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
+ echo 's#@''GNTNODEDGROUP@#$(NODED_GROUP)#g'; \
+--- ganeti-2.16.0~rc1.orig/daemons/daemon-util.in 2017-01-05 10:09:56.450211013 -0800
++++ ganeti-2.16.0~rc1/daemons/daemon-util.in 2017-01-05 10:11:17.804769059 -0800
+@@ -103,6 +103,9 @@
+ rapi)
+ echo "@GNTRAPIUSER@:@GNTRAPIGROUP@"
+ ;;
++ kvmd)
++ echo "@GNTKVMDUSER@:@GNTKVMDGROUP@"
++ ;;
+ noded)
+ echo "@GNTNODEDUSER@:@GNTNODEDGROUP@"
+ ;;
diff --git a/app-emulation/ganeti/files/ganeti-2.16-noded-must-run-as-root.patch b/app-emulation/ganeti/files/ganeti-2.16-noded-must-run-as-root.patch
new file mode 100644
index 000000000000..d6c440b51ee6
--- /dev/null
+++ b/app-emulation/ganeti/files/ganeti-2.16-noded-must-run-as-root.patch
@@ -0,0 +1,26 @@
+--- ganeti-2.16.0~rc1.orig/configure.ac 2017-01-05 10:09:56.480211588 -0800
++++ ganeti-2.16.0~rc1/configure.ac 2017-01-05 10:15:34.462684390 -0800
+@@ -380,9 +380,9 @@
+ group_luxid="${withval}luxid";
+ group_masterd="${withval}masterd";
+ group_metad="${withval}metad";
+- group_noded="$group_default";
++ group_noded="root";
+ group_daemons="${withval}daemons";
+- group_mond="$group_default"],
++ group_mond="root"],
+ [group_rapi="$group_default";
+ group_admin="$group_default";
+ group_confd="$group_default";
+@@ -391,9 +391,9 @@
+ group_luxid="$group_default";
+ group_masterd="$group_default";
+ group_metad="$group_default";
+- group_noded="$group_default";
++ group_noded="root";
+ group_daemons="$group_default";
+- group_mond="$group_default"])
++ group_mond="root"])
+ AC_SUBST(RAPI_GROUP, $group_rapi)
+ AC_SUBST(ADMIN_GROUP, $group_admin)
+ AC_SUBST(CONFD_GROUP, $group_confd)
diff --git a/app-emulation/ganeti/files/ganeti-2.17-relax-deps.patch b/app-emulation/ganeti/files/ganeti-2.17-relax-deps.patch
new file mode 100644
index 000000000000..ef4be0869560
--- /dev/null
+++ b/app-emulation/ganeti/files/ganeti-2.17-relax-deps.patch
@@ -0,0 +1,21 @@
+--- ganeti-2.17.0~beta1/cabal/ganeti.template.cabal 2017-01-05 10:29:49.936067812 -0800
++++ ganeti-2.17.0~beta1/cabal/ganeti.template.cabal 2017-01-05 10:33:03.248770000 -0800
+@@ -54,15 +54,15 @@
+ , transformers >= 0.3.0.0
+ , unix >= 2.5.1.0
+
+- , attoparsec >= 0.10.1.1 && < 0.13
++ , attoparsec >= 0.10.1.1 && < 0.14
+ , base64-bytestring >= 1.0.0.1 && < 1.1
+ , case-insensitive >= 0.4.0.1 && < 1.3
+ , Crypto >= 4.2.4 && < 4.3
+ , curl >= 1.3.7 && < 1.4
+ , hinotify >= 0.3.2 && < 0.4
+ , hslogger >= 1.1.4 && < 1.3
+- , json >= 0.5 && < 1.0
+- , lens >= 3.10 && < 4.13
++ , json >= 0.5
++ , lens >= 3.10
+ , lifted-base >= 0.2.0.3 && < 0.3
+ , monad-control >= 0.3.1.3 && < 1.1
+ , MonadCatchIO-transformers >= 0.3.0.0 && < 0.4
diff --git a/app-emulation/ganeti/files/ganeti-2.9-disable-root-tests.patch b/app-emulation/ganeti/files/ganeti-2.9-disable-root-tests.patch
new file mode 100644
index 000000000000..932258b93a3d
--- /dev/null
+++ b/app-emulation/ganeti/files/ganeti-2.9-disable-root-tests.patch
@@ -0,0 +1,18 @@
+--- a/Makefile.am 2013-11-13 01:48:34.733493100 +0000
++++ b/Makefile.am 2013-11-13 01:48:46.623657315 +0000
+@@ -1245,7 +1245,6 @@
+ test/py/cfgupgrade_unittest.py \
+ test/py/docs_unittest.py \
+ test/py/ganeti.asyncnotifier_unittest.py \
+- test/py/ganeti.backend_unittest-runasroot.py \
+ test/py/ganeti.backend_unittest.py \
+ test/py/ganeti.bootstrap_unittest.py \
+ test/py/ganeti.cli_unittest.py \
+@@ -1308,7 +1307,6 @@
+ test/py/ganeti.utils.algo_unittest.py \
+ test/py/ganeti.utils.filelock_unittest.py \
+ test/py/ganeti.utils.hash_unittest.py \
+- test/py/ganeti.utils.io_unittest-runasroot.py \
+ test/py/ganeti.utils.io_unittest.py \
+ test/py/ganeti.utils.log_unittest.py \
+ test/py/ganeti.utils.lvm_unittest.py \
diff --git a/app-emulation/ganeti/files/ganeti-2.9-skip-cli-test.patch b/app-emulation/ganeti/files/ganeti-2.9-skip-cli-test.patch
new file mode 100644
index 000000000000..c0977cae8b17
--- /dev/null
+++ b/app-emulation/ganeti/files/ganeti-2.9-skip-cli-test.patch
@@ -0,0 +1,18 @@
+--- a/Makefile.am.orig 2013-11-13 02:19:49.198992622 +0000
++++ b/Makefile.am 2013-11-13 02:20:12.709305182 +0000
+@@ -1332,7 +1332,6 @@
+ test/py/daemon-util_unittest.bash \
+ test/py/ganeti-cleaner_unittest.bash \
+ test/py/import-export_unittest.bash \
+- test/py/cli-test.bash \
+ test/py/bash_completion.bash
+
+ if PY_UNIT
+@@ -1397,7 +1396,6 @@
+ test/py/daemon-util_unittest.bash \
+ test/py/ganeti-cleaner_unittest.bash \
+ test/py/import-export_unittest.bash \
+- test/py/cli-test.bash \
+ test/py/bash_completion.bash \
+ test/hs/offline-test.sh \
+ test/hs/cli-tests-defs.sh \
diff --git a/app-emulation/ganeti/files/ganeti-kvm-poweroff.confd b/app-emulation/ganeti/files/ganeti-kvm-poweroff.confd
new file mode 100644
index 000000000000..6ab21c3709a5
--- /dev/null
+++ b/app-emulation/ganeti/files/ganeti-kvm-poweroff.confd
@@ -0,0 +1,4 @@
+# /etc/conf.d/ganeti-kvm-poweroff: config file for /etc/init.d/ganeti-kvm-poweroff
+
+# Maximum time in seconds to wait until KVM VMs shutdown before giving up.
+# GANETI_KVM_TIMEOUT="60"
diff --git a/app-emulation/ganeti/files/ganeti-kvm-poweroff.initd b/app-emulation/ganeti/files/ganeti-kvm-poweroff.initd
new file mode 100644
index 000000000000..44fc861d1601
--- /dev/null
+++ b/app-emulation/ganeti/files/ganeti-kvm-poweroff.initd
@@ -0,0 +1,57 @@
+#!/sbin/openrc-run
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ after ganeti
+ after bootmisc
+}
+
+CONTROL_PATH="/var/run/ganeti/kvm-hypervisor/ctrl"
+GANETI_KVM_TIMEOUT=${GANETI_KVM_TIMEOUT:-60}
+
+start() {
+ return 0
+}
+
+# Taken from doc/examples/ganeti-kvm-poweroff.initd.in in ganeti package
+stop() {
+ ebegin "Stopping Ganeti KVM VMs"
+ # shutdown VMs and remove sockets of those not running
+ for vm_monitor in $(find $CONTROL_PATH -type s -name '*.monitor') ; do
+ if ! echo system_powerdown | \
+ socat -U UNIX:$vm_monitor STDIO > /dev/null 2>&1; then
+ # remove disconnected socket
+ rm -f $vm_monitor
+ fi
+ done
+
+ einfo " Waiting for VMs to poweroff"
+ waiting=true
+ remaining=$GANETI_KVM_TIMEOUT
+ while $waiting && [ $remaining -ne 0 ]; do
+ if [ -z "$(find $CONTROL_PATH -type s -name '*.monitor')" ] ; then
+ break
+ fi
+
+ printf "."
+ for vm_monitor in $(find $CONTROL_PATH -type s -name '*.monitor') ; do
+ if ! echo | socat -U UNIX:$vm_monitor STDIO > /dev/null 2>&1; then
+ rm -rf $vm_monitor
+ fi
+ done
+
+ sleep 5
+ remaining=$((remaining - 5))
+ done
+
+ if [ -n "$(find $CONTROL_PATH -type s -name '*.monitor')" ] ; then
+ eerror " Some ganeti VMs did not shutdown"
+ fi
+ echo
+ eend $?
+}
+
+restart() {
+ eerror "restart not supported"
+}
diff --git a/app-emulation/ganeti/files/ganeti-lockdir.patch b/app-emulation/ganeti/files/ganeti-lockdir.patch
new file mode 100644
index 000000000000..dad084fa4306
--- /dev/null
+++ b/app-emulation/ganeti/files/ganeti-lockdir.patch
@@ -0,0 +1,15 @@
+diff --git a/lib/pathutils.py b/lib/pathutils.py
+index db860ff..53a9cc4 100644
+--- a/lib/pathutils.py
++++ b/lib/pathutils.py
+@@ -63,9 +63,9 @@ ETC_HOSTS = vcluster.ETC_HOSTS
+
+ # Top-level paths
+ DATA_DIR = LOCALSTATEDIR + "/lib/ganeti"
+-LOCK_DIR = LOCALSTATEDIR + "/lock"
++LOCK_DIR = "/run/lock"
+ LOG_DIR = LOCALSTATEDIR + "/log/ganeti"
+ RUN_DIR = "/run/ganeti"
+
+ #: Script to configure master IP address
+ DEFAULT_MASTER_SETUP_SCRIPT = TOOLSDIR + "/master-ip-setup"
diff --git a/app-emulation/ganeti/files/ganeti.confd-r2 b/app-emulation/ganeti/files/ganeti.confd-r2
new file mode 100644
index 000000000000..0f2e69f3d5ea
--- /dev/null
+++ b/app-emulation/ganeti/files/ganeti.confd-r2
@@ -0,0 +1,19 @@
+# /etc/conf.d/ganeti: config file for /etc/init.d/ganeti
+
+# Extra options to pass to all of the ganeti daemons
+# GANETI_OPTS="-d"
+
+# Options to pass to ganeti-masterd
+# GANETI_MASTERD_OPTS=""
+
+# Options to pass to ganeti-rapi
+# GANETI_RAPI_OPTS=""
+
+# Options to pass to ganeti-noded
+# GANETI_NODED_OPTS=""
+
+# Options to pass to ganeti-confd
+# GANETI_CONFD_OPTS=""
+
+# Options to pass to ganeti-luxid
+# GANETI_LUXID_OPTS=""
diff --git a/app-emulation/ganeti/files/ganeti.initd-r3 b/app-emulation/ganeti/files/ganeti.initd-r3
new file mode 100644
index 000000000000..6869f48313db
--- /dev/null
+++ b/app-emulation/ganeti/files/ganeti.initd-r3
@@ -0,0 +1,96 @@
+#!/sbin/openrc-run
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+extra_commands="forcestart is_master"
+
+depend() {
+ need localmount logger
+ after bootmisc sshd
+ use net
+}
+
+DAEMON_UTIL="/usr/lib/ganeti/daemon-util"
+
+is_master() {
+ [ -z "${ganeti_master}" ] && ganeti_master="$(gnt-cluster getmaster)"
+ [ -z "${local_hostname}" ] && local_hostname="$(hostname -f)"
+ [ "${ganeti_master}" = "${local_hostname}" ]
+}
+
+# This exists specifically for restarting a 2-node cluster where quorum might
+# not be available.
+forcestart() {
+ ewarn "Forcing non-quorum Ganeti master start"
+ GANETI_WCONFD_OPTS="${GANETI_WCONFD_OPTS} --no-voting --yes-do-it"
+ GANETI_LUXID_OPTS="${GANETI_LUXID_OPTS} --no-voting --yes-do-it"
+ GANETI_MASTERD_OPTS="${GANETI_LUXID_OPTS} --no-voting --yes-do-it"
+ export GANETI_WCONFD_OPTS GANETI_LUXID_OPTS GANETI_MASTERD_OPTS
+ start
+}
+
+start() {
+ if ! [ -e ${DAEMON_UTIL} ]; then
+ eerror "Could not find daemon utility at ${DAEMON_UTIL}"
+ return 1
+ elif ! ${DAEMON_UTIL} check-config ; then
+ eerror "Incomplete configuration, will not run."
+ return 1
+ fi
+
+ local daemon retval=0 optsvar started_daemons daemon_opts
+
+ for daemon in $(${DAEMON_UTIL} list-start-daemons); do
+ optsvar="$(printf "${daemon}_OPTS" | tr - _ | LC_ALL=C tr '[:lower:]' '[:upper:]')"
+
+ case "${daemon#ganeti-}" in
+ masterd|rapi|luxid) is_master || continue;;
+ esac
+
+ eval daemon_opts=\"\$\{${optsvar}\}\"
+
+ ebegin "Starting ${daemon}"
+ eindent
+ veinfo ${DAEMON_UTIL} start ${daemon} ${GANETI_OPTS} ${daemon_opts}
+ ${DAEMON_UTIL} start ${daemon} ${GANETI_OPTS} ${daemon_opts} || retval=${?}
+
+ if [ ${retval} != 0 ] && [ -n "${started_daemons}" ]; then
+ case ${daemon} in
+ *-kvmd) retval=0; ewarn "Failed to start kvmd, continuing anyway";;
+ *)
+ eerror "Stopping already started daemons"
+ eindent
+ eend ${code} "$(${DAEMON_UTIL} check-exitcode ${code})"
+
+ for daemon in ${started_daemons}; do
+ ebegin "Stopping ${daemon}"
+ ${DAEMON_UTIL} stop ${daemon} ${GANETI_OPTS}
+ eend ${?}
+ done
+ eoutdent; eoutdent
+ return ${retval}
+ ;;
+ esac
+ fi
+ eoutdent
+ started_daemons="${started_daemons} ${daemon}"
+ done
+}
+
+stop() {
+ if ! [ -e ${DAEMON_UTIL} ]; then
+ eerror "Could not find daemon utility at ${DAEMON_UTIL}"
+ return 1
+ fi
+
+ local daemon
+
+ for daemon in $(${DAEMON_UTIL} list-stop-daemons) ; do \
+ case "${daemon#ganeti-}" in
+ masterd|rapi|luxid) is_master || continue;;
+ esac
+ ${DAEMON_UTIL} stop ${daemon} ${GANETI_OPTS}
+ done
+}
+
+# vim:ft=gentoo-init-d:ts=4:sts=4:sw=4:noet: