Merge pull request #2188 from mitchellh/b-vbox-remove-floppy

virtualbox/common: remove devices should delete floppy controller
This commit is contained in:
Mitchell Hashimoto 2015-06-08 21:16:24 -07:00
commit 115b8f5f67
2 changed files with 17 additions and 1 deletions

View File

@ -38,6 +38,19 @@ func (s *StepRemoveDevices) Run(state multistep.StateBag) multistep.StepAction {
ui.Error(err.Error())
return multistep.ActionHalt
}
// Don't forget to remove the floppy controller as well
command = []string{
"storagectl", vmName,
"--name", "Floppy Controller",
"--remove",
}
if err := driver.VBoxManage(command...); err != nil {
err := fmt.Errorf("Error removing floppy controller: %s", err)
state.Put("error", err)
ui.Error(err.Error())
return multistep.ActionHalt
}
}
if _, ok := state.GetOk("attachedIso"); ok {

View File

@ -102,10 +102,13 @@ func TestStepRemoveDevices_floppyPath(t *testing.T) {
}
// Test that both were removed
if len(driver.VBoxManageCalls) != 1 {
if len(driver.VBoxManageCalls) != 2 {
t.Fatalf("bad: %#v", driver.VBoxManageCalls)
}
if driver.VBoxManageCalls[0][3] != "Floppy Controller" {
t.Fatalf("bad: %#v", driver.VBoxManageCalls)
}
if driver.VBoxManageCalls[1][3] != "Floppy Controller" {
t.Fatalf("bad: %#v", driver.VBoxManageCalls)
}
}