Collapse All
Parallels C API Reference Guide
PrlVm_ValidateConfig Function
PrlApi.h PHT_VIRTUAL_MACHINE

Validates the specified section of a virtual machine configuration.

Syntax
PRL_HANDLE PrlVm_ValidateConfig(
    PRL_HANDLE hVm, 
    PRL_VM_CONFIG_SECTIONS nSection
);
File
Parameters

hVm
A handle of type PHT_VIRTUAL_MACHINE identifying the virtual machine.
nSection
The section in the virtual machine configuration to verify.
Returns

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.

Remarks

When creating or modifying a virtual machine configuration, this function can be used to verify that a particular section of the configuration is valid. Use this function before sending the virtual machine object containing the configuration information to the Parallels Service. If the configuration is valid, you can commit the changes. If the configuration is not valid, make the necessary modifications and retry.

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 the specified configuration section doesn't exist.

PRL_ERR_PARSE_VM_CONFIG - error parsing configuration data.

PRL_ERR_VMCONF_VALIDATION_FAILED - invalid configuration; the description of the problem can be retrieved from from the PHT_JOB object (see below).

PRL_ERR_SUCCESS - specified configuration is valid.

In the event of validation failure, the PHT_JOB object will contain the description of the problem. To get the description:

  1. Use the PrlJob_GetResult function to obtain a handle to the PHT_RESULT object.
  2. Use the PrlResult_GetParamsCount function to obtain the result count.
  3. Use the PrlResult_GetParamByIndex to obtain a handle of type PHT_EVENT (if there are multiple results, call the function for each one).
  4. Use the PrlEvent_GetErrString function to get the validation error description.
Links
Copyright © 1999-2011 Parallels Holdings, Ltd. and its affiliates. All rights reserved.
What do you think about this topic? Send feedback!