Simplify the Xen domain migration driver methods

All the migration code is done by the XenD subdriver which
can be assumed to always be present

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange 2013-04-30 17:27:59 +01:00
parent 970092dcde
commit 69b8c55714

View File

@ -1244,17 +1244,11 @@ xenUnifiedDomainMigratePrepare(virConnectPtr dconn,
const char *dname, const char *dname,
unsigned long resource) unsigned long resource)
{ {
xenUnifiedPrivatePtr priv = dconn->privateData;
virCheckFlags(XEN_MIGRATION_FLAGS, -1); virCheckFlags(XEN_MIGRATION_FLAGS, -1);
if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) return xenDaemonDomainMigratePrepare(dconn, cookie, cookielen,
return xenDaemonDomainMigratePrepare(dconn, cookie, cookielen, uri_in, uri_out,
uri_in, uri_out, flags, dname, resource);
flags, dname, resource);
virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
} }
static int static int
@ -1266,16 +1260,10 @@ xenUnifiedDomainMigratePerform(virDomainPtr dom,
const char *dname, const char *dname,
unsigned long resource) unsigned long resource)
{ {
xenUnifiedPrivatePtr priv = dom->conn->privateData;
virCheckFlags(XEN_MIGRATION_FLAGS, -1); virCheckFlags(XEN_MIGRATION_FLAGS, -1);
if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) return xenDaemonDomainMigratePerform(dom, cookie, cookielen, uri,
return xenDaemonDomainMigratePerform(dom, cookie, cookielen, uri, flags, dname, resource);
flags, dname, resource);
virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
} }
static virDomainPtr static virDomainPtr
@ -1292,24 +1280,22 @@ xenUnifiedDomainMigrateFinish(virConnectPtr dconn,
virCheckFlags(XEN_MIGRATION_FLAGS, NULL); virCheckFlags(XEN_MIGRATION_FLAGS, NULL);
dom = xenUnifiedDomainLookupByName(dconn, dname); if (!(dom = xenUnifiedDomainLookupByName(dconn, dname)))
if (! dom) {
return NULL; return NULL;
}
if (flags & VIR_MIGRATE_PERSIST_DEST) { if (flags & VIR_MIGRATE_PERSIST_DEST) {
domain_xml = xenDaemonDomainGetXMLDesc(dom, 0, NULL); domain_xml = xenDaemonDomainGetXMLDesc(dom, 0, NULL);
if (! domain_xml) { if (! domain_xml) {
virReportError(VIR_ERR_MIGRATE_PERSIST_FAILED, virReportError(VIR_ERR_MIGRATE_PERSIST_FAILED,
"%s", _("failed to get XML representation of migrated domain")); "%s", _("failed to get XML representation of migrated domain"));
goto failure; goto error;
} }
dom_new = xenDaemonDomainDefineXML(dconn, domain_xml); dom_new = xenDaemonDomainDefineXML(dconn, domain_xml);
if (! dom_new) { if (! dom_new) {
virReportError(VIR_ERR_MIGRATE_PERSIST_FAILED, virReportError(VIR_ERR_MIGRATE_PERSIST_FAILED,
"%s", _("failed to define domain on destination host")); "%s", _("failed to define domain on destination host"));
goto failure; goto error;
} }
/* Free additional reference added by Define */ /* Free additional reference added by Define */
@ -1321,7 +1307,7 @@ xenUnifiedDomainMigrateFinish(virConnectPtr dconn,
return dom; return dom;
failure: error:
virDomainFree(dom); virDomainFree(dom);
VIR_FREE(domain_xml); VIR_FREE(domain_xml);