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
43771d91
Commit
43771d91
authored
Jun 18, 2015
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2271 from legal90/prl-default-settings
Parallels: Apply default settings on the VM creation step.
parents
d9fceaf3
2860bfdf
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
22 deletions
+64
-22
builder/parallels/common/driver.go
builder/parallels/common/driver.go
+3
-0
builder/parallels/common/driver_10.go
builder/parallels/common/driver_10.go
+24
-0
builder/parallels/common/driver_9.go
builder/parallels/common/driver_9.go
+19
-0
builder/parallels/iso/step_create_vm.go
builder/parallels/iso/step_create_vm.go
+18
-22
No files found.
builder/parallels/common/driver.go
View file @
43771d91
...
@@ -44,6 +44,9 @@ type Driver interface {
...
@@ -44,6 +44,9 @@ type Driver interface {
// Send scancodes to the vm using the prltype python script.
// Send scancodes to the vm using the prltype python script.
SendKeyScanCodes
(
string
,
...
string
)
error
SendKeyScanCodes
(
string
,
...
string
)
error
// Apply default сonfiguration settings to the virtual machine
SetDefaultConfiguration
(
string
)
error
// Finds the MAC address of the NIC nic0
// Finds the MAC address of the NIC nic0
Mac
(
string
)
(
string
,
error
)
Mac
(
string
)
(
string
,
error
)
...
...
builder/parallels/common/driver_10.go
View file @
43771d91
...
@@ -5,3 +5,27 @@ package common
...
@@ -5,3 +5,27 @@ package common
type
Parallels10Driver
struct
{
type
Parallels10Driver
struct
{
Parallels9Driver
Parallels9Driver
}
}
func
(
d
*
Parallels10Driver
)
SetDefaultConfiguration
(
vmName
string
)
error
{
commands
:=
make
([][]
string
,
12
)
commands
[
0
]
=
[]
string
{
"set"
,
vmName
,
"--cpus"
,
"1"
}
commands
[
1
]
=
[]
string
{
"set"
,
vmName
,
"--memsize"
,
"512"
}
commands
[
2
]
=
[]
string
{
"set"
,
vmName
,
"--startup-view"
,
"same"
}
commands
[
3
]
=
[]
string
{
"set"
,
vmName
,
"--on-shutdown"
,
"close"
}
commands
[
4
]
=
[]
string
{
"set"
,
vmName
,
"--on-window-close"
,
"keep-running"
}
commands
[
5
]
=
[]
string
{
"set"
,
vmName
,
"--auto-share-camera"
,
"off"
}
commands
[
6
]
=
[]
string
{
"set"
,
vmName
,
"--smart-guard"
,
"off"
}
commands
[
7
]
=
[]
string
{
"set"
,
vmName
,
"--shared-cloud"
,
"off"
}
commands
[
8
]
=
[]
string
{
"set"
,
vmName
,
"--shared-profile"
,
"off"
}
commands
[
9
]
=
[]
string
{
"set"
,
vmName
,
"--smart-mount"
,
"off"
}
commands
[
10
]
=
[]
string
{
"set"
,
vmName
,
"--sh-app-guest-to-host"
,
"off"
}
commands
[
11
]
=
[]
string
{
"set"
,
vmName
,
"--sh-app-host-to-guest"
,
"off"
}
for
_
,
command
:=
range
commands
{
err
:=
d
.
Prlctl
(
command
...
)
if
err
!=
nil
{
return
err
}
}
return
nil
}
builder/parallels/common/driver_9.go
View file @
43771d91
...
@@ -255,6 +255,25 @@ func prepend(head string, tail []string) []string {
...
@@ -255,6 +255,25 @@ func prepend(head string, tail []string) []string {
return
tmp
return
tmp
}
}
func
(
d
*
Parallels9Driver
)
SetDefaultConfiguration
(
vmName
string
)
error
{
commands
:=
make
([][]
string
,
7
)
commands
[
0
]
=
[]
string
{
"set"
,
vmName
,
"--cpus"
,
"1"
}
commands
[
1
]
=
[]
string
{
"set"
,
vmName
,
"--memsize"
,
"512"
}
commands
[
2
]
=
[]
string
{
"set"
,
vmName
,
"--startup-view"
,
"same"
}
commands
[
3
]
=
[]
string
{
"set"
,
vmName
,
"--on-shutdown"
,
"close"
}
commands
[
4
]
=
[]
string
{
"set"
,
vmName
,
"--on-window-close"
,
"keep-running"
}
commands
[
5
]
=
[]
string
{
"set"
,
vmName
,
"--auto-share-camera"
,
"off"
}
commands
[
6
]
=
[]
string
{
"set"
,
vmName
,
"--smart-guard"
,
"off"
}
for
_
,
command
:=
range
commands
{
err
:=
d
.
Prlctl
(
command
...
)
if
err
!=
nil
{
return
err
}
}
return
nil
}
func
(
d
*
Parallels9Driver
)
Mac
(
vmName
string
)
(
string
,
error
)
{
func
(
d
*
Parallels9Driver
)
Mac
(
vmName
string
)
(
string
,
error
)
{
var
stdout
bytes
.
Buffer
var
stdout
bytes
.
Buffer
...
...
builder/parallels/iso/step_create_vm.go
View file @
43771d91
...
@@ -23,37 +23,33 @@ func (s *stepCreateVM) Run(state multistep.StateBag) multistep.StepAction {
...
@@ -23,37 +23,33 @@ func (s *stepCreateVM) Run(state multistep.StateBag) multistep.StepAction {
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
ui
:=
state
.
Get
(
"ui"
)
.
(
packer
.
Ui
)
name
:=
config
.
VMName
name
:=
config
.
VMName
commands
:=
make
([][]
string
,
8
)
command
:=
[]
string
{
commands
[
0
]
=
[]
string
{
"create"
,
name
,
"create"
,
name
,
"--distribution"
,
config
.
GuestOSType
,
"--distribution"
,
config
.
GuestOSType
,
"--dst"
,
config
.
OutputDir
,
"--dst"
,
config
.
OutputDir
,
"--vmtype"
,
"vm"
,
"--vmtype"
,
"vm"
,
"--no-hdd"
,
"--no-hdd"
,
}
}
commands
[
1
]
=
[]
string
{
"set"
,
name
,
"--cpus"
,
"1"
}
commands
[
2
]
=
[]
string
{
"set"
,
name
,
"--memsize"
,
"512"
}
commands
[
3
]
=
[]
string
{
"set"
,
name
,
"--startup-view"
,
"same"
}
commands
[
4
]
=
[]
string
{
"set"
,
name
,
"--on-shutdown"
,
"close"
}
commands
[
5
]
=
[]
string
{
"set"
,
name
,
"--on-window-close"
,
"keep-running"
}
commands
[
6
]
=
[]
string
{
"set"
,
name
,
"--auto-share-camera"
,
"off"
}
commands
[
7
]
=
[]
string
{
"set"
,
name
,
"--smart-guard"
,
"off"
}
ui
.
Say
(
"Creating virtual machine..."
)
ui
.
Say
(
"Creating virtual machine..."
)
for
_
,
command
:=
range
commands
{
if
err
:=
driver
.
Prlctl
(
command
...
);
err
!=
nil
{
err
:=
driver
.
Prlctl
(
command
...
)
err
:=
fmt
.
Errorf
(
"Error creating VM: %s"
,
err
)
ui
.
Say
(
fmt
.
Sprintf
(
"Executing: prlctl %s"
,
command
))
state
.
Put
(
"error"
,
err
)
if
err
!=
nil
{
ui
.
Error
(
err
.
Error
())
err
:=
fmt
.
Errorf
(
"Error creating VM: %s"
,
err
)
return
multistep
.
ActionHalt
state
.
Put
(
"error"
,
err
)
}
ui
.
Error
(
err
.
Error
())
return
multistep
.
ActionHalt
ui
.
Say
(
"Applying default settings..."
)
}
if
err
:=
driver
.
SetDefaultConfiguration
(
name
);
err
!=
nil
{
err
:=
fmt
.
Errorf
(
"Error VM configuration: %s"
,
err
)
state
.
Put
(
"error"
,
err
)
ui
.
Error
(
err
.
Error
())
return
multistep
.
ActionHalt
}
// Set the VM name property on the first command
// Set the VM name property on the first command
if
s
.
vmName
==
""
{
if
s
.
vmName
==
""
{
s
.
vmName
=
name
s
.
vmName
=
name
}
}
}
// Set the final name in the state bag so others can use it
// Set the final name in the state bag so others can use it
...
...
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