Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
dbc24d93
Commit
dbc24d93
authored
Sep 05, 2013
by
Justin Bronn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable customization of VirtualBox disk controller with `hard_drive_interface` option (SATA only).
parent
1df07357
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
1 deletion
+24
-1
builder/virtualbox/builder.go
builder/virtualbox/builder.go
+5
-0
builder/virtualbox/step_create_disk.go
builder/virtualbox/step_create_disk.go
+19
-1
No files found.
builder/virtualbox/builder.go
View file @
dbc24d93
...
...
@@ -33,6 +33,7 @@ type config struct {
GuestAdditionsSHA256
string
`mapstructure:"guest_additions_sha256"`
GuestOSType
string
`mapstructure:"guest_os_type"`
Headless
bool
`mapstructure:"headless"`
HardDriveInterface
string
`mapstructure:"hard_drive_interface"`
HTTPDir
string
`mapstructure:"http_directory"`
HTTPPortMin
uint
`mapstructure:"http_port_min"`
HTTPPortMax
uint
`mapstructure:"http_port_max"`
...
...
@@ -89,6 +90,10 @@ func (b *Builder) Prepare(raws ...interface{}) error {
b
.
config
.
GuestAdditionsPath
=
"VBoxGuestAdditions.iso"
}
if
b
.
config
.
HardDriveInterface
==
""
{
b
.
config
.
HardDriveInterface
=
"ide"
}
if
b
.
config
.
GuestOSType
==
""
{
b
.
config
.
GuestOSType
=
"Other"
}
...
...
builder/virtualbox/step_create_disk.go
View file @
dbc24d93
...
...
@@ -39,7 +39,9 @@ func (s *stepCreateDisk) Run(state multistep.StateBag) multistep.StepAction {
return
multistep
.
ActionHalt
}
// Add the IDE controller so we can later attach the disk
// Add the IDE controller so we can later attach the disk.
// When the hard disk controller is not IDE, this device is still used
// by VirtualBox to deliver the guest extensions.
controllerName
:=
"IDE Controller"
err
=
driver
.
VBoxManage
(
"storagectl"
,
vmName
,
"--name"
,
controllerName
,
"--add"
,
"ide"
)
if
err
!=
nil
{
...
...
@@ -49,6 +51,22 @@ func (s *stepCreateDisk) Run(state multistep.StateBag) multistep.StepAction {
return
multistep
.
ActionHalt
}
if
config
.
HardDriveInterface
==
"sata"
{
controllerName
=
"SATA Controller"
command
=
[]
string
{
"storagectl"
,
vmName
,
"--name"
,
controllerName
,
"--add"
,
"sata"
,
"--sataportcount"
,
"1"
,
}
if
err
:=
driver
.
VBoxManage
(
command
...
);
err
!=
nil
{
err
:=
fmt
.
Errorf
(
"Error creating disk controller: %s"
,
err
)
state
.
Put
(
"error"
,
err
)
ui
.
Error
(
err
.
Error
())
return
multistep
.
ActionHalt
}
}
// Attach the disk to the controller
command
=
[]
string
{
"storageattach"
,
vmName
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment