Removing an Existing Virtual MachineIf a virtual machine is no longer needed, it can be removed. There are two options for removing a virtual machine:
Example The following sample function illustrates how to implement both options. The function takes a """ Remove an existing virtual machine. @param vm: An instance of prlsdkapi.Vm class identifying the virtual machine. @param delete: A boolean value indicating whether the virtual machine files should be permanently deleted from the host. """ def remove_vm(vm, delete):
if delete == False: # Unregister the virtual machine but don't delete its files. try: vm.unreg() except prlsdkapi.PrlSDKError, e: print "Error: %s" % e return else: # Unregister the machine and delete its files from the hard drive. try: vm.delete() except prlsdkapi.PrlSDKError, e: print "Error: %s" % e return
print vm.get_config().get_name() + " has been removed." |
||||
|