Commit 115b8f5f authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

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

virtualbox/common: remove devices should delete floppy controller
parents 7ee09cc1 35246ba9
......@@ -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 {
......
......@@ -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)
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment