salt.modules.parallels module

Manage Parallels Desktop VMs with prlctl and prlsrvctl. Only some of the prlctl commands implemented so far. Of those that have been implemented, not all of the options may have been provided yet. For a complete reference, see the Parallels Desktop Reference Guide.

What has not been implemented yet can be accessed through parallels.prlctl and parallels.prlsrvctl (note the preceding double dash -- as necessary):

salt '*' parallels.prlctl installtools macvm runas=macdev
salt -- '*' parallels.prlctl capture 'macvm --file macvm.display.png' runas=macdev
salt -- '*' parallels.prlsrvctl set '--mem-limit auto' runas=macdev

New in version 2016.3.0.

salt.modules.parallels.clone(name, new_name, linked=False, template=False, runas=None)

Clone a VM

New in version 2016.11.0.

Parameters:
  • name (str) -- Name/ID of VM to clone
  • new_name (str) -- Name of the new VM
  • linked (bool) -- Create a linked virtual machine.
  • template (bool) -- Create a virtual machine template instead of a real virtual machine.
  • runas (str) -- The user that the prlctl command will be run as

Example:

salt '*' parallels.clone macvm macvm_new runas=macdev
salt '*' parallels.clone macvm macvm_templ template=True runas=macdev
salt.modules.parallels.delete(name, runas=None)

Delete a VM

New in version 2016.11.0.

Parameters:
  • name (str) -- Name/ID of VM to clone
  • runas (str) -- The user that the prlctl command will be run as

Example:

salt '*' parallels.exec macvm 'find /etc/paths.d' runas=macdev
salt.modules.parallels.delete_snapshot(name, snap_name, runas=None, all=False)

Delete a snapshot

Note

Deleting a snapshot from which other snapshots are dervied will not delete the derived snapshots

Parameters:
  • name (str) -- Name/ID of VM whose snapshot will be deleted
  • snap_name (str) -- Name/ID of snapshot to delete
  • runas (str) -- The user that the prlctl command will be run as
  • all (bool) --

    Delete all snapshots having the name given

    New in version 2016.11.0.

Example:

salt '*' parallels.delete_snapshot macvm 'unneeded snapshot' runas=macdev
salt '*' parallels.delete_snapshot macvm 'Snapshot for linked clone' all=True runas=macdev
salt.modules.parallels.exec(name, command, runas=None)

Run a command on a VM

Parameters:
  • name (str) -- Name/ID of VM whose exec will be returned
  • command (str) -- Command to run on the VM
  • runas (str) -- The user that the prlctl command will be run as

Example:

salt '*' parallels.exec macvm 'find /etc/paths.d' runas=macdev
salt.modules.parallels.exists(name, runas=None)

Query whether a VM exists

New in version 2016.11.0.

Parameters:
  • name (str) -- Name/ID of VM
  • runas (str) -- The user that the prlctl command will be run as

Example:

salt '*' parallels.exists macvm runas=macdev
salt.modules.parallels.list_snapshots(name, snap_name=None, tree=False, names=False, runas=None)

List the snapshots

Parameters:
  • name (str) -- Name/ID of VM whose snapshots will be listed
  • snap_id (str) -- Name/ID of snapshot to display information about. If tree=True is also specified, display the snapshot subtree having this snapshot as the root snapshot
  • tree (bool) -- List snapshots in tree format rather than tabular format
  • names (bool) -- List snapshots as ID, name pairs
  • runas (str) -- The user that the prlctl command will be run as

Example:

salt '*' parallels.list_snapshots macvm runas=macdev
salt '*' parallels.list_snapshots macvm tree=True runas=macdev
salt '*' parallels.list_snapshots macvm snap_name=original runas=macdev
salt '*' parallels.list_snapshots macvm names=True runas=macdev
salt.modules.parallels.list_vms(name=None, info=False, all=False, args=None, runas=None, template=False)

List information about the VMs

Parameters:
  • name (str) --

    Name/ID of VM to list

    Changed in version 2016.11.0: No longer implies info=True

  • info (str) -- List extra information
  • all (bool) -- List all non-template VMs
  • args (tuple) -- Additional arguments given to prctl list
  • runas (str) -- The user that the prlctl command will be run as
  • template (bool) --

    List the available virtual machine templates. The real virtual machines will not be included in the output

    New in version 2016.11.0.

Example:

salt '*' parallels.list_vms runas=macdev
salt '*' parallels.list_vms name=macvm info=True runas=macdev
salt '*' parallels.list_vms info=True runas=macdev
salt '*' parallels.list_vms ' -o uuid,status' all=True runas=macdev
salt.modules.parallels.prlctl(sub_cmd, args=None, runas=None)

Execute a prlctl command

Parameters:
  • sub_cmd (str) -- prlctl subcommand to execute
  • args (str) -- The arguments supplied to prlctl <sub_cmd>
  • runas (str) -- The user that the prlctl command will be run as

