Restore 27.x path for libnet's Bolt database#48793
Conversation
In 27.x and earlier releases libnetwork's database file was in a sub-directory "network/files" under the daemon's root data dir. That part of the path got lost in commit ed08486 So, libnet data ended up in the daemon's main Bolt db. Then, on upgrade, config in the original file was no longer accessible. libnet doesn't need access to any data outside its sub-dir, so change the meaning of its OptionDataDir - it now points at libnet's sub-dir, so the db will be created in the right place. Also, update other uses of that data dir to match. Signed-off-by: Rob Murray <[email protected]>
|
Should we update this one as well to use the new const? moby/libnetwork/libnetwork_linux_test.go Lines 46 to 47 in 53013c1 |
Before the refactoring, libnetwork had a But, removing the host's libnet db seems like quite a bad idea, particularly if these tests are run outside a dev container. Digging back to where it came from, I got to 71e14dd - but that's no help! Some tests use |
|
I'll go ahead and merge this one, we can follow up on that |
Yes, using |
- What I did
In 27.x and earlier releases, libnetwork's database file was in a sub-directory
network/filesunder the daemon's root data dir (/var/lib/docker/network/files/local-kv.db).That part of the path got lost during refactoring in #47992 (ed08486).
So, libnet data ended up in the daemon's main Bolt db (
/var/lib/docker/local-kv.db). Then, on upgrade from 27.x, config in the original file was no longer accessible.- How I did it
libnet doesn't need access to any data outside its sub-dir, so change the meaning of its OptionDataDir - it now points at libnet's sub-dir, so the db will be created in the right place. Also, update other uses of that data dir to match.
Note that:
- How to verify it
Create a network with a 27.x daemon, upgrade to master, check the network is still there.
Tested in a Linux dev container, and on Windows.
Start a Linux swarm service with a port mapping (
docker swarm init; docker service create -p 8080:80 nginx) and checked itshosts,resolv.confandresolv.conf.hashfiles were still created in/var/lib/docker/network/files.- Description for the changelog