[PATCH] Enable localhost migration

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1208468793 25200 # Node ID cde152f395894de028ff76e84ea2450aff7276f6 # Parent f02d710dc8bde391311002d8c3104166c741164d Enable localhost migration. Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r f02d710dc8bd -r cde152f39589 src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c Wed Apr 16 16:55:52 2008 -0700 +++ b/src/Virt_VSMigrationService.c Thu Apr 17 14:46:33 2008 -0700 @@ -76,6 +76,7 @@ virConnectPtr conn; char *ref_cn; char *ref_ns; + char *host; uint16_t type; char uuid[33]; }; @@ -1045,12 +1046,15 @@ goto out; } - if (domain_exists(job->conn, job->domain)) { - CU_DEBUG("Remote domain `%s' exists", job->domain); - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Remote already has domain `%s'", job->domain); - goto out; + if (!STREQ(job->host, "localhost")) { + if (domain_exists(job->conn, job->domain)) { + CU_DEBUG("Remote domain `%s' exists", job->domain); + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Remote already has domain `%s'", + job->domain); + goto out; + } } s = prepare_migrate(dom, &xml); @@ -1131,6 +1135,7 @@ free(job->domain); free(job->ref_cn); free(job->ref_ns); + free(job->host); free(job); return NULL; @@ -1238,6 +1243,7 @@ job->domain = strdup(domain); job->ref_cn = strdup(CLASSNAME(ref)); job->ref_ns = strdup(NAMESPACE(ref)); + job->host = strdup(host); uuid_generate(uuid); uuid_unparse(uuid, job->uuid);

KR> - if (domain_exists(job->conn, job->domain)) { KR> - CU_DEBUG("Remote domain `%s' exists", job->domain); KR> - cu_statusf(_BROKER, &s, KR> - CMPI_RC_ERR_FAILED, KR> - "Remote already has domain `%s'", job->domain); KR> - goto out; KR> + if (!STREQ(job->host, "localhost")) { KR> + if (domain_exists(job->conn, job->domain)) { This is a minor thing, but can't these two conditions be joined with && to avoid increasing the nesting level unnecessarily? KR> + CU_DEBUG("Remote domain `%s' exists", job->domain); KR> + cu_statusf(_BROKER, &s, KR> + CMPI_RC_ERR_FAILED, KR> + "Remote already has domain `%s'", KR> + job->domain); KR> + goto out; KR> + } KR> } -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com
participants (2)
-
Dan Smith
-
Kaitlin Rupert