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
7dfb837d
Commit
7dfb837d
authored
Mar 04, 2014
by
Eric Richardson
Committed by
Shawn Neal
Jun 04, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Formatting cleanups from `go fmt`
parent
fab9ca9c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
16 deletions
+16
-16
builder/vmware/iso/step_create_disk.go
builder/vmware/iso/step_create_disk.go
+8
-8
builder/vmware/iso/step_create_vmx.go
builder/vmware/iso/step_create_vmx.go
+8
-8
No files found.
builder/vmware/iso/step_create_disk.go
View file @
7dfb837d
...
@@ -34,26 +34,26 @@ func (stepCreateDisk) Run(state multistep.StateBag) multistep.StepAction {
...
@@ -34,26 +34,26 @@ func (stepCreateDisk) Run(state multistep.StateBag) multistep.StepAction {
}
}
state
.
Put
(
"full_disk_path"
,
full_disk_path
)
state
.
Put
(
"full_disk_path"
,
full_disk_path
)
if
len
(
config
.
AdditionalDiskSize
)
>
0
{
if
len
(
config
.
AdditionalDiskSize
)
>
0
{
// stash the disk paths we create
// stash the disk paths we create
additional_paths
:=
make
([]
string
,
len
(
config
.
AdditionalDiskSize
))
additional_paths
:=
make
([]
string
,
len
(
config
.
AdditionalDiskSize
))
ui
.
Say
(
"Creating additional hard drives..."
)
ui
.
Say
(
"Creating additional hard drives..."
)
for
i
,
additionalsize
:=
range
config
.
AdditionalDiskSize
{
for
i
,
additionalsize
:=
range
config
.
AdditionalDiskSize
{
additionalpath
:=
filepath
.
Join
(
config
.
OutputDir
,
fmt
.
Sprintf
(
"%s-%d.vmdk"
,
config
.
DiskName
,
i
+
1
))
additionalpath
:=
filepath
.
Join
(
config
.
OutputDir
,
fmt
.
Sprintf
(
"%s-%d.vmdk"
,
config
.
DiskName
,
i
+
1
))
size
:=
fmt
.
Sprintf
(
"%dM"
,
uint64
(
additionalsize
))
size
:=
fmt
.
Sprintf
(
"%dM"
,
uint64
(
additionalsize
))
if
err
:=
driver
.
CreateDisk
(
additionalpath
,
size
,
config
.
DiskTypeId
);
err
!=
nil
{
if
err
:=
driver
.
CreateDisk
(
additionalpath
,
size
,
config
.
DiskTypeId
);
err
!=
nil
{
err
:=
fmt
.
Errorf
(
"Error creating additional disk: %s"
,
err
)
err
:=
fmt
.
Errorf
(
"Error creating additional disk: %s"
,
err
)
state
.
Put
(
"error"
,
err
)
state
.
Put
(
"error"
,
err
)
ui
.
Error
(
err
.
Error
())
ui
.
Error
(
err
.
Error
())
return
multistep
.
ActionHalt
return
multistep
.
ActionHalt
}
}
additional_paths
[
i
]
=
additionalpath
additional_paths
[
i
]
=
additionalpath
}
}
state
.
Put
(
"additional_disk_paths"
,
additional_paths
)
state
.
Put
(
"additional_disk_paths"
,
additional_paths
)
}
}
...
...
builder/vmware/iso/step_create_vmx.go
View file @
7dfb837d
...
@@ -21,8 +21,8 @@ type vmxTemplateData struct {
...
@@ -21,8 +21,8 @@ type vmxTemplateData struct {
}
}
type
additionalDiskTemplateData
struct
{
type
additionalDiskTemplateData
struct
{
DiskNumber
int
DiskNumber
int
DiskName
string
DiskName
string
}
}
// This step creates the VMX file for the VM.
// This step creates the VMX file for the VM.
...
@@ -75,22 +75,22 @@ func (s *stepCreateVMX) Run(state multistep.StateBag) multistep.StepAction {
...
@@ -75,22 +75,22 @@ func (s *stepCreateVMX) Run(state multistep.StateBag) multistep.StepAction {
vmxTemplate
=
string
(
rawBytes
)
vmxTemplate
=
string
(
rawBytes
)
}
}
if
len
(
config
.
AdditionalDiskSize
)
>
0
{
if
len
(
config
.
AdditionalDiskSize
)
>
0
{
for
i
,
_
:=
range
config
.
AdditionalDiskSize
{
for
i
,
_
:=
range
config
.
AdditionalDiskSize
{
data
:=
&
additionalDiskTemplateData
{
data
:=
&
additionalDiskTemplateData
{
DiskNumber
:
i
+
1
,
DiskNumber
:
i
+
1
,
DiskName
:
config
.
DiskName
,
DiskName
:
config
.
DiskName
,
}
}
diskTemplate
,
err
:=
config
.
tpl
.
Process
(
DefaultAdditionalDiskTemplate
,
data
)
diskTemplate
,
err
:=
config
.
tpl
.
Process
(
DefaultAdditionalDiskTemplate
,
data
)
if
err
!=
nil
{
if
err
!=
nil
{
err
:=
fmt
.
Errorf
(
"Error preparing VMX template for additional disk: %s"
,
err
)
err
:=
fmt
.
Errorf
(
"Error preparing VMX template for additional disk: %s"
,
err
)
state
.
Put
(
"error"
,
err
)
state
.
Put
(
"error"
,
err
)
ui
.
Error
(
err
.
Error
())
ui
.
Error
(
err
.
Error
())
return
multistep
.
ActionHalt
return
multistep
.
ActionHalt
}
}
vmxTemplate
+=
diskTemplate
vmxTemplate
+=
diskTemplate
}
}
}
}
...
...
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