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
9a032c8e
Commit
9a032c8e
authored
Sep 02, 2014
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'matthbak-master'
parents
fbf67587
88c186df
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
8 deletions
+17
-8
builder/qemu/builder.go
builder/qemu/builder.go
+3
-2
builder/qemu/step_run.go
builder/qemu/step_run.go
+13
-5
website/source/docs/builders/qemu.html.markdown
website/source/docs/builders/qemu.html.markdown
+1
-1
No files found.
builder/qemu/builder.go
View file @
9a032c8e
...
...
@@ -26,6 +26,7 @@ var netDevice = map[string]bool{
"pcnet"
:
true
,
"virtio"
:
true
,
"virtio-net"
:
true
,
"virtio-net-pci"
:
true
,
"usb-net"
:
true
,
"i82559a"
:
true
,
"i82559b"
:
true
,
...
...
@@ -255,9 +256,9 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
errs
,
errors
.
New
(
"invalid format, only 'qcow2' or 'raw' are allowed"
))
}
if
!
(
b
.
config
.
Accelerator
==
"kvm"
||
b
.
config
.
Accelerator
==
"xen"
)
{
if
!
(
b
.
config
.
Accelerator
==
"kvm"
||
b
.
config
.
Accelerator
==
"xen"
||
b
.
config
.
Accelerator
==
"none"
)
{
errs
=
packer
.
MultiErrorAppend
(
errs
,
errors
.
New
(
"invalid format, only 'kvm' or 'xen' are allowed"
))
errs
,
errors
.
New
(
"invalid format, only 'kvm' or 'xen'
or 'none'
are allowed"
))
}
if
_
,
ok
:=
netDevice
[
b
.
config
.
NetDevice
];
!
ok
{
...
...
builder/qemu/step_run.go
View file @
9a032c8e
...
...
@@ -61,23 +61,23 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error
sshHostPort
:=
state
.
Get
(
"sshHostPort"
)
.
(
uint
)
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
guiArgument
:=
"sdl"
vnc
:=
fmt
.
Sprintf
(
"0.0.0.0:%d"
,
vncPort
-
5900
)
vmName
:=
config
.
VMName
imgPath
:=
filepath
.
Join
(
config
.
OutputDir
,
fmt
.
Sprintf
(
"%s.%s"
,
vmName
,
strings
.
ToLower
(
config
.
Format
)))
defaultArgs
:=
make
(
map
[
string
]
string
)
if
config
.
Headless
==
true
{
ui
.
Message
(
"WARNING: The VM will be started in headless mode, as configured.
\n
"
+
"In headless mode, errors during the boot sequence or OS setup
\n
"
+
"won't be easily visible. Use at your own discretion."
)
guiArgument
=
"none"
}
else
{
defaultArgs
[
"-display"
]
=
"sdl"
}
defaultArgs
:=
make
(
map
[
string
]
string
)
defaultArgs
[
"-name"
]
=
vmName
defaultArgs
[
"-machine"
]
=
fmt
.
Sprintf
(
"type=%s,accel=%s"
,
config
.
MachineType
,
config
.
Accelerator
)
defaultArgs
[
"-display"
]
=
guiArgument
defaultArgs
[
"-machine"
]
=
fmt
.
Sprintf
(
"type=%s"
,
config
.
MachineType
)
defaultArgs
[
"-netdev"
]
=
"user,id=user.0"
defaultArgs
[
"-device"
]
=
fmt
.
Sprintf
(
"%s,netdev=user.0"
,
config
.
NetDevice
)
defaultArgs
[
"-drive"
]
=
fmt
.
Sprintf
(
"file=%s,if=%s"
,
imgPath
,
config
.
DiskInterface
)
...
...
@@ -87,6 +87,14 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error
defaultArgs
[
"-redir"
]
=
fmt
.
Sprintf
(
"tcp:%v::22"
,
sshHostPort
)
defaultArgs
[
"-vnc"
]
=
vnc
// Append the accelerator to the machine type if it is specified
if
config
.
Accelerator
!=
"none"
{
defaultArgs
[
"-machine"
]
+=
fmt
.
Sprintf
(
",accel=%s"
,
config
.
Accelerator
)
}
else
{
ui
.
Message
(
"WARNING: The VM will be started with no hardware acceleration.
\n
"
+
"The installation may take considerably longer to finish.
\n
"
)
}
// Determine if we have a floppy disk to attach
if
floppyPathRaw
,
ok
:=
state
.
GetOk
(
"floppy_path"
);
ok
{
defaultArgs
[
"-fda"
]
=
floppyPathRaw
.
(
string
)
...
...
website/source/docs/builders/qemu.html.markdown
View file @
9a032c8e
...
...
@@ -92,7 +92,7 @@ each category, the available options are alphabetized and described.
### Optional:
*
`accelerator`
(string) - The accelerator type to use when running the VM.
This may have a value of either "
kvm"
or "xen" and you must have that
This may have a value of either "
none", "kvm",
or "xen" and you must have that
support in on the machine on which you run the builder.
*
`boot_command`
(array of strings) - This is an array of commands to type
...
...
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