Example:

salt '*' parallels.prlctl user list runas=macdev
salt '*' parallels.prlctl exec 'macvm uname' runas=macdev
salt -- '*' parallels.prlctl capture 'macvm --file macvm.display.png' runas=macdev
salt.modules.parallels.prlsrvctl(sub_cmd, args=None, runas=None)

Execute a prlsrvctl command

New in version 2016.11.0.

Parameters:
  • sub_cmd (str) -- prlsrvctl subcommand to execute
  • args (str) -- The arguments supplied to prlsrvctl <sub_cmd>
  • runas (str) -- The user that the prlsrvctl command will be run as

Example:

salt '*' parallels.prlsrvctl info runas=macdev
salt '*' parallels.prlsrvctl usb list runas=macdev
salt -- '*' parallels.prlsrvctl set '--mem-limit auto' runas=macdev
salt.modules.parallels.reset(name, runas=None)

Reset a VM by performing a hard shutdown and then a restart

Parameters:
  • name (str) -- Name/ID of VM to reset
  • runas (str) -- The user that the prlctl command will be run as

Example:

salt '*' parallels.reset macvm runas=macdev
salt.modules.parallels.restart(name, runas=None)

Restart a VM by gracefully shutting it down and then restarting it

Parameters:
  • name (str) -- Name/ID of VM to restart
  • runas (str) -- The user that the prlctl command will be run as

Example:

salt '*' parallels.restart macvm runas=macdev
salt.modules.parallels.revert_snapshot(name, snap_name, runas=None)

Revert a VM to a snapshot

Parameters:
  • name (str) -- Name/ID of VM to revert to a snapshot
  • snap_name (str) -- Name/ID of snapshot to revert to
  • runas (str) -- The user that the prlctl command will be run as

Example:

salt '*' parallels.revert_snapshot macvm base-with-updates runas=macdev
salt.modules.parallels.snapshot(name, snap_name=None, desc=None, runas=None)

Create a snapshot

Parameters:
  • name (str) -- Name/ID of VM to take a snapshot of
  • snap_name (str) -- Name of snapshot
  • desc (str) -- Description of snapshot
  • runas (str) -- The user that the prlctl command will be run as

Example:

salt '*' parallels.create_snapshot macvm snap_name=macvm-original runas=macdev
salt '*' parallels.create_snapshot macvm snap_name=macvm-updates desc='clean install with updates' runas=macdev
salt.modules.parallels.snapshot_id_to_name(name, snap_id, strict=False, runas=None)

Attempt to convert a snapshot ID to a snapshot name. If the snapshot has no name or if the ID is not found or invalid, an empty string will be returned

Parameters:
  • name (str) -- Name/ID of VM whose snapshots are inspected
  • snap_id (str) -- ID of the snapshot
  • strict (bool) -- Raise an exception if a name cannot be found for the given snap_id
  • runas (str) -- The user that the prlctl command will be run as

Example data

ID: {a5b8999f-5d95-4aff-82de-e515b0101b66}
Name: original
Date: 2016-03-04 10:50:34
Current: yes
State: poweroff
Description: original state

CLI Example:

salt '*' parallels.snapshot_id_to_name macvm a5b8999f-5d95-4aff-82de-e515b0101b66 runas=macdev
salt.modules.parallels.snapshot_name_to_id(name, snap_name, strict=False, runas=None)

Attempt to convert a snapshot name to a snapshot ID. If the name is not found an empty string is returned. If multiple snapshots share the same name, a list will be returned

Parameters:
  • name (str) -- Name/ID of VM whose snapshots are inspected
  • snap_name (str) -- Name of the snapshot
  • strict (bool) -- Raise an exception if multiple snapshot IDs are found
  • runas (str) -- The user that the prlctl command will be run as

CLI Example:

salt '*' parallels.snapshot_id_to_name macvm original runas=macdev
salt.modules.parallels.start(name, runas=None)

Start a VM

Parameters:
  • name (str) -- Name/ID of VM to start
  • runas (str) -- The user that the prlctl command will be run as

Example:

salt '*' parallels.start macvm runas=macdev
salt.modules.parallels.status(name, runas=None)

Status of a VM

Parameters:
  • name (str) -- Name/ID of VM whose status will be returned
  • runas (str) -- The user that the prlctl command will be run as

Example:

salt '*' parallels.status macvm runas=macdev
salt.modules.parallels.stop(name, kill=False, runas=None)

Stop a VM

Parameters:
  • name (str) -- Name/ID of VM to stop
  • kill (bool) -- Perform a hard shutdown
  • runas (str) -- The user that the prlctl command will be run as

Example:

salt '*' parallels.stop macvm runas=macdev
salt '*' parallels.stop macvm kill=True runas=macdev