Enforce zero plugin refcount during disable.

When plugins have a positive refcount, they were not allowed to be
removed. However, plugins could still be disabled when volumes
referenced it and containers using them were running.

This change fixes that by enforcing plugin refcount during disable.
A "force" disable option is also added to ignore reference refcounting.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
This commit is contained in:
Anusha Ragunathan
2016-12-22 13:26:53 -08:00
parent 368e309073
commit fa7cceeb4a
3 changed files with 13 additions and 5 deletions
+3 -2
View File
@@ -8,6 +8,7 @@ import (
"strings"
"testing"
"github.com/docker/docker/api/types"
"golang.org/x/net/context"
)
@@ -16,7 +17,7 @@ func TestPluginDisableError(t *testing.T) {
client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
}
err := client.PluginDisable(context.Background(), "plugin_name")
err := client.PluginDisable(context.Background(), "plugin_name", types.PluginDisableOptions{})
if err == nil || err.Error() != "Error response from daemon: Server error" {
t.Fatalf("expected a Server Error, got %v", err)
}
@@ -40,7 +41,7 @@ func TestPluginDisable(t *testing.T) {
}),
}
err := client.PluginDisable(context.Background(), "plugin_name")
err := client.PluginDisable(context.Background(), "plugin_name", types.PluginDisableOptions{})
if err != nil {
t.Fatal(err)
}