Hi,
I made a change to how link entries are read in from SMF so that if we
have two or more links each with different IDs but the same name, I read
in the first, and skip the rest. Note that we could run into a similar
situation with duplicate IDs.
I discovered today that if I then create new links, the new links can
get the IDs of the duplicates. If the new links are written to SMF,
then they will over write the duplicates because my code to write to SMF
will, if an entry for a link exists, update it.
For example, say we have the following property groups (links) with the
following properties in SMF:
link1/name bge0
..... (some other link properties, not important to the
discussion)
link2/name bge1
.....
link3/name bge1
.....
link ID 2 and link ID 3 both have the same name - a duplicate.
I see a few problems with my current approach, but before I changed any
code I wanted to solicit opinions from the group and the community.
How do we get into this situation? I got into the situation by using
svccfg to add property groups. I don't believe it is possible to get
into this situation any other way, but I haven't spent enough time
reviewing and testing the code to be able to rule out another possible
code path (and I would argue that if such a path existed, it would be a
bug).
I know we plan to tell administrators that the only way they can modify
the link information stored in SMF is via dladm. But, there might be
some inquisitive administrators out there who try it anyway.
I see we can do the following:
- Arbitrarily treat the first link found in a set of duplicates as the
"correct" one. I put "correct" in quotes because linkmgmtd has no way
of telling which one is the correct one. For this reason, I think we
should not delete the duplicates from SMF.
- Somehow mark the link ids for the duplicates as unusable, so that no
new links get assigned those link IDs. Again, we can't overwrite the
duplicates, they might be the actual correct entry.
- Change the SMF write code so that if it is told to create a link entry
in SMF and one already exists, don't update the existing one, flag an error.
I think this is the best way to approach the problem, are there any
better ones?
thanks,
Dan