Dan Smith wrote:
KR> The change to "from_str()" here is so that one would
be able to
KR> pass the classname in. The logic for determining the device /
KR> pool type is the same for the InstanceID and the classname.
Right, but we could potentially need to look at more of the ID in some
cases to determine the type, right? If we had disk pools that
represent LVMs separately from file images or something like that. I
suppose it's reasonable to think that the classname would always
indicate the subtype, but it just seems cleaner to me to always do it
From an ID.
Ah, yes - this is a really good point.
Hmm.. cu_compare_ref() seems like it could be used , except that the
handler would need to construct an instance just for the purpose of
comparing it against the ref, which seems a little unnecessary to me.
It's probably best to leave device_type_from_poolid() as is, but devise
some other way to further make sure the ref is a valid one.
Ideally, GetInstance() from Virt_DevicePool should be able to check
whether the ref is valid. However GetInstance() also supports refs with
mis-matching InstanceIDs and class types. =) So, if this issue is
fixed in Virt_DevicePool, the same logic / function could be reused in
RAFP and EAFP.
I'll see if I can cook up something a little more elegant in
Virt_DevicePool. Thanks for the feedback! =)
--
Kaitlin Rupert
IBM Linux Technology Center
karupert(a)us.ibm.com