Descriptionstate: Make unit ids unique. Fix #1174610
This changes the way unit names are generated
when adding a new unit to a service. Before,
we used serviceDoc.UnitSeq to generate the
last part of a unit name. Now, we use the
sequence collection with a key "s#<svcname>#unit"
as the unit ids sequence (as we do for machine,
containers, etc.).
This is a schema change (removing of UnitSeq from
the service document). So it should be handled the
same way as any schema change during an upgrade,
but this CL does not do that.
I realized the sequence collection is not created
as all the other collections in state.Initialize,
so I added it there.
Also added a test to guarantee unit ids increase
each time for the same service name (like the bug
suggests and how it was before).
Per fwereade's suggestion, I changed the error
message AddUnit() returns when a service is not
found: "service is no longer alive" rather than
"service "blah" not found", and also fixed a
test that relied on that.
https://code.launchpad.net/~dimitern/juju-core/300-lp-1174610-unit-ids-unique/+merge/206765
(do not edit description out of merge proposal)
Patch Set 1 #
MessagesTotal messages: 5
|