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
30be4927
Commit
30be4927
authored
Oct 20, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/virtualbox: use proper SATA port arg [GH-547]
parent
273e161b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
8 deletions
+32
-8
CHANGELOG.md
CHANGELOG.md
+2
-0
builder/virtualbox/driver.go
builder/virtualbox/driver.go
+29
-1
builder/virtualbox/step_create_disk.go
builder/virtualbox/step_create_disk.go
+1
-7
No files found.
CHANGELOG.md
View file @
30be4927
...
@@ -19,8 +19,10 @@ BUG FIXES:
...
@@ -19,8 +19,10 @@ BUG FIXES:
*
builder/virtualbox: detect if vboxdrv isn't properly setup. [GH-488]
*
builder/virtualbox: detect if vboxdrv isn't properly setup. [GH-488]
*
builder/virtualbox: sleep a bit before export to ensure the sesssion
*
builder/virtualbox: sleep a bit before export to ensure the sesssion
is unlocked. [GH-512]
is unlocked. [GH-512]
*
builder/virtualbox: create SATA drives properly on VirtualBox 4.3 [GH-547]
*
communicator/ssh: Fix issue where a panic could arise from a nil
*
communicator/ssh: Fix issue where a panic could arise from a nil
dereference. [GH-525]
dereference. [GH-525]
*
post-processor/vagrant: Fix issue with VirtualBox OVA. [GH-548]
*
provisioner/shell: Won't block on certain scripts on Windows anymore.
*
provisioner/shell: Won't block on certain scripts on Windows anymore.
[GH-507]
[GH-507]
...
...
builder/virtualbox/driver.go
View file @
30be4927
...
@@ -11,8 +11,15 @@ import (
...
@@ -11,8 +11,15 @@ import (
)
)
// A driver is able to talk to VirtualBox and perform certain
// A driver is able to talk to VirtualBox and perform certain
// operations with it.
// operations with it. Some of the operations on here may seem overly
// specific, but they were built specifically in mind to handle features
// of the VirtualBox builder for Packer, and to abstract differences in
// versions out of the builder steps, so sometimes the methods are
// extremely specific.
type
Driver
interface
{
type
Driver
interface
{
// Create a SATA controller.
CreateSATAController
(
vm
string
,
controller
string
)
error
// Checks if the VM with the given name is running.
// Checks if the VM with the given name is running.
IsRunning
(
string
)
(
bool
,
error
)
IsRunning
(
string
)
(
bool
,
error
)
...
@@ -40,6 +47,27 @@ type VBox42Driver struct {
...
@@ -40,6 +47,27 @@ type VBox42Driver struct {
VBoxManagePath
string
VBoxManagePath
string
}
}
func
(
d
*
VBox42Driver
)
CreateSATAController
(
vmName
string
,
name
string
)
error
{
version
,
err
:=
d
.
Version
()
if
err
!=
nil
{
return
err
}
portCountArg
:=
"sataportcount"
if
strings
.
HasPrefix
(
version
,
"4.3"
)
{
portCountArg
=
"portcount"
}
command
:=
[]
string
{
"storagectl"
,
vmName
,
"--name"
,
name
,
"--add"
,
"sata"
,
portCountArg
,
"1"
,
}
return
d
.
VBoxManage
(
command
...
)
}
func
(
d
*
VBox42Driver
)
IsRunning
(
name
string
)
(
bool
,
error
)
{
func
(
d
*
VBox42Driver
)
IsRunning
(
name
string
)
(
bool
,
error
)
{
var
stdout
bytes
.
Buffer
var
stdout
bytes
.
Buffer
...
...
builder/virtualbox/step_create_disk.go
View file @
30be4927
...
@@ -56,13 +56,7 @@ func (s *stepCreateDisk) Run(state multistep.StateBag) multistep.StepAction {
...
@@ -56,13 +56,7 @@ func (s *stepCreateDisk) Run(state multistep.StateBag) multistep.StepAction {
// that.
// that.
if
config
.
HardDriveInterface
==
"sata"
{
if
config
.
HardDriveInterface
==
"sata"
{
controllerName
=
"SATA Controller"
controllerName
=
"SATA Controller"
command
=
[]
string
{
if
err
:=
driver
.
CreateSATAController
(
vmName
,
controllerName
);
err
!=
nil
{
"storagectl"
,
vmName
,
"--name"
,
controllerName
,
"--add"
,
"sata"
,
"--sataportcount"
,
"1"
,
}
if
err
:=
driver
.
VBoxManage
(
command
...
);
err
!=
nil
{
err
:=
fmt
.
Errorf
(
"Error creating disk controller: %s"
,
err
)
err
:=
fmt
.
Errorf
(
"Error creating disk controller: %s"
,
err
)
state
.
Put
(
"error"
,
err
)
state
.
Put
(
"error"
,
err
)
ui
.
Error
(
err
.
Error
())
ui
.
Error
(
err
.
Error
())
...
...
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