[refactor] Docker Driver clean up CNM API and core

Bug #1780983 reported by Michał Kostrzewa
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juniper Openstack
Status tracked in Trunk
Trunk
Fix Committed
Undecided
Michał Kostrzewa
OpenContrail
Fix Committed
Undecided
Unassigned

Bug Description

Right now, driver "glue" logic is mixed with CNM API. It makes it hard to reason about core driver logic.

Tags: windows
Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] master

Review in progress for https://review.opencontrail.org/44497
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44568
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44570
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44573
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44570
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44568
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44497
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/44497
Committed: http://github.com/Juniper/contrail-windows-docker-driver/commit/f479ba4c0a545622fe35df19a996bdfd5d8ff482
Submitter: Zuul v3 CI (<email address hidden>)
Branch: master

commit f479ba4c0a545622fe35df19a996bdfd5d8ff482
Author: Michal Kostrzewa <email address hidden>
Date: Tue Jul 10 16:10:25 2018 +0200

Don't rely on docker metadata in DeleteNetwork.

For a long time, we used metadata stored in docker networks and HNS
network names to handle DeleteNetwork request. Also, we rely on docker
network metadata to associate them with Contrail networks.

Many open-source plugins for CNM have their own key-value store instead,
to hold these associations.

I don't think we should employ such solution at the moment. We can keep
using HNS network names as this "pseudo" storage for associations.

This change mainly:
* makes this HNS-based association mechanism more explicit (by
the means of HNSDBNetworkAssociationMechanism)
* adds dockerID as part of the HNS name, to reverse the dependency (instead
of holding Contrail network and tenant names in docker network metadata,
we now store docker network ID in HNS network name)
* to make using the new data model easier, Network and LocalEndpoint
structs were created in the model package.
* a bunch of code changes to use the new APIs.
* refactor DeleteNetwork handler to use them.

Change-Id: Id674fb58e63600ad7a4884032f59b10aff53337e
Partial-Bug: #1780983

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] master

Review in progress for https://review.opencontrail.org/44573
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44570
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44568
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44697
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44701
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44702
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44697
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44703
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44707
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44708
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44703
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44697
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44573
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44570
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44707
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44568
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44964
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44702
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44708
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44697
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44703
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44964
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44707
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44964
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44968
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44701
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44702
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44708
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44703
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44702
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44707
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44708
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44707
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44708
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/44701
Committed: http://github.com/Juniper/contrail-windows-docker-driver/commit/67aa44d0f0afc07a45d14e0974620a8a43de9cb3
Submitter: Zuul v3 CI (<email address hidden>)
Branch: master

commit 67aa44d0f0afc07a45d14e0974620a8a43de9cb3
Author: Michal Kostrzewa <email address hidden>
Date: Tue Jul 17 14:31:51 2018 +0200

Use http.StatusNotFound instead of "404" string.

Change-Id: I44acaaeb72e734160f8687ab7205afaf6cf24ef5
Partial-bug: #1780983

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] master

Review in progress for https://review.opencontrail.org/44697
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44573
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44570
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44568
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44703
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44707
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44708
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44968
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44964
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/44702
Committed: http://github.com/Juniper/contrail-windows-docker-driver/commit/1beaf1c19f2ce868159e7c871d005a096973db60
Submitter: Zuul v3 CI (<email address hidden>)
Branch: master

commit 1beaf1c19f2ce868159e7c871d005a096973db60
Author: Michal Kostrzewa <email address hidden>
Date: Tue Jul 17 14:41:47 2018 +0200

Fix failure reporting in Invoke-Build.ps1

Change-Id: I7ae3891e274d06395f381c91256628866128af2a
Partial-Bug: #1780983

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] master

Review in progress for https://review.opencontrail.org/44697
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44968
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44964
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44707
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44703
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44568
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44708
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/44573
Committed: http://github.com/Juniper/contrail-windows-docker-driver/commit/fedd768407150c503ab7c23df2b5685363e5df76
Submitter: Zuul v3 CI (<email address hidden>)
Branch: master

commit fedd768407150c503ab7c23df2b5685363e5df76
Author: Michal Kostrzewa <email address hidden>
Date: Thu Jul 12 19:22:01 2018 +0200

Remove outdated tests from plugin_test.go

Some of them were implemented as unit tests in driver_core_test.go
already.

Change-Id: I0670a9769e355cdb3c749b2c49d876d4617e0024
Partial-Bug: #1780983

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] master

Review in progress for https://review.opencontrail.org/44568
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/44568
Committed: http://github.com/Juniper/contrail-windows-docker-driver/commit/17ce3537f87aa6ad05bb064e495d081146dbeb33
Submitter: Zuul v3 CI (<email address hidden>)
Branch: master

commit 17ce3537f87aa6ad05bb064e495d081146dbeb33
Author: Michal Kostrzewa <email address hidden>
Date: Thu Jul 12 17:18:41 2018 +0200

Split plugin integration and cnm validation tests.

Towards clean `cnm` package, moved integration tests that test if
docker libnetwork plugin interfaces correctly with docker daemon to
separate package under integration_tests.

Change-Id: I1552d2f00b90e253e7c06f82f2dfdfa86e45819c
Partial-Bug: #1780983

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] master

Review in progress for https://review.opencontrail.org/44968
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44697
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44964
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44570
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44707
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44703
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/44570
Committed: http://github.com/Juniper/contrail-windows-docker-driver/commit/fd61b2a3d676b53fda232353af0c36b75194f181
Submitter: Zuul v3 CI (<email address hidden>)
Branch: master

commit fd61b2a3d676b53fda232353af0c36b75194f181
Author: Michal Kostrzewa <email address hidden>
Date: Thu Jul 12 17:48:46 2018 +0200

Rename docker_libnetwork_plugin to cnm.

Rename the package.

Change-Id: If10f185fabd746e0a0831ff0f5c6adfa729e1564
Partial-Bug: #1780983

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] master

Review in progress for https://review.opencontrail.org/44697
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44968
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44964
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44707
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/44703
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/44697
Committed: http://github.com/Juniper/contrail-windows-docker-driver/commit/292cddc77f033f1493b01af17db3782f965c2166
Submitter: Zuul v3 CI (<email address hidden>)
Branch: master

commit 292cddc77f033f1493b01af17db3782f965c2166
Author: Michal Kostrzewa <email address hidden>
Date: Tue Jul 17 12:44:36 2018 +0200

Move DeleteEndpoint to core.

This is the last place that used docker network metadata.
Our CNM API is therefore pure.

This PR doesn't refactor DeleteEndpoint method yet.

* Moved tests, too.
* Accidentaly fixed DeleteElementRecursive to not use ugly
error message parsing using regex. Now, DeleteContainer
method will remove all resources allocated by us. This
fixed one of skipped controller client tests. Old function
is still used in some integration tests, so I moved it to
helpers.
* HNS endpoint repositories now find endpoints by names.
* facade.go and api.go files were moved to a different directory due to Windows case-insensitivity. Sorry.

Change-Id: I95c90a95190675d8d1fefa992998331606483418
Partial-Bug: #1780983

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Reviewed: https://review.opencontrail.org/44703
Committed: http://github.com/Juniper/contrail-windows-docker-driver/commit/a6e3a4c968e93a27c9f109eae8c86c93a0745a91
Submitter: Zuul v3 CI (<email address hidden>)
Branch: master

commit a6e3a4c968e93a27c9f109eae8c86c93a0745a91
Author: Michal Kostrzewa <email address hidden>
Date: Tue Jul 17 14:53:24 2018 +0200

Move Agent to adapters.

Change-Id: Ida8d6596c04af855180d5eac3a28bbfbc4030e68
Partial-Bug: #1780983

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] master

Review in progress for https://review.opencontrail.org/44707
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/44707
Committed: http://github.com/Juniper/contrail-windows-docker-driver/commit/f08d0636d5bec00361015aabde3633697e7a325a
Submitter: Zuul v3 CI (<email address hidden>)
Branch: master

commit f08d0636d5bec00361015aabde3633697e7a325a
Author: Michal Kostrzewa <email address hidden>
Date: Tue Jul 17 17:43:21 2018 +0200

Improve logging in driver_core.

It spams too much.

Change-Id: I58db22f35ffeddf80c1f7790ccb1a4c49cf8dd69
Partial-Bug: #1780983

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] master

Review in progress for https://review.opencontrail.org/44964
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/44964
Committed: http://github.com/Juniper/contrail-windows-docker-driver/commit/9d0cfc2e902e6b63e5fd16931d2e458790cbff01
Submitter: Zuul v3 CI (<email address hidden>)
Branch: master

commit 9d0cfc2e902e6b63e5fd16931d2e458790cbff01
Author: Michal Kostrzewa <email address hidden>
Date: Thu Jul 26 15:36:28 2018 +0200

Extract GetContainer method; cleanup core.

This cleans up core logic even further.

Change-Id: Id32a344261649c6a184ae00b3db58b5b93b840ac
Partial-Bug: #1780983

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] master

Review in progress for https://review.opencontrail.org/44968
Submitter: Michal Kostrzewa (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/44968
Committed: http://github.com/Juniper/contrail-windows-docker-driver/commit/669670e201147f761133d1b2f62dbf74d2a4d4a8
Submitter: Zuul v3 CI (<email address hidden>)
Branch: master

commit 669670e201147f761133d1b2f62dbf74d2a4d4a8
Author: Michal Kostrzewa <email address hidden>
Date: Thu Jul 26 17:03:54 2018 +0200

Make portAssociation private.

Change-Id: Id1671780614c0f00f6df9069fa17dc533fe7fe0f
Partial-Bug: #1780983

Changed in opencontrail:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.