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
24f852f6
Commit
24f852f6
authored
Jun 23, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/vmware: configurable disk size (default 40 GB)
parent
adf15024
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
4 deletions
+32
-4
builder/vmware/builder.go
builder/vmware/builder.go
+5
-0
builder/vmware/builder_test.go
builder/vmware/builder_test.go
+26
-0
builder/vmware/step_create_disk.go
builder/vmware/step_create_disk.go
+1
-4
No files found.
builder/vmware/builder.go
View file @
24f852f6
...
...
@@ -26,6 +26,7 @@ type Builder struct {
type
config
struct
{
DiskName
string
`mapstructure:"vmdk_name"`
DiskSize
uint
`mapstructure:"disk_size"`
GuestOSType
string
`mapstructure:"guest_os_type"`
ISOMD5
string
`mapstructure:"iso_md5"`
ISOUrl
string
`mapstructure:"iso_url"`
...
...
@@ -65,6 +66,10 @@ func (b *Builder) Prepare(raws ...interface{}) error {
b
.
config
.
DiskName
=
"disk"
}
if
b
.
config
.
DiskSize
==
0
{
b
.
config
.
DiskSize
=
40000
}
if
b
.
config
.
GuestOSType
==
""
{
b
.
config
.
GuestOSType
=
"other"
}
...
...
builder/vmware/builder_test.go
View file @
24f852f6
...
...
@@ -68,6 +68,32 @@ func TestBuilderPrepare_Defaults(t *testing.T) {
}
}
func
TestBuilderPrepare_DiskSize
(
t
*
testing
.
T
)
{
var
b
Builder
config
:=
testConfig
()
delete
(
config
,
"disk_size"
)
err
:=
b
.
Prepare
(
config
)
if
err
!=
nil
{
t
.
Fatalf
(
"bad err: %s"
,
err
)
}
if
b
.
config
.
DiskSize
!=
40000
{
t
.
Fatalf
(
"bad size: %d"
,
b
.
config
.
DiskSize
)
}
config
[
"disk_size"
]
=
60000
b
=
Builder
{}
err
=
b
.
Prepare
(
config
)
if
err
!=
nil
{
t
.
Fatalf
(
"should not have error: %s"
,
err
)
}
if
b
.
config
.
DiskSize
!=
60000
{
t
.
Fatalf
(
"bad size: %s"
,
b
.
config
.
DiskSize
)
}
}
func
TestBuilderPrepare_HTTPPort
(
t
*
testing
.
T
)
{
var
b
Builder
config
:=
testConfig
()
...
...
builder/vmware/step_create_disk.go
View file @
24f852f6
...
...
@@ -19,16 +19,13 @@ import (
type
stepCreateDisk
struct
{}
func
(
stepCreateDisk
)
Run
(
state
map
[
string
]
interface
{})
multistep
.
StepAction
{
// TODO(mitchellh): Configurable disk size
// TODO(mitchellh): Capture error output in case things go wrong to report it
config
:=
state
[
"config"
]
.
(
*
config
)
driver
:=
state
[
"driver"
]
.
(
Driver
)
ui
:=
state
[
"ui"
]
.
(
packer
.
Ui
)
ui
.
Say
(
"Creating virtual machine disk"
)
output
:=
filepath
.
Join
(
config
.
OutputDir
,
config
.
DiskName
+
".vmdk"
)
if
err
:=
driver
.
CreateDisk
(
output
,
"40000M"
);
err
!=
nil
{
if
err
:=
driver
.
CreateDisk
(
output
,
fmt
.
Sprintf
(
"%dM"
,
config
.
DiskSize
)
);
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