Accepting request 404539 from Virtualization

More improvements to the spec file, allowing common usage
between openSUSE and SLE. Also add some SLE patches missing
in openSUSE.

- spec: Recent simplification allows using a common spec file for
  SLE and openSUSE
- Add SLE patches missing in openSUSE
  libxl-dom-reset.patch, libxl-set-migration-constraints.patch,
  libxl-set-cach-mode.patch

OBS-URL: https://build.opensuse.org/request/show/404539
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libvirt?expand=0&rev=209
This commit is contained in:
Dominique Leuenberger 2016-06-29 13:10:28 +00:00 committed by Git OBS Bridge
commit 65ef8cd435
6 changed files with 534 additions and 9 deletions

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Mon Jun 20 21:26:41 UTC 2016 - jfehlig@suse.com
- spec: Recent simplification allows using a common spec file for
SLE and openSUSE
- Add SLE patches missing in openSUSE
libxl-dom-reset.patch, libxl-set-migration-constraints.patch,
libxl-set-cach-mode.patch
-------------------------------------------------------------------
Thu Jun 16 18:39:54 UTC 2016 - jfehlig@suse.com

View File

@ -16,6 +16,15 @@
#
# The configuration of libvirt is modified slightly for SLE
%define with_sle_build %{?is_opensuse:0}%{!?is_opensuse:1}
# openSUSE13.1 and 13.2 do not understand %is_opensuse. Check for those
# explicitly and disable SLE build
%if 0%{?suse_version} == 1310 || 0%{?suse_version} == 1320
%define with_sle_build 0
%endif
# The hypervisor drivers that run in libvirtd
%define with_xen 0%{!?_without_xen:1}
%define with_qemu 0%{!?_without_qemu:1}
@ -61,6 +70,14 @@
%define with_libxl 0
%endif
# For SLE, further restrice Xen support to x86_64 only
%if %{with_sle_build}
%ifarch %arm aarch64
%define with_xen 0
%define with_libxl 0
%endif
%endif
# numactl package has "ExclusiveArch: ia64 x86_64 ppc64 ppc64le ppc %sparc"
# We'll only use it on x86_64 ppc64 ppc64le
%ifnarch x86_64 ppc64 ppc64le
@ -73,7 +90,7 @@
%endif
# Disable hypervisor drivers not supported in SLE
%if 0%{?sles_version}
%if %{with_sle_build}
%define with_openvz 0
%define with_vbox 0
%define with_uml 0
@ -86,6 +103,13 @@
%define with_phyp 1
%endif
# For now, only enable rbd storage backend on x86_64 SLE
%if %{with_sle_build}
%ifarch x86_64
%define with_storage_rbd 1
%endif
%endif
# Support systemd on 12.1 and later
%if 0%{?suse_version} >= 1210
%define with_systemd 0%{!?_without_systemd:1}
@ -184,6 +208,9 @@ BuildRequires: python
BuildRequires: python-xml
BuildRequires: readline-devel
BuildRequires: xhtml-dtd
# perl XPath is needed since we have a patch touching files that cause
# hvsupport.html to be regenerated
BuildRequires: perl(XML::XPath)
# For pool-build probing for existing pools
BuildRequires: libblkid-devel >= 2.17
BuildRequires: libpciaccess0-devel >= 0.10.9
@ -259,13 +286,16 @@ Source100: %{name}-rpmlintrc
# Upstream patches
Patch0: e33cd67a-xenconfig-backendtype-fix.patch
# Patches pending upstream review
Patch100: apparmor-dont-scrub-environment-of-virtlogd-process.patch
Patch100: libxl-dom-reset.patch
Patch101: apparmor-dont-scrub-environment-of-virtlogd-process.patch
# Need to go upstream
Patch150: xen-pv-cdrom.patch
Patch151: blockcopy-check-dst-identical-device.patch
Patch152: libvirt-power8-models.patch
Patch153: ppc64le-canonical-name.patch
Patch154: apparmor-fixes.patch
Patch154: libxl-set-migration-constraints.patch
Patch155: libxl-set-cach-mode.patch
Patch156: apparmor-fixes.patch
# Our patches
Patch200: libvirtd-defaults.patch
Patch201: libvirtd-init-script.patch
@ -709,11 +739,14 @@ 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
%patch153 -p1
%patch154 -p1
%patch155 -p1
%patch156 -p1
%patch200 -p1
%patch201 -p1
%patch202 -p1

