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
31a1aa48
Commit
31a1aa48
authored
Nov 26, 2014
by
Seth Vargo
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1662 from vtolstov/disk_image
When using disk_image CD-ROM not needed
parents
1906c71f
2126615b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
7 deletions
+19
-7
builder/qemu/builder.go
builder/qemu/builder.go
+10
-4
builder/qemu/step_copy_disk.go
builder/qemu/step_copy_disk.go
+6
-2
builder/qemu/step_run.go
builder/qemu/step_run.go
+3
-1
No files found.
builder/qemu/builder.go
View file @
31a1aa48
...
@@ -418,6 +418,15 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
...
@@ -418,6 +418,15 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
return
nil
,
fmt
.
Errorf
(
"Failed creating Qemu driver: %s"
,
err
)
return
nil
,
fmt
.
Errorf
(
"Failed creating Qemu driver: %s"
,
err
)
}
}
steprun
:=
&
stepRun
{}
if
!
b
.
config
.
DiskImage
{
steprun
.
BootDrive
=
"once=d"
steprun
.
Message
=
"Starting VM, booting from CD-ROM"
}
else
{
steprun
.
BootDrive
=
"c"
steprun
.
Message
=
"Starting VM, booting disk image"
}
steps
:=
[]
multistep
.
Step
{
steps
:=
[]
multistep
.
Step
{
&
common
.
StepDownload
{
&
common
.
StepDownload
{
Checksum
:
b
.
config
.
ISOChecksum
,
Checksum
:
b
.
config
.
ISOChecksum
,
...
@@ -436,10 +445,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
...
@@ -436,10 +445,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
new
(
stepHTTPServer
),
new
(
stepHTTPServer
),
new
(
stepForwardSSH
),
new
(
stepForwardSSH
),
new
(
stepConfigureVNC
),
new
(
stepConfigureVNC
),
&
stepRun
{
steprun
,
BootDrive
:
"once=d"
,
Message
:
"Starting VM, booting from CD-ROM"
,
},
&
stepBootWait
{},
&
stepBootWait
{},
&
stepTypeBootCommand
{},
&
stepTypeBootCommand
{},
&
common
.
StepConnectSSH
{
&
common
.
StepConnectSSH
{
...
...
builder/qemu/step_copy_disk.go
View file @
31a1aa48
...
@@ -2,10 +2,11 @@ package qemu
...
@@ -2,10 +2,11 @@ package qemu
import
(
import
(
"fmt"
"fmt"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
"path/filepath"
"path/filepath"
"strings"
"strings"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
)
)
// This step copies the virtual disk that will be used as the
// This step copies the virtual disk that will be used as the
...
@@ -19,6 +20,7 @@ func (s *stepCopyDisk) Run(state multistep.StateBag) multistep.StepAction {
...
@@ -19,6 +20,7 @@ func (s *stepCopyDisk) Run(state multistep.StateBag) multistep.StepAction {
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
path
:=
filepath
.
Join
(
config
.
OutputDir
,
fmt
.
Sprintf
(
"%s.%s"
,
config
.
VMName
,
path
:=
filepath
.
Join
(
config
.
OutputDir
,
fmt
.
Sprintf
(
"%s.%s"
,
config
.
VMName
,
strings
.
ToLower
(
config
.
Format
)))
strings
.
ToLower
(
config
.
Format
)))
name
:=
config
.
VMName
+
"."
+
strings
.
ToLower
(
config
.
Format
)
command
:=
[]
string
{
command
:=
[]
string
{
"convert"
,
"convert"
,
...
@@ -39,6 +41,8 @@ func (s *stepCopyDisk) Run(state multistep.StateBag) multistep.StepAction {
...
@@ -39,6 +41,8 @@ func (s *stepCopyDisk) Run(state multistep.StateBag) multistep.StepAction {
return
multistep
.
ActionHalt
return
multistep
.
ActionHalt
}
}
state
.
Put
(
"disk_filename"
,
name
)
return
multistep
.
ActionContinue
return
multistep
.
ActionContinue
}
}
...
...
builder/qemu/step_run.go
View file @
31a1aa48
...
@@ -82,7 +82,9 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error
...
@@ -82,7 +82,9 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error
defaultArgs
[
"-netdev"
]
=
fmt
.
Sprintf
(
"user,id=user.0,hostfwd=tcp::%v-:22"
,
sshHostPort
)
defaultArgs
[
"-netdev"
]
=
fmt
.
Sprintf
(
"user,id=user.0,hostfwd=tcp::%v-:22"
,
sshHostPort
)
defaultArgs
[
"-device"
]
=
fmt
.
Sprintf
(
"%s,netdev=user.0"
,
config
.
NetDevice
)
defaultArgs
[
"-device"
]
=
fmt
.
Sprintf
(
"%s,netdev=user.0"
,
config
.
NetDevice
)
defaultArgs
[
"-drive"
]
=
fmt
.
Sprintf
(
"file=%s,if=%s,cache=%s"
,
imgPath
,
config
.
DiskInterface
,
config
.
DiskCache
)
defaultArgs
[
"-drive"
]
=
fmt
.
Sprintf
(
"file=%s,if=%s,cache=%s"
,
imgPath
,
config
.
DiskInterface
,
config
.
DiskCache
)
if
!
config
.
DiskImage
{
defaultArgs
[
"-cdrom"
]
=
isoPath
defaultArgs
[
"-cdrom"
]
=
isoPath
}
defaultArgs
[
"-boot"
]
=
bootDrive
defaultArgs
[
"-boot"
]
=
bootDrive
defaultArgs
[
"-m"
]
=
"512M"
defaultArgs
[
"-m"
]
=
"512M"
defaultArgs
[
"-vnc"
]
=
vnc
defaultArgs
[
"-vnc"
]
=
vnc
...
...
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