Commit graph

32 commits

Author SHA1 Message Date
Albin Kerouanton
42d34e40f9
libnet: Replace BadRequest with InvalidParameter
InvalidParameter is now compatible with errdefs.InvalidParameter. Thus,
these errors will now return a 400 status code instead of a 500.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2023-08-17 16:45:04 +02:00
Albin Kerouanton
40adb4317b
api: Remove duplicated check on CheckDuplicate
Partially revert commit 94b880f.

The CheckDuplicate field has been introduced in commit 2ab94e1. At that
time, this check was done in the network router. It was then moved to
the daemon package in commit 3ca2982. However, commit 94b880f duplicated
the logic into the network router for no apparent reason. Finally,
commit ab18718 made sure a 409 would be returned instead of a 500.

As this logic is first done by the daemon, the error -> warning
conversion can't happen because CheckDuplicate has to be true for the
daemon package to return an error. If it's false, the daemon proceed
with the network creation, set the Warning field of its return value and
return no error.

Thus, the CheckDuplicate logic in the api is removed and
libnetwork.NetworkNameError now implements the ErrConflict interface.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2023-08-08 10:00:02 +02:00
Sebastiaan van Stijn
a40d00c421
libnetwork: remove ErrDataStoreNotInitialized
If was not used as a sentinel error, so inline the error.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-31 21:00:33 +02:00
Sebastiaan van Stijn
66b379785e
libnetwork: remove unused InvalidContainerIDError
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-31 21:00:33 +02:00
Sebastiaan van Stijn
d8cd4f6421
libnetwork: remove unused UnknownEndpointError
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-31 21:00:33 +02:00
Sebastiaan van Stijn
fc5c16f491
libnetwork: remove unused NetworkTypeError
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-31 21:00:33 +02:00
Sebastiaan van Stijn
e9f1888560
libnetwork: remove unused ErrInvalidConfigFile
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-31 21:00:32 +02:00
Sebastiaan van Stijn
eadaaa7f79
libnetwork: remove unused ErrNoContainer
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-31 21:00:32 +02:00
Sebastiaan van Stijn
99ab11bb90
libnetwork: remove unused ErrInvalidJoin
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-31 21:00:32 +02:00
Sebastiaan van Stijn
9174eb00e2
libnetwork: remove unused ErrInvalidNetworkDriver
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-31 21:00:32 +02:00
Cory Snider
befff0e13f libnetwork: remove more datastore scope plumbing
Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-01-26 17:56:40 -05:00
Alessandro Boch
fc4d9bd640 Merge pull request #1616 from chchliang/testnetwork
print name and id infomation  when  has active endpoints
2017-04-10 13:54:44 -07:00
Akihiro Suda
79bf46fd79 improve error for getStore()
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-04-05 05:37:58 +00:00
chchliang
6e31451d16 print name and id infomation when has active endpoints
Signed-off-by: chchliang <chen.chuanliang@zte.com.cn>
2017-03-24 09:40:27 +08:00
Madhu Venugopal
8e2ca0471c Revert "validate network and endpoint name more strictly"
This reverts commit 761722395d.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2017-02-01 18:18:17 -08:00
Jana Radhakrishnan
f32c9768a8 Merge pull request #1510 from allencloud/validate-network-and-endpoint-name-strictly
validate network and endpoint name more strictly
2016-11-02 09:57:50 -07:00
yuexiao-wang
97915bde44 Fix some typos
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
2016-10-29 01:31:35 +08:00
allencloud
761722395d validate network and endpoint name more strictly
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-10-18 11:01:18 +08:00
Madhu Venugopal
9054ac2b48 Provide a way for libnetwork to make use of Agent mode functionalities
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2016-06-05 18:41:21 -07:00
allencloud
de588f950d fix typos
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-05-30 18:20:52 +08:00
Madhu Venugopal
3d3bd9331f Fixed a couple of error messages to address UX related comments
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-10-09 01:45:24 -07:00
Jana Radhakrishnan
1ac72c85cb Add LeaveAll support
Currently container can join one endpoint when it is started.
More endpoints can be attached at a later point in time. But
when that happens this attachment should only have meaning
only as long as the container is alive. The attachment should
lose it's meaning when the container goes away. Cuurently there
is no way for the container management code to tell libnetwork
to detach the container from all attached endpoints. This PR
provides an additional API `LeaveAll` which adds this
functionality,

To facilitate this and make the sanbox lifecycle consistent
some slight changes have been made to the behavior of sandbox
management code. The sandbox is no longer destroyed when the
last endpoint is detached from the container. Instead the sandbox
ie kept alive and can only be destroyed with a `LeaveAll` call.
This gives better control of sandbox lifecycle by the container
management code and the sandbox doesn't get destroyed from under
the carpet while the container is still using it.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-06-19 18:55:26 -07:00
Alessandro Boch
0912ecfc05 Add Service hierarchy to rest api
Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-06-11 15:46:45 -07:00
Madhu Venugopal
481568035f TOML based Configuration support for libnetwork
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-05-25 16:29:40 -07:00
Alessandro Boch
c70cfcb150 Provide interface to categorize errors
- Package types to define the interfaces libnetwork errors
  may implement, so that caller can categorize them.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-05-20 22:29:29 -07:00
Alessandro Boch
1e91009978 Network and Endpoint query methods to return error on not found
- As requested by Docker committers

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-05-15 16:18:04 -07:00
Alessandro Boch
d69e66c894 By ID and By Name query methods to return error
(Requested by docker reviewer on libnetwork integration PR)

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-05-11 16:25:36 -07:00
Alessandro Boch
1739626f4d NewNetwork and CreateEndpoint to validate resource name
Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-05-10 10:59:58 -07:00
Jana Radhakrishnan
7f7d9abd87 Make endpoint Join and Leave multi-thread safe
- Refactored the Join/Leave code so they are synchronized across multiple go-routines
    - Added parallel test coverage to test mult-thread access to Join/Leave
    - Updated sandbox code to revert back to caller namespace when removing interfaces
    - Changed the netns path to /var/run/netns so the cleanup is simpler on machine
      reboot scenario

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-05-10 17:36:04 +00:00
Madhu Venugopal
570a76384a Handled endpoint delete with active containers attached to it
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-05-06 13:04:39 -07:00
Jana Radhakrishnan
e2d8531a40 - Added support for Join/Leave methods to Endpoint.
- Removed sandbox key argument for CreateEndpoint.
- Refactored bridge driver code to remove sandbox key.
- Fixed bridge driver code for gaps in ipv6 behavior
  observed during docker integration.
- Updated test code, readme code, README.md according
  api change.
- Fixed some sandbox issues while testing docker ipv6
  integration.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-04-29 14:49:32 +00:00
Jana Radhakrishnan
56c3adda07 - Added more testcases for libnetwork API testing
- Added new error types for all of libnetwork errors

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-04-16 05:15:57 +00:00