[Libvirt-cim] [PATCH] Add association results filtering

Dan Smith danms at us.ibm.com
Thu Nov 8 19:21:25 UTC 2007


KR> # HG changeset patch
KR> # User Kaitlin Rupert <karupert at us.ibm.com>
KR> # Date 1194546376 28800
KR> # Node ID 66548720dc50f268b861d336ac295003a9a03ec9
KR> # Parent  404c4803b1b542676c4d283226a7cc3b7f3ab58d
KR> Add association results filtering.

Thanks!  I tested this with HostedResourcePool, since I had it handy.
Now, I can specify a result class of just, say, DiskPool and it
filters appropriately.  Very cool.

KR> +        result_list = *list;
KR> +        inst_list_init(list);
KR> +
KR> +        for (i = 0; result_list.list[i] != NULL; i++) {
KR> +                op = CMGetObjectPath(result_list.list[i], &s);
KR> +                if ((s.rc != CMPI_RC_OK) || CMIsNullObject(op))
KR> +                          goto out;
KR> +
KR> +                s = CMSetNameSpace(op, ns);
KR> +                if (s.rc != CMPI_RC_OK)
KR> +                          goto out;
KR> +
KR> +                if (!match_op(broker, op, filter_class))
KR> +                          continue;
KR> +
KR> +                inst_list_add(list, result_list.list[i]);
KR> +        }
KR> +
KR> +out:
KR> +        inst_list_free(&result_list);

I think it's a little weird to call your temporary list "result_list"
and then free it before you return.  Might be a little confusing to
someone reading your code without the context of this being a revision
on a previous version :)

I'll apply this, but I think it would be nice to get a little
follow-on patch to clean up the naming at some point :-D

-- 
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms at us.ibm.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvirt-cim/attachments/20071108/eeb629d9/attachment.sig>


More information about the Libvirt-cim mailing list