86
libxl-dom-reset.patch Normal file
View File

@ -0,0 +1,86 @@
commit 3ac6e50943a775c545aa7d4e4bde5fcb8a163b64
Author: Jim Fehlig <jfehlig@suse.com>
Date: Mon Jun 23 15:51:20 2014 -0600
libxl: support domainReset
Currently, libxl_send_trigger() does not implement the LIBXL_TRIGGER_RESET
option, but domainReset can be implemented in the libxl driver by
forcibly destroying the domain and starting it again.
Index: libvirt-1.3.5/src/libxl/libxl_driver.c
===================================================================
--- libvirt-1.3.5.orig/src/libxl/libxl_driver.c
+++ libvirt-1.3.5/src/libxl/libxl_driver.c
@@ -1325,6 +1325,63 @@ libxlDomainReboot(virDomainPtr dom, unsi
}
static int
+libxlDomainReset(virDomainPtr dom, unsigned int flags)
+{
+ libxlDriverPrivatePtr driver = dom->conn->privateData;
+ libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
+ virDomainObjPtr vm;
+ int ret = -1;
+
+ virCheckFlags(0, -1);
+
+ if (!(vm = libxlDomObjFromDomain(dom)))
+ goto cleanup;
+
+ if (virDomainResetEnsureACL(dom->conn, vm->def) < 0)
+ goto cleanup;
+
+ if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0)
+ goto cleanup;
+
+ if (!virDomainObjIsActive(vm)) {
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("Domain is not running"));
+ goto endjob;
+ }
+
+ /*
+ * The semantics of reset can be achieved by forcibly destroying
+ * the domain and starting it again.
+ */
+ if (libxl_domain_destroy(cfg->ctx, vm->def->id, NULL) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to reset domain '%d'"), vm->def->id);
+ goto endjob;
+ }
+
+ libxlDomainCleanup(driver, vm);
+
+ if (libxlDomainStartNew(driver, vm, false) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to start domain '%d' after reset"),
+ vm->def->id);
+ goto endjob;
+ }
+
+ ret = 0;
+
+ endjob:
+ if (!libxlDomainObjEndJob(driver, vm))
+ vm = NULL;
+
+ cleanup:
+ if (vm)
+ virObjectUnlock(vm);
+ virObjectUnref(cfg);
+ return ret;
+}
+
+static int
libxlDomainDestroyFlags(virDomainPtr dom,
unsigned int flags)
{
@@ -5581,6 +5638,7 @@ static virHypervisorDriver libxlHypervis
.domainShutdown = libxlDomainShutdown, /* 0.9.0 */
.domainShutdownFlags = libxlDomainShutdownFlags, /* 0.9.10 */
.domainReboot = libxlDomainReboot, /* 0.9.0 */
+ .domainReset = libxlDomainReset, /* 1.2.16 */
.domainDestroy = libxlDomainDestroy, /* 0.9.0 */
.domainDestroyFlags = libxlDomainDestroyFlags, /* 0.9.4 */
.domainGetOSType = libxlDomainGetOSType, /* 0.9.0 */

48
libxl-set-cach-mode.patch Normal file
View File

@ -0,0 +1,48 @@
https://bugzilla.novell.com/show_bug.cgi?id=879425
---
src/libxl/libxl_conf.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
Index: libvirt-1.3.5/src/libxl/libxl_conf.c
===================================================================
--- libvirt-1.3.5.orig/src/libxl/libxl_conf.c
+++ libvirt-1.3.5/src/libxl/libxl_conf.c
@@ -905,6 +905,30 @@ libxlDiskSetDiscard(libxl_device_disk *x
}
+static void
+libxlDiskSetCacheMode(libxl_device_disk *x_disk, int cachemode)
+{
+ switch (cachemode) {
+#if defined(LIBXL_HAVE_LIBXL_DEVICE_DISK_DISABLE_FLUSH_MAGIC)
+ case VIR_DOMAIN_DISK_CACHE_UNSAFE:
+ if (x_disk->readwrite)
+ x_disk->readwrite = (x_disk->readwrite & LIBXL_HAVE_LIBXL_DEVICE_DISK_DISABLE_FLUSH_MASK) | LIBXL_HAVE_LIBXL_DEVICE_DISK_DISABLE_FLUSH_MAGIC;
+ break;
+#endif
+#if defined(LIBXL_HAVE_DEVICE_DISK_DIRECT_IO_SAFE)
+ case VIR_DOMAIN_DISK_CACHE_DIRECTSYNC:
+ x_disk->direct_io_safe = true;
+ break;
+#endif
+ case VIR_DOMAIN_DISK_CACHE_DEFAULT:
+ case VIR_DOMAIN_DISK_CACHE_DISABLE:
+ case VIR_DOMAIN_DISK_CACHE_WRITETHRU:
+ case VIR_DOMAIN_DISK_CACHE_WRITEBACK:
+ default:
+ break;
+ }
+}
+
#define LIBXL_QEMU_DM_STR "Options specific to the Xen version:"
int
@@ -1180,6 +1204,7 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk
x_disk->is_cdrom = l_disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM ? 1 : 0;
if (libxlDiskSetDiscard(x_disk, l_disk->discard) < 0)
return -1;
+ libxlDiskSetCacheMode(x_disk, l_disk->cachemode);
/* An empty CDROM must have the empty format, otherwise libxl fails. */
if (x_disk->is_cdrom && !x_disk->pdev_path)
x_disk->format = LIBXL_DISK_FORMAT_EMPTY;

View File

@ -0,0 +1,349 @@
From 6409e928eb4c2287dca59b139650fab77ea99fb8 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 9 May 2014 11:55:31 -0600
Subject: [PATCH] libvirt: set migration constraints from cmdline
References: fate#316614
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
---
include/libvirt/libvirt-domain.h | 25 +++++++++++++++++++++++++
src/libxl/libxl_driver.c | 17 ++++++++++++++++-
src/libxl/libxl_migration.c | 29 +++++++++++++++++++++++++----
src/libxl/libxl_migration.h | 14 +++++++++++++-
tools/virsh-domain.c | 38 ++++++++++++++++++++++++++++++++++++++
tools/virsh.pod | 8 ++++++++
6 files changed, 125 insertions(+), 6 deletions(-)
Index: libvirt-1.3.5/include/libvirt/libvirt-domain.h
===================================================================
--- libvirt-1.3.5.orig/include/libvirt/libvirt-domain.h
+++ libvirt-1.3.5/include/libvirt/libvirt-domain.h
@@ -845,6 +845,31 @@ typedef enum {
*/
# define VIR_MIGRATE_PARAM_COMPRESSION_XBZRLE_CACHE "compression.xbzrle.cache"
+/**
+ * VIR_MIGRATE_PARAM_SUSE_MAX_ITERS:
+ *
+ * virDomainMigrate* params field: xc_domain_save max_iters
+ */
+#define VIR_MIGRATE_PARAM_SUSE_MAX_ITERS "max_iters"
+/**
+ * VIR_MIGRATE_PARAM_SUSE_MAX_FACTOR:
+ *
+ * virDomainMigrate* params field: xc_domain_save max_factor
+ */
+#define VIR_MIGRATE_PARAM_SUSE_MAX_FACTOR "max_factor"
+/**
+ * VIR_MIGRATE_PARAM_SUSE_MIN_REMAINING:
+ *
+ * virDomainMigrate* params field: xc_domain_save min_remaining
+ */
+#define VIR_MIGRATE_PARAM_SUSE_MIN_REMAINING "min_remaining"
+/**
+ * VIR_MIGRATE_PARAM_SUSE_ABORT_IF_BUSY:
+ *
+ * virDomainMigrate* params field: xc_domain_save abort_if_busy
+ */
+#define VIR_MIGRATE_PARAM_SUSE_ABORT_IF_BUSY "abort_if_busy"
+
/* Domain migration. */
virDomainPtr virDomainMigrate (virDomainPtr domain, virConnectPtr dconn,
unsigned long flags, const char *dname,
Index: libvirt-1.3.5/src/libxl/libxl_driver.c
===================================================================
--- libvirt-1.3.5.orig/src/libxl/libxl_driver.c
+++ libvirt-1.3.5/src/libxl/libxl_driver.c
@@ -5320,6 +5320,9 @@ libxlDomainMigratePerform3Params(virDoma
const char *dname = NULL;
const char *uri = NULL;
int ret = -1;
+ libxlDomainMigrationProps props = {
+ .virFlags = flags,
+ };
#ifdef LIBXL_HAVE_NO_SUSPEND_RESUME
virReportUnsupportedError();
@@ -5336,6 +5339,18 @@ libxlDomainMigratePerform3Params(virDoma
virTypedParamsGetString(params, nparams,
VIR_MIGRATE_PARAM_DEST_NAME,
&dname) < 0 ||
+ virTypedParamsGetUInt(params, nparams,
+ VIR_MIGRATE_PARAM_SUSE_MAX_ITERS,
+ &props.max_iters) < 0 ||
+ virTypedParamsGetUInt(params, nparams,
+ VIR_MIGRATE_PARAM_SUSE_MAX_FACTOR,
+ &props.max_factor) < 0 ||
+ virTypedParamsGetUInt(params, nparams,
+ VIR_MIGRATE_PARAM_SUSE_MIN_REMAINING,
+ &props.min_remaining) < 0 ||
+ virTypedParamsGetUInt(params, nparams,
+ VIR_MIGRATE_PARAM_SUSE_ABORT_IF_BUSY,
+ &props.abort_if_busy) < 0 ||
virTypedParamsGetString(params, nparams,
VIR_MIGRATE_PARAM_URI,
&uri) < 0)
@@ -5350,11 +5365,11 @@ libxlDomainMigratePerform3Params(virDoma
if (flags & VIR_MIGRATE_PEER2PEER) {
if (libxlDomainMigrationPerformP2P(driver, vm, dom->conn, dom_xml,
- dconnuri, uri, dname, flags) < 0)
+ dconnuri, uri, dname, &props) < 0)
goto cleanup;
} else {
if (libxlDomainMigrationPerform(driver, vm, dom_xml, dconnuri,
- uri, dname, flags) < 0)
+ uri, dname, &props) < 0)
goto cleanup;
}
Index: libvirt-1.3.5/src/libxl/libxl_migration.c
===================================================================
--- libvirt-1.3.5.orig/src/libxl/libxl_migration.c
+++ libvirt-1.3.5/src/libxl/libxl_migration.c
@@ -358,18 +358,39 @@ libxlMigrateReceive(virNetSocketPtr sock
static int
libxlDoMigrateSend(libxlDriverPrivatePtr driver,
virDomainObjPtr vm,
- unsigned long flags,
+ const libxlDomainMigrationProps *props,
int sockfd)
{
libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
+#ifdef LIBXL_HAVE_DOMAIN_SUSPEND_SUSE
+ libxl_domain_suspend_suse_properties libxl_props = {
+ .flags = 0,
+ };
+#else
int xl_flags = 0;
+#endif
int ret;
- if (flags & VIR_MIGRATE_LIVE)
+#ifdef LIBXL_HAVE_DOMAIN_SUSPEND_SUSE
+ if (props->virFlags & VIR_MIGRATE_LIVE)
+ libxl_props.flags |= LIBXL_SUSPEND_LIVE;
+
+ libxl_props.max_iters = props->max_iters;
+ libxl_props.max_factor = props->max_factor;
+ libxl_props.min_remaining = props->min_remaining;
+ if (props->abort_if_busy)
+ libxl_props.flags |= LIBXL_SUSPEND_ABORT_IF_BUSY;
+
+ ret = libxl_domain_suspend_suse(cfg->ctx, vm->def->id, sockfd,
+ &libxl_props, NULL);
+#else
+ if (props->virFlags & VIR_MIGRATE_LIVE)
xl_flags = LIBXL_SUSPEND_LIVE;
ret = libxl_domain_suspend(cfg->ctx, vm->def->id, sockfd,
xl_flags, NULL);
+#endif
+
if (ret != 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Failed to send migration data to destination host"));
@@ -665,7 +686,7 @@ libxlDoMigrateP2P(libxlDriverPrivatePtr
const char *dconnuri ATTRIBUTE_UNUSED,
const char *dname,
const char *uri,
- unsigned int flags)
+ const libxlDomainMigrationProps *props)
{
virDomainPtr ddomain = NULL;
virTypedParameterPtr params = NULL;
@@ -702,7 +723,7 @@ libxlDoMigrateP2P(libxlDriverPrivatePtr
/* We don't require the destination to have P2P support
* as it looks to be normal migration from the receiver perpective.
*/
- destflags = flags & ~(VIR_MIGRATE_PEER2PEER);
+ destflags = props->virFlags & ~(VIR_MIGRATE_PEER2PEER);
VIR_DEBUG("Prepare3");
virObjectUnlock(vm);
@@ -727,7 +748,7 @@ libxlDoMigrateP2P(libxlDriverPrivatePtr
VIR_DEBUG("Perform3 uri=%s", NULLSTR(uri_out));
ret = libxlDomainMigrationPerform(driver, vm, NULL, NULL,
- uri_out, NULL, flags);
+ uri_out, NULL, props);
if (ret < 0)
orig_err = virSaveLastError();
@@ -759,7 +780,7 @@ libxlDoMigrateP2P(libxlDriverPrivatePtr
orig_err = virSaveLastError();
VIR_DEBUG("Confirm3 cancelled=%d vm=%p", cancelled, vm);
- ret = libxlDomainMigrationConfirm(driver, vm, flags, cancelled);
+ ret = libxlDomainMigrationConfirm(driver, vm, props->virFlags, cancelled);
if (ret < 0)
VIR_WARN("Guest %s probably left in 'paused' state on source",
@@ -808,7 +829,7 @@ libxlDomainMigrationPerformP2P(libxlDriv
const char *dconnuri,
const char *uri_str ATTRIBUTE_UNUSED,
const char *dname,
- unsigned int flags)
+ const libxlDomainMigrationProps *props)
{
int ret = -1;
bool useParams;
@@ -843,7 +864,7 @@ libxlDomainMigrationPerformP2P(libxlDriv
}
ret = libxlDoMigrateP2P(driver, vm, sconn, xmlin, dconn, dconnuri,
- dname, uri_str, flags);
+ dname, uri_str, props);
cleanup:
orig_err = virSaveLastError();
@@ -865,7 +886,7 @@ libxlDomainMigrationPerform(libxlDriverP
const char *dconnuri ATTRIBUTE_UNUSED,
const char *uri_str,
const char *dname ATTRIBUTE_UNUSED,
- unsigned int flags)
+ const libxlDomainMigrationProps *props)
{
libxlDomainObjPrivatePtr priv = vm->privateData;
char *hostname = NULL;
@@ -905,7 +926,7 @@ libxlDomainMigrationPerform(libxlDriverP
/* suspend vm and send saved data to dst through socket fd */
virObjectUnlock(vm);
- ret = libxlDoMigrateSend(driver, vm, flags, sockfd);
+ ret = libxlDoMigrateSend(driver, vm, props, sockfd);
virObjectLock(vm);
cleanup:
Index: libvirt-1.3.5/src/libxl/libxl_migration.h
===================================================================
--- libvirt-1.3.5.orig/src/libxl/libxl_migration.h
+++ libvirt-1.3.5/src/libxl/libxl_migration.h
@@ -37,6 +37,10 @@
VIR_MIGRATE_PARAM_URI, VIR_TYPED_PARAM_STRING, \
VIR_MIGRATE_PARAM_DEST_NAME, VIR_TYPED_PARAM_STRING, \
VIR_MIGRATE_PARAM_DEST_XML, VIR_TYPED_PARAM_STRING, \
+ VIR_MIGRATE_PARAM_SUSE_MAX_ITERS, VIR_TYPED_PARAM_UINT, \
+ VIR_MIGRATE_PARAM_SUSE_MAX_FACTOR, VIR_TYPED_PARAM_UINT, \
+ VIR_MIGRATE_PARAM_SUSE_MIN_REMAINING, VIR_TYPED_PARAM_UINT, \
+ VIR_MIGRATE_PARAM_SUSE_ABORT_IF_BUSY, VIR_TYPED_PARAM_UINT, \
NULL
char *
@@ -60,6 +64,14 @@ libxlDomainMigrationPrepare(virConnectPt
int cookieinlen,
unsigned int flags);
+typedef struct {
+ unsigned int virFlags;
+ unsigned int max_iters;
+ unsigned int max_factor;
+ unsigned int min_remaining;
+ unsigned int abort_if_busy;
+} libxlDomainMigrationProps;
+
int
libxlDomainMigrationPerformP2P(libxlDriverPrivatePtr driver,
virDomainObjPtr vm,
@@ -68,7 +80,7 @@ libxlDomainMigrationPerformP2P(libxlDriv
const char *dconnuri,
const char *uri_str,
const char *dname,
- unsigned int flags);
+ const libxlDomainMigrationProps *props);
int
libxlDomainMigrationPerform(libxlDriverPrivatePtr driver,
@@ -77,7 +89,7 @@ libxlDomainMigrationPerform(libxlDriverP
const char *dconnuri,
const char *uri_str,
const char *dname,
- unsigned int flags);
+ const libxlDomainMigrationProps *props);
virDomainPtr
libxlDomainMigrationFinish(virConnectPtr dconn,
Index: libvirt-1.3.5/tools/virsh-domain.c
===================================================================
--- libvirt-1.3.5.orig/tools/virsh-domain.c
+++ libvirt-1.3.5/tools/virsh-domain.c
@@ -9869,6 +9869,22 @@ static const vshCmdOptDef opts_migrate[]
.type = VSH_OT_INT,
.help = N_("port to use by target server for incoming disks migration")
},
+ {.name = "max_iters",
+ .type = VSH_OT_INT,
+ .help = N_("SUSE libxl: Number of iterations before final suspend (default: 30).")
+ },
+ {.name = "max_factor",
+ .type = VSH_OT_INT,
+ .help = N_("SUSE libxl: Max amount of memory to transfer before final suspend (default: 3*RAM).")
+ },
+ {.name = "min_remaining",
+ .type = VSH_OT_INT,
+ .help = N_("SUSE libxl: Number of dirty pages before final suspend (default: 50).")
+ },
+ {.name = "abort_if_busy",
+ .type = VSH_OT_BOOL,
+ .help = N_("SUSE libxl: Abort migration instead of doing final suspend.")
+ },
{.name = NULL}
};
@@ -9892,6 +9908,7 @@ doMigrate(void *opaque)
unsigned long long ullOpt = 0;
int rv;
virConnectPtr dconn = data->dconn;
+ unsigned int uint_opt = 0;
sigemptyset(&sigmask);
sigaddset(&sigmask, SIGINT);
@@ -10011,6 +10028,27 @@ doMigrate(void *opaque)
goto save_error;
}
+ if (vshCommandOptUInt(ctl, cmd, "max_iters", &uint_opt) > 0 && uint_opt) {
+ if (virTypedParamsAddUInt(&params, &nparams, &maxparams,
+ VIR_MIGRATE_PARAM_SUSE_MAX_ITERS, uint_opt) < 0)
+ goto save_error;
+ }
+ if (vshCommandOptUInt(ctl, cmd, "max_factor", &uint_opt) > 0 && uint_opt) {
+ if (virTypedParamsAddUInt(&params, &nparams, &maxparams,
+ VIR_MIGRATE_PARAM_SUSE_MAX_FACTOR, uint_opt) < 0)
+ goto save_error;
+ }
+ if (vshCommandOptUInt(ctl, cmd, "min_remaining", &uint_opt) > 0 && uint_opt) {
+ if (virTypedParamsAddUInt(&params, &nparams, &maxparams,
+ VIR_MIGRATE_PARAM_SUSE_MIN_REMAINING, uint_opt) < 0)
+ goto save_error;
+ }
+ if (vshCommandOptBool(cmd, "abort_if_busy")) {
+ if (virTypedParamsAddUInt(&params, &nparams, &maxparams,
+ VIR_MIGRATE_PARAM_SUSE_ABORT_IF_BUSY, 1) < 0)
+ goto save_error;
+ }
+
if (vshCommandOptStringReq(ctl, cmd, "xml", &opt) < 0)
goto out;
if (opt) {
Index: libvirt-1.3.5/tools/virsh.pod
===================================================================
--- libvirt-1.3.5.orig/tools/virsh.pod
+++ libvirt-1.3.5/tools/virsh.pod
@@ -1620,6 +1620,14 @@ compression. I<--comp-mt-threads> and I<
of compress threads on source and the number of decompress threads on target
respectively. I<--comp-xbzrle-cache> sets size of page cache in bytes.
+SUSE-specific options for Xen: I<--max_iters> B<num> allows specifying the maximum
+number of iterations before final suspend. Default is 30. I<--max_factor> B<num>
+allows specifying the maximum amount of memory to transfer before final suspend.
+Default is (3*VM memory size). I<--min_remaining> B<num> allows specifying the
+number of dirty pages before final suspend. Default is 50. I<--abort_if_busy>
+can be used to abort the migration instead of doing the final suspend for VMs with
+busy workloads.
+
Running migration can be canceled by interrupting virsh (usually using
C<Ctrl-C>) or by B<domjobabort> command sent from another virsh instance.

View File

@ -11,10 +11,10 @@ Index: libvirt-1.3.5/src/libxl/libxl_conf.c
===================================================================
--- libvirt-1.3.5.orig/src/libxl/libxl_conf.c
+++ libvirt-1.3.5/src/libxl/libxl_conf.c
@@ -905,6 +905,25 @@ libxlDiskSetDiscard(libxl_device_disk *x
@@ -929,6 +929,25 @@ libxlDiskSetCacheMode(libxl_device_disk
}
}
+static int
+libxlDiskSetScript(libxl_device_disk *x_disk, const char *disk_spec)
+{
@ -37,7 +37,7 @@ Index: libvirt-1.3.5/src/libxl/libxl_conf.c
#define LIBXL_QEMU_DM_STR "Options specific to the Xen version:"
int
@@ -1058,6 +1077,7 @@ libxlMakeNetworkDiskSrc(virStorageSource
@@ -1082,6 +1101,7 @@ libxlMakeNetworkDiskSrc(virStorageSource
int
libxlMakeDisk(virDomainDiskDefPtr l_disk, libxl_device_disk *x_disk)
{
@ -45,7 +45,7 @@ Index: libvirt-1.3.5/src/libxl/libxl_conf.c
const char *driver = virDomainDiskGetDriver(l_disk);
int format = virDomainDiskGetFormat(l_disk);
int actual_type = virStorageSourceGetActualType(l_disk->src);
@@ -1073,7 +1093,7 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk
@@ -1097,7 +1117,7 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk
if (libxlMakeNetworkDiskSrc(l_disk->src, &x_disk->pdev_path) < 0)
return -1;
} else {
@ -54,10 +54,10 @@ Index: libvirt-1.3.5/src/libxl/libxl_conf.c
return -1;
}
@@ -1180,6 +1200,9 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk
x_disk->is_cdrom = l_disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM ? 1 : 0;
@@ -1205,6 +1225,9 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk
if (libxlDiskSetDiscard(x_disk, l_disk->discard) < 0)
return -1;
libxlDiskSetCacheMode(x_disk, l_disk->cachemode);
+ if (libxlDiskSetScript(x_disk, src) < 0)
+ return -1;
+