# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1212097721 25200
# Node ID 8c3b74f06d88a4a8b6aa7451e65b82e2f3c502a5
# Parent 05a5ba2fda5d03facdea4e0cdfdc26d4a47d80fd
Add polling for domain undefine in VSMigrationService.
Use the same timeout duration used for the domain shutdown. This should be more than
enough time for the guest to complete migration.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 05a5ba2fda5d -r 8c3b74f06d88 src/Virt_VSMigrationService.c
--- a/src/Virt_VSMigrationService.c Wed May 28 14:04:50 2008 -0700
+++ b/src/Virt_VSMigrationService.c Thu May 29 14:48:41 2008 -0700
@@ -977,8 +977,34 @@
{
CMPIStatus s = {CMPI_RC_OK, NULL};
virDomainPtr newdom = NULL;
+ virDomainPtr dom;
+ int i;
+ int ret;
- if (virDomainUndefine(ldom) == -1) {
+ for (i = 0; i < MIGRATE_SHUTDOWN_TIMEOUT; i++) {
+ if ((i % 30) == 0) {
+ CU_DEBUG("Polling to undefine guest %s...",
+ virDomainGetName(ldom));
+ }
+
+ dom = virDomainLookupByName(virDomainGetConnect(ldom),
+ virDomainGetName(ldom));
+ if (dom == NULL) {
+ CU_DEBUG("Unable to re-lookup domain");
+ ret = -1;
+ break;
+ }
+
+ ret = virDomainUndefine(dom);
+ virDomainFree(dom);
+
+ if (ret == 0)
+ break;
+
+ sleep(1);
+ }
+
+ if (ret != 0) {
CU_DEBUG("Undefine of local domain failed");
}
Show replies by date