Commit f7af571c authored by Mikhail Zholobov's avatar Mikhail Zholobov

builder/parallels: Add "SetDefaultConfiguration" function

This functions applies the default configuration to the virtual machine. Also, it disables some integration features
which should not present in the resulted VM image.

Functions are different in PD 9 and 10 structs because some additional options appeared only in Parallels Desktop 10 release.
parent d9fceaf3
......@@ -44,6 +44,9 @@ type Driver interface {
// Send scancodes to the vm using the prltype python script.
SendKeyScanCodes(string, ...string) error
// Apply default сonfiguration settings to the virtual machine
SetDefaultConfiguration(string) error
// Finds the MAC address of the NIC nic0
Mac(string) (string, error)
......
......@@ -5,3 +5,27 @@ package common
type Parallels10Driver struct {
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
}
......@@ -255,6 +255,25 @@ func prepend(head string, tail []string) []string {
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) {
var stdout bytes.Buffer
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment