Add BeginDetaching call for Cinder v2 (#90)
Per Cinder API, os-begin_detaching action needs to
be called prior to os-terminate_connection.
diff --git a/openstack/blockstorage/extensions/volumeactions/testing/fixtures.go b/openstack/blockstorage/extensions/volumeactions/testing/fixtures.go
index 34df070..4c3c0dd 100644
--- a/openstack/blockstorage/extensions/volumeactions/testing/fixtures.go
+++ b/openstack/blockstorage/extensions/volumeactions/testing/fixtures.go
@@ -34,6 +34,26 @@
})
}
+func MockBeginDetachingResponse(t *testing.T) {
+ th.Mux.HandleFunc("/volumes/cd281d77-8217-4830-be95-9528227c105c/action",
+ func(w http.ResponseWriter, r *http.Request) {
+ th.TestMethod(t, r, "POST")
+ th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
+ th.TestHeader(t, r, "Content-Type", "application/json")
+ th.TestHeader(t, r, "Accept", "application/json")
+ th.TestJSONRequest(t, r, `
+{
+ "os-begin_detaching": {}
+}
+ `)
+
+ w.Header().Add("Content-Type", "application/json")
+ w.WriteHeader(http.StatusAccepted)
+
+ fmt.Fprintf(w, `{}`)
+ })
+}
+
func MockDetachResponse(t *testing.T) {
th.Mux.HandleFunc("/volumes/cd281d77-8217-4830-be95-9528227c105c/action",
func(w http.ResponseWriter, r *http.Request) {