vmjuggler.VirtualMachine

class vmjuggler.VirtualMachine(vc_object)

VirtualMachine object

Wrapper for vim.VirtualMachine

Parameters:vc_object (vim.VirtualMachine) – Raw VMWare ManagedObject
create_snap(name, description=None, memory=True, quiesce=False)

Create snapshot.

Parameters:
  • name (str) – Snapshot name.
  • description (str) – Snapshot description.
  • memory (bool) – If set, the memory will be included to snapshot.
  • quiesce (bool) – If set, the quiesce snapshot will be created.
Returns:

True on success, otherwise False

get_snap(name=None, current=False, get_all=False, raw=False)

Return list of snapshot objects.

Parameters:
  • name (str) – Snapshot name.
  • current (bool) – If set the ‘name’ is ignored and current snapshot returned.
  • get_all (bool) – If set the ‘name’ and ‘current’ are ignored and all VM snapshots returned.
  • raw (bool) – If set the raw VMWare snapshot object returned.
Returns:

List of vmjuggler.VMSnapshot objects.

list_snaps()

Prints out all VM snapshots.

Returns:n/a
name

Object’s name. Populated once instance created.

power_off()

Power Off VM.

Returns:True on success, otherwise False.
power_on()

Power On VM.

Returns:True on success, otherwise False.
raw_obj

Raw object. Populated once instance created.

reboot()

Reboot VM.

Returns:True on success, otherwise False.
remove_snap(name=None, current=False, remove_all=False, remove_children=False, consolidate=False)

Remove snapshot or all snapshots.

Parameters:
  • name (str) – Snapshot name.
  • current (bool) – If set, the current snapshot will be deleted, “name” parameter is ignored.
  • remove_all (bool) – If set, all snapshots will be removed, “name” and “current” parameters are ignored.
  • remove_children (bool) – If set, children snapshots will be removed along with parent.
  • consolidate (bool) – If set, the consolidation will be performed.
Returns:

True on success, False if any of snapshots failed to be removed.

reset()

Reset VM power.

Returns:True on success, otherwise False.
revert(snapshot_name=None, current=False)

Revert to snapshot.

Parameters:
  • snapshot_name (str) – Snapshot name.
  • current (bool) – Revert to current snapshot if set. The ‘name’ is ignored.
Returns:

True on success, otherwise False.

shutdown()

Shutdown OS on VM.

Returns:True on success, otherwise False.
state

VM power state.

Returns:str: “poweredOff”, “poweredOn” or “suspended”
suspend()

Suspend VM.

Returns:True on success, otherwise False.
terminate()

Immediately terminate VM.

Returns:True on success, otherwise False.