[Libvirt-cim] [PATCH] MigrationJob will write a migration mark to the infostore of the guest migrating

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Thu Aug 13 15:41:27 UTC 2009


> @@ -1135,6 +1136,24 @@
>          return s;
>  }
> 
> +static void clear_infstore_migration_mark(virDomainPtr dom)

I would change "mark' to "flag" as I think flag makes a little more sense.

> +{
> +        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");

Same here, change "mark" to "flag"

> +                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)

Same here.

> +{
> +        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;

Instead of getting the connection here, why not take a virConnectPtr 
parameter?

> +
> +        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");

Change "mark" to "flag"

> +                goto out;
> +        }
> +
> +        ret = infostore_set_bool(infp, "migrating", true);
> +        CU_DEBUG("Migration mark set");

Same here.

> +
> +        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");
> +

Change "mark" to "flag".

-- 
Kaitlin Rupert
IBM Linux Technology Center
kaitlin at linux.vnet.ibm.com




More information about the Libvirt-cim mailing list