From dbe40b9f558a2095088988eb082af9281e3bd4cf Mon Sep 17 00:00:00 2001 From: Mikhail Zholobov Date: Sat, 3 May 2014 11:11:10 +0400 Subject: [PATCH 1/2] builder/parallels: Do not delete the first cdrom device Just detach the iso from 'cdrom0', but do not delete this device from VM confguration. --- builder/parallels/common/step_remove_devices.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/builder/parallels/common/step_remove_devices.go b/builder/parallels/common/step_remove_devices.go index 4d1b29611..0bcbc6eb3 100644 --- a/builder/parallels/common/step_remove_devices.go +++ b/builder/parallels/common/step_remove_devices.go @@ -35,7 +35,11 @@ func (s *StepRemoveDevices) Run(state multistep.StateBag) multistep.StepAction { } if _, ok := state.GetOk("attachedIso"); ok { - command := []string{"set", vmName, "--device-del", "cdrom0"} + command := []string{ + "set", vmName, + "--device-set", "cdrom0", + "--device", "Default CD/DVD-ROM", + } if err := driver.Prlctl(command...); err != nil { err := fmt.Errorf("Error detaching ISO: %s", err) From 57e8f8e15b7559a3bacd6f5f03302be46178cb9c Mon Sep 17 00:00:00 2001 From: Mikhail Zholobov Date: Sat, 3 May 2014 14:49:07 +0400 Subject: [PATCH 2/2] builder/parallels: Fixed unit test [GH-1115] --- builder/parallels/common/step_remove_devices_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/builder/parallels/common/step_remove_devices_test.go b/builder/parallels/common/step_remove_devices_test.go index eb8638097..983b6faad 100644 --- a/builder/parallels/common/step_remove_devices_test.go +++ b/builder/parallels/common/step_remove_devices_test.go @@ -48,16 +48,19 @@ func TestStepRemoveDevices_attachedIso(t *testing.T) { t.Fatal("should NOT have error") } - // Test that ISO was removed + // Test that ISO was detached if len(driver.PrlctlCalls) != 1 { t.Fatalf("bad: %#v", driver.PrlctlCalls) } - if driver.PrlctlCalls[0][2] != "--device-del" { + if driver.PrlctlCalls[0][2] != "--device-set" { t.Fatalf("bad: %#v", driver.PrlctlCalls) } if driver.PrlctlCalls[0][3] != "cdrom0" { t.Fatalf("bad: %#v", driver.PrlctlCalls) } + if driver.PrlctlCalls[0][5] != "Default CD/DVD-ROM" { + t.Fatalf("bad: %#v", driver.PrlctlCalls) + } } func TestStepRemoveDevices_floppyPath(t *testing.T) {