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
84d6d856
Commit
84d6d856
authored
Jan 15, 2015
by
Danny Lockard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the ability to create a SCSI Device as the main HD controller for
virtualbox.
parent
8f5664d2
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
2 deletions
+40
-2
builder/virtualbox/common/driver.go
builder/virtualbox/common/driver.go
+3
-0
builder/virtualbox/common/driver_4_2.go
builder/virtualbox/common/driver_4_2.go
+12
-0
builder/virtualbox/common/driver_mock.go
builder/virtualbox/common/driver_mock.go
+10
-0
builder/virtualbox/iso/builder.go
builder/virtualbox/iso/builder.go
+2
-2
builder/virtualbox/iso/step_create_disk.go
builder/virtualbox/iso/step_create_disk.go
+13
-0
No files found.
builder/virtualbox/common/driver.go
View file @
84d6d856
...
...
@@ -19,6 +19,9 @@ type Driver interface {
// Create a SATA controller.
CreateSATAController
(
vm
string
,
controller
string
)
error
// Create a SCSI controller.
CreateSCSIController
(
vm
string
,
controller
string
)
error
// Delete a VM by name
Delete
(
string
)
error
...
...
builder/virtualbox/common/driver_4_2.go
View file @
84d6d856
...
...
@@ -36,6 +36,18 @@ func (d *VBox42Driver) CreateSATAController(vmName string, name string) error {
return
d
.
VBoxManage
(
command
...
)
}
func
(
d
*
VBox42Driver
)
CreateSCSIController
(
vmName
string
,
name
string
)
error
{
command
:=
[]
string
{
"storagectl"
,
vmName
,
"--name"
,
name
,
"--add"
,
"scsi"
,
"--controller"
,
"LSILogic"
,
}
return
d
.
VBoxManage
(
command
...
)
}
func
(
d
*
VBox42Driver
)
Delete
(
name
string
)
error
{
return
d
.
VBoxManage
(
"unregistervm"
,
name
,
"--delete"
)
}
...
...
builder/virtualbox/common/driver_mock.go
View file @
84d6d856
...
...
@@ -9,6 +9,10 @@ type DriverMock struct {
CreateSATAControllerController
string
CreateSATAControllerErr
error
CreateSCSIControllerVM
string
CreateSCSIControllerController
string
CreateSCSIControllerErr
error
DeleteCalled
bool
DeleteName
string
DeleteErr
error
...
...
@@ -49,6 +53,12 @@ func (d *DriverMock) CreateSATAController(vm string, controller string) error {
return
d
.
CreateSATAControllerErr
}
func
(
d
*
DriverMock
)
CreateSCSIController
(
vm
string
,
controller
string
)
error
{
d
.
CreateSCSIControllerVM
=
vm
d
.
CreateSCSIControllerController
=
vm
return
d
.
CreateSCSIControllerErr
}
func
(
d
*
DriverMock
)
Delete
(
name
string
)
error
{
d
.
DeleteCalled
=
true
d
.
DeleteName
=
name
...
...
builder/virtualbox/iso/builder.go
View file @
84d6d856
...
...
@@ -158,9 +158,9 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
}
}
if
b
.
config
.
HardDriveInterface
!=
"ide"
&&
b
.
config
.
HardDriveInterface
!=
"sata"
{
if
b
.
config
.
HardDriveInterface
!=
"ide"
&&
b
.
config
.
HardDriveInterface
!=
"sata"
&&
b
.
config
.
HardDriveInterface
!=
"scsi"
{
errs
=
packer
.
MultiErrorAppend
(
errs
,
errors
.
New
(
"hard_drive_interface can only be ide
or sata
"
))
errs
,
errors
.
New
(
"hard_drive_interface can only be ide
, sata, or scsi
"
))
}
if
b
.
config
.
ISOChecksumType
==
""
{
...
...
builder/virtualbox/iso/step_create_disk.go
View file @
84d6d856
...
...
@@ -63,12 +63,25 @@ func (s *stepCreateDisk) Run(state multistep.StateBag) multistep.StepAction {
}
}
if
config
.
HardDriveInterface
==
"scsi"
{
if
err
:=
driver
.
CreateSCSIController
(
vmName
,
"SCSI Controller"
);
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
controllerName
:=
"IDE Controller"
if
config
.
HardDriveInterface
==
"sata"
{
controllerName
=
"SATA Controller"
}
if
config
.
HardDriveInterface
==
"scsi"
{
controllerName
=
"SCSI Controller"
}
command
=
[]
string
{
"storageattach"
,
vmName
,
"--storagectl"
,
controllerName
,
...
...
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