[Libvirt-cim] [PATCH 3 of 3] Remove the system from the source guest

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Fri Mar 14 00:10:30 UTC 2008


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1205453397 25200
# Node ID 8a689c81d44016468f58f10df8026f729c1cb2aa
# Parent  9905f7a33ed9ef02ff6ecfc0d1b5b335dcd16580
Remove the system from the source guest.

If the guest is still defined on the source after the migrate, remove the guest.

Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

diff -r 9905f7a33ed9 -r 8a689c81d440 src/Virt_VSMigrationService.c
--- a/src/Virt_VSMigrationService.c	Thu Mar 13 17:09:55 2008 -0700
+++ b/src/Virt_VSMigrationService.c	Thu Mar 13 17:09:57 2008 -0700
@@ -685,6 +685,24 @@ static CMPIStatus handle_offline_migrate
         return s;
 }
 
+static CMPIStatus remove_guest(char *dom_name,
+                               virDomainPtr dom,
+                               virConnectPtr conn)
+{
+        CMPIStatus s = {CMPI_RC_OK, NULL};
+
+        if (!domain_exists(conn, dom_name))
+                goto out;
+
+         if (virDomainUndefine(dom))
+                cu_statusf(_BROKER, &s,
+                           CMPI_RC_ERR_FAILED,
+                           "Unable to remove guest from target system.");
+
+ out:
+         return s;
+}
+
 static CMPIStatus migrate_vs(struct migration_job *job)
 {
         CMPIStatus s;
@@ -729,6 +747,10 @@ static CMPIStatus migrate_vs(struct migr
         if (s.rc != CMPI_RC_OK)
                 goto out;
 
+        s = remove_guest(job->domain, dom, conn);
+        if (s.rc != CMPI_RC_OK)
+                CU_DEBUG("Undefine of guest on source system failed");
+
         CU_DEBUG("Migration succeeded");
 
         s = define_guest_on_target(job->conn, NULL, job, false);




More information about the Libvirt-cim mailing list