# HG changeset patch
# User Richard Maciel <rmaciel(a)linux.vnet.ibm.com>
# Date 1250173906 10800
# Node ID fc6b58380e5f04b09514bdfe8aef54ed0a013e42
# Parent 20528f913ec18441bf1ef2f812d110580fa01015
(#2) MigrationJob will write a migration mark to the infostore of the guest migrating
This allows ComputerSystem to know when its respective guest is being migrated
#2:
Fixed patch submission date
Signed-off-by: Richard Maciel <rmaciel(a)linux.vnet.ibm.com>
diff -r 20528f913ec1 -r fc6b58380e5f src/Virt_VSMigrationService.c
--- a/src/Virt_VSMigrationService.c Tue Jun 16 14:25:50 2009 -0700
+++ b/src/Virt_VSMigrationService.c Thu Aug 13 11:31:46 2009 -0300
@@ -48,6 +48,7 @@
#include "Virt_ComputerSystem.h"
#include "Virt_VSMigrationSettingData.h"
#include "svpc_types.h"
+#include "libxkutil/infostore.h"
#include "config.h"
@@ -1135,6 +1136,24 @@
return s;
}
+static void clear_infstore_migration_mark(virDomainPtr dom)
+{
+ struct infostore_ctx *infp;
+ bool ret = false;
+
+ infp = infostore_open(dom);
+ if (infp == NULL) {
+ CU_DEBUG("Unable to open domain information store."
+ "Migration mark won't be cleared");
+ return;
+ }
+
+ ret = infostore_set_bool(infp, "migrating", false);
+ CU_DEBUG("Clearing infostore migrating flag");
+
+ infostore_close(infp);
+}
+
static CMPIStatus migrate_vs(struct migration_job *job)
{
CMPIStatus s;
@@ -1210,6 +1229,7 @@
CMGetCharPtr(s.msg));
}
out:
+ clear_infstore_migration_mark(dom);
raise_deleted_ind(job);
free(uri);
@@ -1251,6 +1271,45 @@
return NULL;
}
+static bool set_infstore_migration_mark(const CMPIObjectPath *ref,
+ const char *domain)
+{
+ struct infostore_ctx *infp;
+ bool ret = false;
+ CMPIStatus s;
+ virConnectPtr conn = NULL;
+ virDomainPtr dom = NULL;
+
+ conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s);
+ if (conn == NULL)
+ goto out;
+
+ dom = virDomainLookupByName(conn, domain);
+ if (dom == NULL) {
+ CU_DEBUG("No such domain");
+ goto out;
+ }
+
+
+ infp = infostore_open(dom);
+ if (infp == NULL) {
+ CU_DEBUG("Unable to open domain information store."
+ "Migration mark won't be placed");
+ goto out;
+ }
+
+ ret = infostore_set_bool(infp, "migrating", true);
+ CU_DEBUG("Migration mark set");
+
+ infostore_close(infp);
+
+ out:
+ virDomainFree(dom);
+ virConnectClose(conn);
+
+ return ret;
+}
+
static CMPIInstance *_migrate_job_new_instance(const char *cn,
const char *ns)
{
@@ -1411,6 +1470,10 @@
goto out;
}
+ rc = set_infstore_migration_mark(ref, domain);
+ if (!rc)
+ CU_DEBUG("Failed to set migration mark in infostore");
+
ind = prepare_indication(_BROKER, inst, job, MIG_CREATED, &s);
rc = raise_indication(job->context, MIG_CREATED, job->ref_ns,
inst, ind);
Show replies by date