In some circumstances we were not properly releasing plugin references, leading to failures in removing a plugin with no way to recover other than restarting the daemon. 1. If volume create fails (in the driver) 2. If a driver validation fails (should be rare) 3. If trying to get a plugin that does not match the passed in capability Ideally the test for 1 and 2 would just be a unit test, however the plugin interfaces are too complicated as `plugingetter` relies on github.com/pkg/plugin/Client (a concrete type), which will require spinning up services from within the unit test... it just wouldn't be a unit test at this point. I attempted to refactor this a bit, but since both libnetwork and swarmkit are reliant on `plugingetter` as well, this would not work. This really requires a re-write of the lower-level plugin management to decouple these pieces. Signed-off-by: Brian Goff <cpuguy83@gmail.com> Upstream-commit: 3816b514387efd24394f0b8e61d55502aa6ac9ac Component: engine
24 lines
454 B
Go
24 lines
454 B
Go
package main
|
|
|
|
import (
|
|
"net"
|
|
"net/http"
|
|
)
|
|
|
|
func main() {
|
|
l, err := net.Listen("unix", "/run/docker/plugins/plugin.sock")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
mux := http.NewServeMux()
|
|
server := http.Server{
|
|
Addr: l.Addr().String(),
|
|
Handler: http.NewServeMux(),
|
|
}
|
|
mux.HandleFunc("/VolumeDriver.Create", func(w http.ResponseWriter, r *http.Request) {
|
|
http.Error(w, "error during create", http.StatusInternalServerError)
|
|
})
|
|
server.Serve(l)
|
|
}
|