[Linux-ha-dev] Re: [mgmt][patch6]Replace uuid with meaningful name
Yan Gao
ygao at novell.com
Thu Aug 30 02:19:13 MDT 2007
> > Description:
> > Use meaningful id instead of UUID for convenience of adding similar
> > resources just by replacing appropriate pattern.
>
> This one is slightly more problematic, as the ids could be used several
> times this way (the chance of colliding with a UUID is close to zero).
There used to be several places where using uuid as id:
* "nvpair" in attributes for instance_attributes (or meta_attributes if
it existed)
* "op" in operations
* "expression" in rules
The new naming policy in general is:
prefix_type_keyword
The "prefix" is the name of the current node in the tree, actually is
the id of a primitive, rsc_location, group and so on.
The "type" may be "instattr", "metaattr" "expr" or "op".
The "keyword" is :
*The "name" field of "nvpair" for attributes ,or
*The "name" field of "op", or
*The "attribute" field of "expression"
For instance:
<primitive id="resource_ip" class="ocf" type="IPaddr2"
provider="heartbeat">
<instance_attributes id="resource_ip_instance_attrs">
<attributes>
<nvpair id="resource_ip_instattr_ip" name="ip"
value="147.2.207.138"/>
<nvpair id="resource_ip_instattr_nic" name="nic"
value="eth0"/>
</attributes>
</instance_attributes>
</primitive>
(Though I think nvpair id should inherit from instance_attributes id
instead of primitive id. But the instance_attributes id is generated in
mgmtd by now, since haclient supports single instance_attributes segment
for a resource by now)
For "nvpair" in attributes, that's enough.
Because we don't need set an attribute twice or more.
Actually even we set an attribute twice or more, haclient will just
retain the last set when getting them from the table. This happens prior
to the generation of id. So we won't meet collisions
While, for "op"s in operations and "expression"s in location rules,
there are possibilities to have same keyword used for id. So I add uuid
as a suffix to avoid collisions.(It's not a complete "replacing
uuid". :( )
> Besides, duplicating all the info - rsc id, attribute set, resource name
> - in the ID is not really useful either ;-)
The requirement was from Xinwei. I think maybe it's convenient when we
create a similar resource with cibadmin, and make ids readable.
--
Yan Gao
China R&D Software Engineer
ygao at novell.com
+86 10 65339229
Novell, Inc.
SUSE® Linux Enterprise
Your Linux is ready
http://www.novell.com/linux
More information about the Linux-HA-Dev
mailing list