Index: libvirt-1.2.5/src/xen/xen_driver.c
===================================================================
--- libvirt-1.2.5.orig/src/xen/xen_driver.c
+++ libvirt-1.2.5/src/xen/xen_driver.c
@@ -39,6 +39,7 @@
 #include <fcntl.h>
 #include <xen/dom0_ops.h>
 
+#include "internal.h"
 #include "virerror.h"
 #include "virlog.h"
 #include "datatypes.h"
@@ -60,6 +61,7 @@
 #include "viruuid.h"
 #include "fdstream.h"
 #include "virfile.h"
+#include "virtypedparam.h"
 #include "viruri.h"
 #include "vircommand.h"
 #include "virnodesuspend.h"
@@ -607,6 +609,7 @@ xenUnifiedConnectSupportsFeature(virConn
     switch (feature) {
     case VIR_DRV_FEATURE_MIGRATION_V1:
     case VIR_DRV_FEATURE_MIGRATION_DIRECT:
+    case VIR_DRV_FEATURE_MIGRATION_PARAMS:
         return 1;
     default:
         return 0;
@@ -1784,6 +1787,237 @@ xenUnifiedDomainMigrateFinish(virConnect
     return ret;
 }
 
+static char *
+xenUnifiedDomainMigrateBegin3Params(virDomainPtr dom,
+                                    virTypedParameterPtr params,
+                                    int nparams,
+                                    char **cookieout ATTRIBUTE_UNUSED,
+                                    int *cookieoutlen ATTRIBUTE_UNUSED,
+                                    unsigned int flags)
+{
+    xenUnifiedPrivatePtr priv = dom->conn->privateData;
+    virDomainDefPtr minidef = NULL;
+    virDomainDefPtr def = NULL;
+    char *cpus = NULL;
+    char *ret = NULL;
+
+    virCheckFlags(XEN_MIGRATION_FLAGS, NULL);
+
+    if (virTypedParamsValidate(params, nparams, XEN_MIGRATION_PARAMETERS) < 0)
+        return NULL;
+
+    if (!(minidef = xenGetDomainDefForDom(dom)))
+        return NULL;
+
+    if (virDomainMigrateBegin3ParamsEnsureACL(dom->conn, minidef) < 0)
+        goto cleanup;
+
+    xenUnifiedLock(priv);
+    cpus = xenDomainUsedCpus(dom, minidef);
+    xenUnifiedUnlock(priv);
+    def = xenDaemonDomainGetXMLDesc(dom->conn, minidef, cpus);
+    VIR_FREE(cpus);
+
+    if (def)
+        ret = virDomainDefFormat(def,  VIR_DOMAIN_XML_SECURE);
+
+ cleanup:
+    virDomainDefFree(def);
+    virDomainDefFree(minidef);
+    return ret;
+}
+
+static int
+xenUnifiedDomainMigratePrepare3Params(virConnectPtr dconn,
+                                      virTypedParameterPtr params,
+                                      int nparams,
+                                      const char *cookiein ATTRIBUTE_UNUSED,
+                                      int cookieinlen ATTRIBUTE_UNUSED,
+                                      char **cookieout ATTRIBUTE_UNUSED,
+                                      int *cookieoutlen ATTRIBUTE_UNUSED,
+                                      char **uri_out,
+                                      unsigned int flags)
+{
+    xenUnifiedPrivatePtr priv = dconn->privateData;
+    const char *dom_xml = NULL;
+    const char *uri_in = NULL;
+    virDomainDefPtr def = NULL;
+    int ret = -1;
+
+    virCheckFlags(XEN_MIGRATION_FLAGS, -1);
+    if (virTypedParamsValidate(params, nparams, XEN_MIGRATION_PARAMETERS) < 0)
+        return -1;
+
+    if (virTypedParamsGetString(params, nparams,
+                                VIR_MIGRATE_PARAM_DEST_XML,
+                                &dom_xml) < 0 ||
+        virTypedParamsGetString(params, nparams,
+                                VIR_MIGRATE_PARAM_URI,
+                                &uri_in) < 0)
+
+        return -1;
+
+    if (!dom_xml) {
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("no domain XML passed"));
+        return -1;
+    }
+
+    if (!(def = virDomainDefParseString(dom_xml, priv->caps, priv->xmlopt,
+                                        1 << VIR_DOMAIN_VIRT_XEN,
+                                        VIR_DOMAIN_XML_INACTIVE)))
+        return -1;
+
+    if (virDomainMigratePrepare3ParamsEnsureACL(dconn, def) < 0)
+        goto cleanup;
+
+    ret = xenDaemonDomainMigratePrepare(dconn, NULL, NULL,
+                                        uri_in, uri_out,
+                                        flags, NULL, 0);
+
+ cleanup:
+    virDomainDefFree(def);
+    return ret;
+}
+
+static int
+xenUnifiedDomainMigratePerform3Params(virDomainPtr dom,
+                                      const char *dconnuri ATTRIBUTE_UNUSED,
+                                      virTypedParameterPtr params,
+                                      int nparams,
+                                      const char *cookiein ATTRIBUTE_UNUSED,
+                                      int cookieinlen ATTRIBUTE_UNUSED,
+                                      char **cookieout ATTRIBUTE_UNUSED,
+                                      int *cookieoutlen ATTRIBUTE_UNUSED,
+                                      unsigned int flags)
+{
+    const char *uri = NULL;
+    virDomainDefPtr def = NULL;
+    int ret = -1;
+
+    virCheckFlags(XEN_MIGRATION_FLAGS, -1);
+
+    if (virTypedParamsValidate(params, nparams, XEN_MIGRATION_PARAMETERS) < 0)
+        return -1;
+
+    if (virTypedParamsGetString(params, nparams,
+                                VIR_MIGRATE_PARAM_URI,
+                                &uri) < 0)
+
+        return -1;
+
+    if (!(def = xenGetDomainDefForDom(dom)))
+        return -1;
+
+    if (virDomainMigratePerform3ParamsEnsureACL(dom->conn, def) < 0)
+        goto cleanup;
+
+    ret = xenDaemonDomainMigratePerform(dom->conn, def, NULL, 0, uri,
+                                        flags, NULL, 0);
+
+ cleanup:
+    virDomainDefFree(def);
+    return ret;
+}
+
+static virDomainPtr
+xenUnifiedDomainMigrateFinish3Params(virConnectPtr dconn,
+                                     virTypedParameterPtr params,
+                                     int nparams,
+                                     const char *cookiein ATTRIBUTE_UNUSED,
+                                     int cookieinlen ATTRIBUTE_UNUSED,
+                                     char **cookieout ATTRIBUTE_UNUSED,
+                                     int *cookieoutlen ATTRIBUTE_UNUSED,
+                                     unsigned int flags,
+                                     int cancelled ATTRIBUTE_UNUSED)
+{
+    const char *dname = NULL;
+    virDomainDefPtr minidef = NULL;
+    virDomainDefPtr def = NULL;
+    virDomainPtr ret = NULL;
+
+    virCheckFlags(XEN_MIGRATION_FLAGS, NULL);
+
+    if (virTypedParamsValidate(params, nparams, XEN_MIGRATION_PARAMETERS) < 0)
+        return NULL;
+
+    if (virTypedParamsGetString(params, nparams,
+                                VIR_MIGRATE_PARAM_DEST_NAME,
+                                &dname) < 0 || dname == NULL)
+        return NULL;
+
+    if (!dname || !(minidef = xenGetDomainDefForName(dconn, dname))) {
+        /* Migration obviously failed if the domain doesn't exist */
+        virReportError(VIR_ERR_OPERATION_FAILED,
+                       _("Migration failed. No domain on destination host "
+                         "with matching name '%s'"),
+                       NULLSTR(dname));
+        goto cleanup;
+    }
+
+    if (virDomainMigrateFinish3ParamsEnsureACL(dconn, minidef) < 0)
+        goto cleanup;
+
+    if (cancelled)
+        goto cleanup;
+
+    if (flags & VIR_MIGRATE_PERSIST_DEST) {
+        if (!(def = xenDaemonDomainGetXMLDesc(dconn, minidef, NULL))) {
+            virReportError(VIR_ERR_MIGRATE_PERSIST_FAILED,
+                           "%s", _("failed to get XML representation of migrated domain"));
+            goto cleanup;
+        }
+
+        if (xenDaemonDomainDefineXML(dconn, def) < 0) {
+            virReportError(VIR_ERR_MIGRATE_PERSIST_FAILED,
+                           "%s", _("failed to define domain on destination host"));
+            goto cleanup;
+        }
+    }
+
+    ret = virGetDomain(dconn, minidef->name, minidef->uuid);
+    if (ret)
+        ret->id = minidef->id;
+
+ cleanup:
+    virDomainDefFree(minidef);
+    virDomainDefFree(def);
+    return ret;
+}
+
+static int
+xenUnifiedDomainMigrateConfirm3Params(virDomainPtr dom,
+                                      virTypedParameterPtr params,
+                                      int nparams,
+                                      const char *cookiein ATTRIBUTE_UNUSED,
+                                      int cookieinlen ATTRIBUTE_UNUSED,
+                                      unsigned int flags,
+                                      int cancelled)
+{
+    virDomainDefPtr def = NULL;
+    int ret = 0;
+
+    virCheckFlags(XEN_MIGRATION_FLAGS, -1);
+    if (virTypedParamsValidate(params, nparams, XEN_MIGRATION_PARAMETERS) < 0)
+        return -1;
+
+    if (!(def = xenGetDomainDefForDom(dom)))
+        return -1;
+
+    if (virDomainMigrateConfirm3ParamsEnsureACL(dom->conn, def) < 0)
+        goto cleanup;
+
+    if (cancelled)
+        goto cleanup;
+
+    if (flags & VIR_MIGRATE_UNDEFINE_SOURCE)
+        ret = xenDaemonDomainUndefine(dom->conn, def);
+
+ cleanup:
+    virDomainDefFree(def);
+    return ret;
+}
+
 static int
 xenUnifiedConnectListDefinedDomains(virConnectPtr conn, char **const names,
                                     int maxnames)
@@ -2878,6 +3112,11 @@ static virDriver xenUnifiedDriver = {
     .domainMigratePrepare = xenUnifiedDomainMigratePrepare, /* 0.3.2 */
     .domainMigratePerform = xenUnifiedDomainMigratePerform, /* 0.3.2 */
     .domainMigrateFinish = xenUnifiedDomainMigrateFinish, /* 0.3.2 */
+    .domainMigrateBegin3Params = xenUnifiedDomainMigrateBegin3Params, /* 1.0.5 */
+    .domainMigratePrepare3Params = xenUnifiedDomainMigratePrepare3Params, /* 1.0.5 */
+    .domainMigratePerform3Params = xenUnifiedDomainMigratePerform3Params, /* 1.0.5 */
+    .domainMigrateFinish3Params = xenUnifiedDomainMigrateFinish3Params, /* 1.0.5 */
+    .domainMigrateConfirm3Params = xenUnifiedDomainMigrateConfirm3Params, /* 1.0.5 */
     .domainBlockStats = xenUnifiedDomainBlockStats, /* 0.3.2 */
     .domainInterfaceStats = xenUnifiedDomainInterfaceStats, /* 0.3.2 */
     .domainBlockPeek = xenUnifiedDomainBlockPeek, /* 0.4.4 */
Index: libvirt-1.2.5/src/xen/xen_driver.h
===================================================================
--- libvirt-1.2.5.orig/src/xen/xen_driver.h
+++ libvirt-1.2.5/src/xen/xen_driver.h
@@ -83,6 +83,13 @@ extern int xenRegister (void);
      VIR_MIGRATE_PERSIST_DEST)
 
 
+/* All supported migration parameters and their types. */
+# define XEN_MIGRATION_PARAMETERS                               \
+    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, \
+    NULL
+
 typedef struct xenXMConfCache *xenXMConfCachePtr;
 typedef struct xenXMConfCache {
     time_t refreshedAt;
