- Remove from contract predefined errors which are no longer
valid (ex. ErrInvalidIpamService, ErrInvalidIpamConfigService)
- Do not use network driver error for ipam load failure in controller.go
- Bitseq to expose two well-known errors (no more bit available, bit is already set)
- Default ipam to report proper well-known error on RequestAddress()
based on bitseq returned error
- Default ipam errors to comply with types error interface
Signed-off-by: Alessandro Boch <aboch@docker.com>
- pushReservation fails to correctly detect when
the affected block is the last in the current
sequence. It thinks instead the block is in between
the sequence. Because of this a couple of issues
may happen:
1. The allocation of the last bit causes the creation
of a phantom sequence (length 0) at the end.
(This has no side effects).
2. The allocation of a bit somewhere in the middle of
the bitmask may lead to a completely incorrect
sequence pattern.
Signed-off-by: Alessandro Boch <aboch@docker.com>
- Set bridge ipv4 address when bridge is present
- IPv6 changes for bridge
- Convert unit tests to the new model
Signed-off-by: Alessandro Boch <aboch@docker.com>
Remove the need for watching for IPAM data
structures and add multi store support code and
data reorganization to simplify address space
management.
Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
- When creating the handle, write it to store if
not present. Currently it is written to store
only on first bit allocation.
Signed-off-by: Alessandro Boch <aboch@docker.com>
This way we won't vendor test related functions in docker anymore.
It also moves netns related functions to a new ns package to be able to
call the ns init function in tests. I think this also helps with the
overall package isolation.
Signed-off-by: David Calavera <david.calavera@gmail.com>
When bit sequence is trying to get key/value from the
data store it should always unmarshall the json data
before using it, as the data is JSON marshalled before
storing it in the data store.
Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
- We must ignore key not found error when querying
datastore for initial state.
- Regression introduced by 04bd8f67ad
Signed-off-by: Alessandro Boch <aboch@docker.com>
In that commit, AtomicPutCreate takes previous = nil to Atomically create keys
that don't exist. We need a create operation that is atomic to prevent races
between multiple libnetworks creating the same object.
Previously, we just created new KVs with an index of 0 and wrote them to the
datastore. Consul accepts this behaviour and interprets index of 0 as
non-existing, but other data backends do no.
- Add Exists() to the KV interface. SetIndex() should also modify a KV so
that it exists.
- Call SetIndex() from within the GetObject() method on DataStore interface.
- This ensures objects have the updated values for exists and index.
- Add SetValue() to the KV interface. This allows implementers to define
their own method to marshall and unmarshall (as bitseq and allocator have).
- Update existing users of the DataStore (endpoint, network, bitseq,
allocator, ov_network) to new interfaces.
- Fix UTs.
- At Handle creation, first check if an instance of the
the respective object is already present in the datastore.
- Handle sequence must be saved only if commit
to datastore is succesfull
- Caller (ipam) needs to manage the retry
Signed-off-by: Alessandro Boch <aboch@docker.com>
- Handle contains sequence and identifier.
This way datastore integration can be done
at bitseq level.
Signed-off-by: Alessandro Boch <aboch@docker.com>
- Initial version
- It allows handling reservation/release of a finite set
of resources through large bitmask.
- It represents the bitmask as a list of equal
consecutive 32 bits long bitmask symbols.
It basically operates on a run-length encoding
of the bitmask without encode/decode processing.
Signed-off-by: Alessandro Boch <aboch@docker.com>