diff --git a/libvirt.changes b/libvirt.changes index 096bdc7..7aec582 100644 --- a/libvirt.changes +++ b/libvirt.changes @@ -1,3 +1,29 @@ +------------------------------------------------------------------- +Fri Jan 27 17:53:23 UTC 2017 - jfehlig@suse.com + +- Fix dom0 ballooning with Xen >= 4.8 + libxl-dom0-balloon-fix.patch + bsc#1020755 + +------------------------------------------------------------------- +Fri Jan 27 17:31:32 UTC 2017 - jfehlig@suse.com + +- SLE12 SP2 bugs merged via version updates of the Factory libvirt + package: + bsc#996020, bsc#987002, bsc#997278, bsc#998005, bsc#998389, + bsc#1001446, bsc#1001698, bsc#1005288, bsc#1013991, bsc#1016253, + bsc#1017086, bsc#1017762, bsc#1018189 + +------------------------------------------------------------------- +Fri Jan 27 17:01:39 UTC 2017 - jfehlig@suse.com + +- virt-create-rootfs is a temporary SLE-only hack that was never + added to the Factory libvirt package, causing it to be dropped + when rebasing SLE on Factory. Add it now but only apply + associated patch when building for SLE. + virt-create-rootfs.patch + bsc#995981 + ------------------------------------------------------------------- Wed Jan 18 23:34:31 UTC 2017 - jfehlig@suse.com diff --git a/libvirt.spec b/libvirt.spec index 95bfe55..695ba82 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -316,6 +316,7 @@ Source100: %{name}-rpmlintrc Patch0: b018ada3-shunloadtest-build-fix.patch # Patches pending upstream review Patch100: libxl-dom-reset.patch +Patch101: libxl-dom0-balloon-fix.patch # Need to go upstream Patch150: xen-pv-cdrom.patch Patch151: blockcopy-check-dst-identical-device.patch @@ -344,6 +345,10 @@ Patch214: libxl-qemu-emulator-caps.patch # are resolved. See # https://www.redhat.com/archives/libvir-list/2017-January/msg00790.html Patch300: qemu-disable-namespaces.patch +# SLES-Only patches +%if %{with_sle_build} +Patch400: virt-create-rootfs.patch +%endif BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -720,9 +725,9 @@ capabilities of recent versions of Linux (and other OSes). %package libs Summary: Client side libraries +Group: Development/Libraries/C and C++ # So remote clients can access libvirt over SSH tunnel # (client invokes 'nc' against the UNIX socket on the server) -Group: Development/Libraries/C and C++ Requires: netcat-openbsd # Not technically required, but makes 'out-of-box' config # work correctly & doesn't have onerous dependencies @@ -790,6 +795,7 @@ libvirt plugin for NSS for translating domain names into IP addresses. %setup -q %patch0 -p1 %patch100 -p1 +%patch101 -p1 %patch150 -p1 %patch151 -p1 %patch152 -p1 @@ -813,6 +819,9 @@ libvirt plugin for NSS for translating domain names into IP addresses. %patch213 -p1 %patch214 -p1 %patch300 -p1 +%if %{with_sle_build} +%patch400 -p1 +%endif %build %if %{with_xen} @@ -1440,6 +1449,10 @@ fi %dir %{_libdir}/%{name}/connection-driver %{_libdir}/%{name}/connection-driver/libvirt_driver_lxc.so %attr(0755, root, root) %{_bindir}/virt-lxc-convert + %if %{with_sle_build} +%{_bindir}/virt-create-rootfs +%doc %{_mandir}/man1/virt-create-rootfs.1* + %endif %endif %if %{with_uml} diff --git a/libxl-dom0-balloon-fix.patch b/libxl-dom0-balloon-fix.patch new file mode 100644 index 0000000..279865d --- /dev/null +++ b/libxl-dom0-balloon-fix.patch @@ -0,0 +1,52 @@ +commit f7143d2f0d918cf96010f1d7610b3c3bf7005c1d +Author: Jim Fehlig +Date: Tue Jan 17 15:11:32 2017 -0700 + + libxl: fix dom0 autoballooning with Xen 4.8 + + xen.git commit 57f8b13c changed several of the libxl memory + get/set functions to take 64 bit parameters. The libvirt + libxl driver still uses uint32_t variables for these various + parameters, which is particularly problematic for the + libxl_set_memory_target() function. + + When dom0 autoballooning is enabled, libvirt (like xl) determines + the memory needed to start a domain and the memory available. If + memory available is less than memory needed, dom0 is ballooned + down by passing a negative value to libxl_set_memory_target() + 'target_memkb' parameter. Prior to xen.git commit 57f8b13c, + 'target_memkb' was an int32_t. Subtracting a larger uint32 from + a smaller uint32 and assigning it to int32 resulted in a negative + number. After commit 57f8b13c, the same subtraction is widened + to a int64, resulting in a large positive number. The simple + fix taken by this patch is to assign the difference of the + uint32 values to a temporary int32 variable, which is then + passed to 'target_memkb' parameter of libxl_set_memory_target(). + + Note that it is undesirable to change libvirt to use 64 bit + variables since it requires setting LIBXL_API_VERSION to 0x040800. + Currently libvirt supports LIBXL_API_VERSION >= 0x040400, + essentially Xen >= 4.4. + +Index: libvirt-3.0.0/src/libxl/libxl_domain.c +=================================================================== +--- libvirt-3.0.0.orig/src/libxl/libxl_domain.c ++++ libvirt-3.0.0/src/libxl/libxl_domain.c +@@ -909,6 +909,7 @@ libxlDomainFreeMem(libxl_ctx *ctx, libxl + { + uint32_t needed_mem; + uint32_t free_mem; ++ int32_t target_mem; + int tries = 3; + int wait_secs = 10; + +@@ -922,7 +923,8 @@ libxlDomainFreeMem(libxl_ctx *ctx, libxl + if (free_mem >= needed_mem) + return 0; + +- if (libxl_set_memory_target(ctx, 0, free_mem - needed_mem, ++ target_mem = free_mem - needed_mem; ++ if (libxl_set_memory_target(ctx, 0, target_mem, + /* relative */ 1, 0) < 0) + goto error; + diff --git a/virt-create-rootfs.patch b/virt-create-rootfs.patch new file mode 100644 index 0000000..04f08d9 --- /dev/null +++ b/virt-create-rootfs.patch @@ -0,0 +1,331 @@ +Index: libvirt-3.0.0/tools/Makefile.am +=================================================================== +--- libvirt-3.0.0.orig/tools/Makefile.am ++++ libvirt-3.0.0/tools/Makefile.am +@@ -43,6 +43,7 @@ PODFILES = \ + virt-sanlock-cleanup.pod \ + virt-xml-validate.pod \ + virsh.pod \ ++ virt-create-rootfs.pod \ + $(NULL) + + MANINFILES = \ +@@ -76,7 +77,7 @@ MAINTAINERCLEANFILES = + confdir = $(sysconfdir)/libvirt + conf_DATA = + +-bin_SCRIPTS = virt-xml-validate virt-pki-validate ++bin_SCRIPTS = virt-xml-validate virt-pki-validate virt-create-rootfs + bin_PROGRAMS = virsh virt-admin + libexec_SCRIPTS = libvirt-guests.sh + man1_MANS = \ +@@ -102,6 +103,8 @@ bin_PROGRAMS += virt-host-validate + man1_MANS += virt-host-validate.1 + endif WITH_HOST_VALIDATE + ++man1_MANS += virt-create-rootfs.1 ++ + virt-xml-validate: virt-xml-validate.in Makefile + $(AM_V_GEN)sed -e 's|[@]schemadir@|$(pkgdatadir)/schemas|g' \ + -e 's|[@]VERSION@|$(VERSION)|g' \ +Index: libvirt-3.0.0/tools/virt-create-rootfs +=================================================================== +--- /dev/null ++++ libvirt-3.0.0/tools/virt-create-rootfs +@@ -0,0 +1,214 @@ ++#!/bin/sh ++set -e ++ ++function fail ++{ ++ echo $1 ++ exit 1 ++} ++ ++function print_help ++{ ++cat << EOF ++virt-create-rootfs --root /path/to/rootfs [ARGS] ++ ++Create a new root file system to use for distribution containers. ++ ++ARGUMENTS ++ ++ -h, --help print this help and exit ++ -r, --root path where to create the root FS ++ -d, --distro distribution to install ++ -a, --arch target architecture ++ -u, --url URL of the registration server ++ -c, --regcode registration code for the product ++ -p, --root-pass the root password to set in the root FS ++ --dry-run don't actually run it ++EOF ++} ++ ++ARCH=$(uname -i) ++ROOT= ++DISTRO= ++URL= ++REG_CODE= ++ROOT_PASS= ++DRY_RUN= ++ ++while test $# -gt 0 ++do ++ case $1 in ++ ++ -h | --help) ++ # usage and help ++ print_help ++ ;; ++ ++ -r | --root) ++ if test $# -lt 2; then ++ fail "$1 needs a value" ++ fi ++ ROOT="$2" ++ shift ++ ;; ++ ++ -a | --arch) ++ if test $# -lt 2; then ++ fail "$1 needs a value" ++ fi ++ case "$2" in ++ i586 | x86_64) ++ ARCH=$2 ++ shift ++ ;; ++ *) ++ fail "$1 valid values are 'i586', 'x86_64'" ++ esac ++ # Sanity checks for the arch ++ HOST_ARCH=$(uname -i) ++ case "$HOST_ARCH" in ++ i?86) ++ if test $ARCH = "x86_64"; then ++ fail "Host won't run x86_64 container" ++ fi ++ ;; ++ esac ++ ;; ++ ++ -u | --url) ++ if test $# -lt 2; then ++ fail "$1 needs a value" ++ fi ++ URL="$2" ++ shift ++ ;; ++ ++ -d | --distro) ++ if test $# -lt 2; then ++ fail "$1 needs a value" ++ fi ++ case "$2" in ++ SLED-* | SLES-* | openSUSE-*) ++ DISTRO=$2 ++ shift ++ ;; ++ *) ++ fail "$1 valid values are 'SLED-*', 'SLES-*', 'openSUSE-*'" ++ esac ++ ;; ++ ++ -c | --regcode) ++ if test $# -lt 2; then ++ fail "$1 needs a value" ++ fi ++ REG_CODE=$2 ++ shift ++ ;; ++ ++ -p | --root-pass) ++ if test $# -lt 2; then ++ fail "$1 needs a value" ++ fi ++ ROOT_PASS=$2 ++ shift ++ ;; ++ ++ --dry-run) ++ DRY_RUN="yes" ++ ;; ++ ++ *) ++ fail "Unknown option: $1" ++ ;; ++ esac ++ ++ shift ++done ++ ++if test -z "$ROOT"; then ++ fail "--root argument need to be provided" ++fi ++ ++RUN= ++if test "$DRY_RUN" = "yes"; then ++ RUN="echo" ++fi ++ ++function call_zypper ++{ ++ $RUN zypper --root "$ROOT" $* ++} ++ ++function install_sle ++{ ++ PRODUCT="$1" ++ VERSION="$2" ++ ++ case "$VERSION" in ++ 12.0) ++ # Transform into zypper internal version scheme ++ VERSION="12" ++ ;; ++ *) ++ fail "Unhandled SLE version: $VERSION" ++ ;; ++ esac ++ ++ # First copy the SUSE GPG keys from the host to the new root ++ rpm -qa gpg-pubkey\* --qf "%{name}-%{version}-%{release}: %{summary}\n" | \ ++ grep 'gpg(SuSE Package Signing Key )' | \ ++ while read -r line; do ++ key=$(echo $line | cut -d ':' -f 1) ++ tmpkey=$(mktemp) ++ rpm -qi $key | sed -n '/BEGIN/,/END/p' > "$tmpkey" ++ rpm --root "$ROOT" --import "$tmpkey" ++ rm "$tmpkey" ++ done ++ ++ # SUSE Connect adds the repositories, and refreshes them, ++ # but requires the GPG key to be already imported ++ CONNECT_ARGS= ++ if test -n "$REG_CODE"; then ++ CONNECT_ARGS="$CONNECT_ARGS -r $REG_CODE" ++ fi ++ if test -n "$URL"; then ++ CONNECT_ARGS="$CONNECT_ARGS --url $URL" ++ fi ++ $RUN SUSEConnect -p "$PRODUCT/$VERSION/$ARCH" --root "$ROOT" $CONNECT_ARGS ++ ++ # Then we install what we need ++ call_zypper in -t pattern Minimal ++ ++ # Create the baseproduct symlink ++ ln -s $PRODUCT.prod "$ROOT/etc/products.d/baseproduct" ++} ++ ++case "$DISTRO" in ++ SLED-*) ++ install_sle "SLED" "${DISTRO:5}" ++ ;; ++ SLED-* | SLES-*) ++ install_sle "SLES" "${DISTRO:5}" ++ ;; ++ ++ openSUSE-*) ++ VERSION=${DISTRO:9} ++ case "$VERSION" in ++ 13.1) ++ REPO="http://download.opensuse.org/distribution/13.1/repo/oss/" ++ UPDATE_REPO="http://download.opensuse.org/update/13.1/" ++ ;; ++ *) ++ fail "Unhandled openSUSE version: $VERSION" ++ ;; ++ esac ++ call_zypper ar "$REPO" "openSUSE" ++ call_zypper ar "$UPDATE_REPO" "openSUSE udpate" ++ call_zypper in --no-recommends -t pattern base ++ ;; ++esac ++ ++if test "$DRY_RUN" != "yes"; then ++ echo "pts/0" >> "$ROOT/etc/securetty" ++ chroot "$ROOT" /usr/bin/passwd ++fi +Index: libvirt-3.0.0/tools/virt-create-rootfs.pod +=================================================================== +--- /dev/null ++++ libvirt-3.0.0/tools/virt-create-rootfs.pod +@@ -0,0 +1,77 @@ ++=head1 NAME ++ ++virt-create-rootfs - tool to create a root file system for distro containers. ++ ++=head1 SYNOPSIS ++ ++B [I