Clones an existing virtual machine.
PRL_HANDLE PrlVm_CloneEx( PRL_HANDLE hVm, PRL_CONST_STR new_vm_name, PRL_CONST_STR new_vm_root_path, PRL_UINT32 nFlags );
PrlApiVm.h
A handle of type PHT_JOB containing the results of this asynchronous operation or PRL_INVALID_HANDLE if there's not enough memory to instantiate the job object.
The function creates an exact copy of the specified virtual machine on the same host using the specified new name and location. In order to perform a clone operation, the original machine must be registered with the Virtuozzo Service. A clone can be created as a virtual machine or as a template. To create a template, set the nFlags parameter to PACF_CLONEVM_TO_TEMPLATE value. The function can also be used to create new virtual machines from templates. In order to that, the hVm parameter must contain a handle to a template, the name and the path parameters must be set to desired values, and the bCreateTemplate parameter must be set to PRL_FALSE.
To get the return code from the PHT_JOB object, use the PrlJob_GetRetCode function. Possible values are:
PRL_ERR_INVALID_ARG - invalid handle or null pointer was passed.
PRL_ERR_SUCCESS - function completed successfully.