Commit Graph

27 Commits

Author SHA1 Message Date
Brian Goff 4b981436fe Fixup libnetwork lint errors
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2021-06-01 23:48:32 +00:00
Brian Goff 72c4a7b496 Fix issues running libnetwork tests.
libnetwork does different stuff depending on if you are running the
tests in a container or not... without telling it we are in a container
a bunch of the tests actually fail.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2021-06-01 22:14:41 +00:00
Brian Goff a0a473125b Fix libnetwork imports
After moving libnetwork to this repo, we need to update all the import
paths for libnetwork to point to docker/docker/libnetwork instead of
docker/libnetwork.
This change implements that.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2021-06-01 21:51:23 +00:00
Sebastiaan van Stijn 129e28baa3 Fix gofmt in preparation of Go 1.13 update
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-27 11:46:16 +01:00
Abhinandan Prativadi a0085a47fd IPAM and Bitseq test cases
This commit contains test cases to verify the changes and to
solidify the library.

Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
2018-03-09 09:24:10 -08:00
Abhinandan Prativadi 3d44975995 Adding a unit case to verify rollover
Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
2017-10-03 12:15:34 -07:00
Abhinandan Prativadi 813a24a51c Minor unit test change
Since bit allocation is no longer first available from
the start some verfications are removed/modified to
the change allocation model

Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
2017-09-29 11:33:26 -07:00
Abhinandan Prativadi 746070c39a Adding a unit test to catch offset scenarios
Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
2017-07-10 11:30:06 -07:00
Ke Li 23ac56fdd0 Remove unnecessary string formats
Signed-off-by: Ke Li <kel@splunk.com>
2016-11-22 09:29:53 +08:00
Alessandro Boch f43e4ec066 Fix bitseq.SetAnyInRange
- size 1 range is a valid input

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-09-13 11:52:12 -07:00
Jana Radhakrishnan 89e72d8888 Remove kvstore deps from datastore package
Currently datastore has dependencies on various kv backends.
This is undesirable if datastore had to be used as a backend
agnostic store management package with it's cache layer. This
PR aims to achieve that.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2016-04-15 15:36:44 -07:00
Vincent Demeester 421a3ec5d7 Use gofmt with -s instead of goimports
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-02-12 14:07:00 +01:00
Alessandro Boch 854fe82ba1 Allow bitseq caller to run consistency check
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-01-14 08:25:40 -08:00
Alessandro Boch 256e15a6fc Increase test coverage in bitsequence
- Cover random allocation/deallocation

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-12-11 16:32:44 -08:00
Alessandro Boch dc4285b9a4 Adjust ipam errors
- 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>
2015-12-02 13:38:04 -08:00
Alessandro Boch 90711b0def Fix bug in bitsequence.pushReservation
- 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>
2015-11-24 10:23:58 -08:00
Alessandro Boch 6026fe772c Remove 2^32 bits restriction on bitsequence
- Allow bitsequence of length 2^64-1
- Updated ID Manager and IPAM

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-10-10 05:42:26 -07:00
Alessandro Boch 09fec4e411 Allow to set bits in a range in bitseq
Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-09-18 14:42:36 -07:00
David Calavera cc02894a50 Move test specific functions to a testutils package.
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>
2015-09-07 13:33:28 -04:00
Alessandro Boch 01d6585a31 bitseq to provide atomic functions
- Also add validation for passed ordinal

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-08-16 09:38:17 -07:00
Alessandro Boch ee31009744 bitseq to only handle and return unsigned types
Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-08-16 09:38:17 -07:00
Alessandro Boch 467876e723 Control exported types in bitseq
- bitseq users only need to know Handle type

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-08-16 09:38:17 -07:00
Alessandro Boch e5842be694 network byte order to bitseq serializer
Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-08-16 09:38:17 -07:00
Alessandro Boch e39fc16c55 Rework push reservation w/ datastore
- 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>
2015-06-17 16:49:21 -07:00
Alessandro Boch d1a16bbb84 Add numerical ids manager
Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-06-17 16:46:05 -07:00
Alessandro Boch 75443aaf72 Add serialize/deserialize for sequence list
Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-06-17 16:37:59 -07:00
Alessandro Boch 5034c9bb11 Add bitseq package
- 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>
2015-06-17 16:37:59 -07:00