Performing Power OperationsTo start, stop, pause, reset, suspend, or resume a virtual machine, a Please note that powering off a virtual machine is not the same as performing an operating system shutdown. When a virtual machine is stopped, it is a cold stop (i.e. it is the same as turning off the power to a computer). Any unsaved data will be lost. However, if the OS in the virtual machine supports ACPI (Advanced Configuration and Power Interface) then it can be used to shut down the virtual machine properly. ACPI is currently supported only with "stop" and "pause" operations. Corresponding methods have an additional parameter that can be used to instruct them to use ACPI. The following code snippets demonstrate how to perform each of the power operations. Examples # Stop the virtual machine. # The boolean parameter (True) specifies to use ACPI. try: vm.stop(True).wait() except prlsdkapi.PrlSDKError, e: print "Error: %s" % e
# Start the virtual machine. try: vm.start().wait() except prlsdkapi.PrlSDKError, e: print "Error: %s" % e
# Pause the virtual machine. # The boolean parameter specifies to use ACPI. try: vm.pause(True).wait() except prlsdkapi.PrlSDKError, e: print "Error: %s" % e
# Resume the virtual machine. try: vm.resume().wait() except prlsdkapi.PrlSDKError, e: print "Error: %s" % e
# Restart the virtual machine. try: vm.restart().wait() except prlsdkapi.PrlSDKError, e: print "Error: %s" % e
# Reset the virtual machine. This operation is an equivalent of # Stop and Start performed in succession. # The stop operation will NOT use ACPI, so the entire reset # operation will resemble the "Reset" button pressed on a physical box. try: vm.reset().wait() except prlsdkapi.PrlSDKError, e: print "Error: %s" % e
|
||||
|