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
c6d1c8e9
Commit
c6d1c8e9
authored
Aug 22, 2013
by
Justin Bronn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make it possible to customize the VMware virtual disk type id.
parent
faf6eb1c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
14 additions
and
8 deletions
+14
-8
builder/vmware/builder.go
builder/vmware/builder.go
+6
-0
builder/vmware/driver.go
builder/vmware/driver.go
+1
-1
builder/vmware/driver_fusion5.go
builder/vmware/driver_fusion5.go
+2
-2
builder/vmware/driver_player5.go
builder/vmware/driver_player5.go
+2
-2
builder/vmware/driver_workstation9.go
builder/vmware/driver_workstation9.go
+2
-2
builder/vmware/step_create_disk.go
builder/vmware/step_create_disk.go
+1
-1
No files found.
builder/vmware/builder.go
View file @
c6d1c8e9
...
...
@@ -27,6 +27,7 @@ type config struct {
DiskName
string
`mapstructure:"vmdk_name"`
DiskSize
uint
`mapstructure:"disk_size"`
DiskTypeId
string
`mapstructure:"disk_type_id"`
FloppyFiles
[]
string
`mapstructure:"floppy_files"`
GuestOSType
string
`mapstructure:"guest_os_type"`
ISOChecksum
string
`mapstructure:"iso_checksum"`
...
...
@@ -84,6 +85,11 @@ func (b *Builder) Prepare(raws ...interface{}) error {
b
.
config
.
DiskSize
=
40000
}
if
b
.
config
.
DiskTypeId
==
""
{
// Default is growable virtual disk split in 2GB files.
b
.
config
.
DiskTypeId
=
"1"
}
if
b
.
config
.
FloppyFiles
==
nil
{
b
.
config
.
FloppyFiles
=
make
([]
string
,
0
)
}
...
...
builder/vmware/driver.go
View file @
c6d1c8e9
...
...
@@ -15,7 +15,7 @@ type Driver interface {
CompactDisk
(
string
)
error
// CreateDisk creates a virtual disk with the given size.
CreateDisk
(
string
,
string
)
error
CreateDisk
(
string
,
string
,
string
)
error
// Checks if the VMX file at the given path is running.
IsRunning
(
string
)
(
bool
,
error
)
...
...
builder/vmware/driver_fusion5.go
View file @
c6d1c8e9
...
...
@@ -28,8 +28,8 @@ func (d *Fusion5Driver) CompactDisk(diskPath string) error {
return
nil
}
func
(
d
*
Fusion5Driver
)
CreateDisk
(
output
string
,
size
string
)
error
{
cmd
:=
exec
.
Command
(
d
.
vdiskManagerPath
(),
"-c"
,
"-s"
,
size
,
"-a"
,
"lsilogic"
,
"-t"
,
"1"
,
output
)
func
(
d
*
Fusion5Driver
)
CreateDisk
(
output
string
,
size
string
,
type_id
string
)
error
{
cmd
:=
exec
.
Command
(
d
.
vdiskManagerPath
(),
"-c"
,
"-s"
,
size
,
"-a"
,
"lsilogic"
,
"-t"
,
type_id
,
output
)
if
_
,
_
,
err
:=
runAndLog
(
cmd
);
err
!=
nil
{
return
err
}
...
...
builder/vmware/driver_player5.go
View file @
c6d1c8e9
...
...
@@ -51,12 +51,12 @@ func (d *Player5LinuxDriver) qemuCompactDisk(diskPath string) error {
return
nil
}
func
(
d
*
Player5LinuxDriver
)
CreateDisk
(
output
string
,
size
string
)
error
{
func
(
d
*
Player5LinuxDriver
)
CreateDisk
(
output
string
,
size
string
,
type_id
string
)
error
{
var
cmd
*
exec
.
Cmd
if
d
.
QemuImgPath
!=
""
{
cmd
=
exec
.
Command
(
d
.
QemuImgPath
,
"create"
,
"-f"
,
"vmdk"
,
"-o"
,
"compat6"
,
output
,
size
)
}
else
{
cmd
=
exec
.
Command
(
d
.
VdiskManagerPath
,
"-c"
,
"-s"
,
size
,
"-a"
,
"lsilogic"
,
"-t"
,
"1"
,
output
)
cmd
=
exec
.
Command
(
d
.
VdiskManagerPath
,
"-c"
,
"-s"
,
size
,
"-a"
,
"lsilogic"
,
"-t"
,
type_id
,
output
)
}
if
_
,
_
,
err
:=
runAndLog
(
cmd
);
err
!=
nil
{
return
err
...
...
builder/vmware/driver_workstation9.go
View file @
c6d1c8e9
...
...
@@ -31,8 +31,8 @@ func (d *Workstation9Driver) CompactDisk(diskPath string) error {
return
nil
}
func
(
d
*
Workstation9Driver
)
CreateDisk
(
output
string
,
size
string
)
error
{
cmd
:=
exec
.
Command
(
d
.
VdiskManagerPath
,
"-c"
,
"-s"
,
size
,
"-a"
,
"lsilogic"
,
"-t"
,
"1"
,
output
)
func
(
d
*
Workstation9Driver
)
CreateDisk
(
output
string
,
size
string
,
type_id
string
)
error
{
cmd
:=
exec
.
Command
(
d
.
VdiskManagerPath
,
"-c"
,
"-s"
,
size
,
"-a"
,
"lsilogic"
,
"-t"
,
type_id
,
output
)
if
_
,
_
,
err
:=
runAndLog
(
cmd
);
err
!=
nil
{
return
err
}
...
...
builder/vmware/step_create_disk.go
View file @
c6d1c8e9
...
...
@@ -25,7 +25,7 @@ func (stepCreateDisk) Run(state map[string]interface{}) multistep.StepAction {
ui
.
Say
(
"Creating virtual machine disk"
)
full_disk_path
:=
filepath
.
Join
(
config
.
OutputDir
,
config
.
DiskName
+
".vmdk"
)
if
err
:=
driver
.
CreateDisk
(
full_disk_path
,
fmt
.
Sprintf
(
"%dM"
,
config
.
DiskSize
));
err
!=
nil
{
if
err
:=
driver
.
CreateDisk
(
full_disk_path
,
fmt
.
Sprintf
(
"%dM"
,
config
.
DiskSize
)
,
config
.
DiskTypeId
);
err
!=
nil
{
err
:=
fmt
.
Errorf
(
"Error creating disk: %s"
,
err
)
state
[
"error"
]
=
err
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