Previous page

Next page

Locate page in Contents

Vm.begin_edit and Vm.commit Methods

All virtual machine configuration changes must begin with the prlsdkapi.Vm.begin_edit and end with the prlsdkapi.Vm.commit call. These two methods are used to detect collisions with other programs trying to modify the configuration settings of the same virtual machine at the same time.

The Vm.begin_edit method timestamps the beginning of the editing operation. It does not lock the machine, so other programs can still make changes to the same virtual machine. The method will also automatically update your local virtual machine object with the current virtual machine configuration information. This is done in order to ensure that the local object contains the changes that might have happened since you obtained the virtual machine object. When you are done making the changes, you must invoke the Vm.commit method. The first thing that the method will do is verify that the virtual machine configuration has not been modified by other programs since you began making your changes. If a collision is detected, your changes will be rejected and Vm.commit will throw an exception. In such a case, you will have to reapply the changes. In order to do that, you will have to get the latest configuration using the Vm.refresh_config method and re-evaluate it. Please note that Vm.refresh_config method will update the configuration data in your local virtual machine object and will overwrite all existing data, including the changes that you've made so far. Furthermore, the Vm.begin_edit method will also overwrite all existing data (see above). If you don't want to loose your data, save it locally before invoking any of the two methods.