Skip to content

Commit d666956

Browse files
authored
Merge pull request kubernetes#95003 from jsafrane/cinder-delete-preprovisioned
Fail a test on pre-provisioned Cinder volume deletion error
2 parents ccfdc09 + 76254d8 commit d666956

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

test/e2e/storage/drivers/in_tree.go

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,6 +1184,7 @@ func (c *cinderDriver) CreateVolume(config *testsuites.PerTestConfig, volType te
11841184
}
11851185

11861186
func (v *cinderVolume) DeleteVolume() {
1187+
id := v.volumeID
11871188
name := v.volumeName
11881189

11891190
// Try to delete the volume for several seconds - it takes
@@ -1192,16 +1193,23 @@ func (v *cinderVolume) DeleteVolume() {
11921193
var err error
11931194
timeout := time.Second * 120
11941195

1195-
framework.Logf("Waiting up to %v for removal of cinder volume %s", timeout, name)
1196+
framework.Logf("Waiting up to %v for removal of cinder volume %s / %s", timeout, id, name)
11961197
for start := time.Now(); time.Since(start) < timeout; time.Sleep(5 * time.Second) {
1197-
output, err = exec.Command("cinder", "delete", name).CombinedOutput()
1198+
output, err = exec.Command("cinder", "delete", id).CombinedOutput()
11981199
if err == nil {
1199-
framework.Logf("Cinder volume %s deleted", name)
1200+
framework.Logf("Cinder volume %s deleted", id)
12001201
return
12011202
}
1202-
framework.Logf("Failed to delete volume %s: %v", name, err)
1203+
framework.Logf("Failed to delete volume %s / %s: %v\n%s", id, name, err, string(output))
12031204
}
1204-
framework.Logf("Giving up deleting volume %s: %v\n%s", name, err, string(output[:]))
1205+
// Timed out, try to get "cinder show <volume>" output for easier debugging
1206+
showOutput, showErr := exec.Command("cinder", "show", id).CombinedOutput()
1207+
if showErr != nil {
1208+
framework.Logf("Failed to show volume %s / %s: %v\n%s", id, name, showErr, string(showOutput))
1209+
} else {
1210+
framework.Logf("Volume %s / %s:\n%s", id, name, string(showOutput))
1211+
}
1212+
framework.Failf("Failed to delete pre-provisioned volume %s / %s: %v\n%s", id, name, err, string(output[:]))
12051213
}
12061214

12071215
// GCE

0 commit comments

Comments
 (0)