You can use the vcenter deployment API to run the upgrade stage 2 process of your vCenter Server instance.
Upgrade Workflow and Upgrade Stage 2 Workflow show example upgrade workflows.
During stage 1, the vCenter Server instance is in a NOT_INITIALIZED state. After a successful deployment, the vCenter Server instance enters in an INITIALIZED state. If there are errors during stage 1, the vCenter Server instance stays in a NOT_INITIALIZED state and you must redeploy it.
You can check the state of the vCenter Server instance before, during, and after the upgrade process. You can run the upgrade stage 2 process if the vCenter Server instance is initialized. You can check the upgrade configuration before you run the upgrade by running pre-checks. If errors or warnings appear during the validation of the upgrade specification, you must remove the causes and correct the specification.
During the upgrade process, the vCenter Server instance can enter in a FAILED or QUESTION_RASED state. If a question appears during the upgrade, the vCenter Server instance enters in a QUESTION_RAISED state and stays in it until you provide an answer. You can run the upgrade in silent mode, in which the vCenter Server instance does not generate questions, and uses default answers.
If errors appear during the upgrade, the vCenter Server instance enters in a FAILED state and you must remove the causes, redeploy the instance and restart the upgrade. If stage 2 of the upgrade process is successful, the vCenter Server instance enters in a CONFIGURED state. If the vCenter Server instance is configured, you can check its services and pause the historical data transfer.
For information about the states of the vCenter Server instance and available operations, see Upgrading a vCenter Server Instance.
You can run the upgrade pre-checks and the upgrade stage 2 process by creating and passing an UpgradeSpec. In UpgradeSpec, you define the upgrade configuration and specify the source vCenter Server instance and the source ESXi host in SourceApplianceSpec and LocationSpec. See Upgrade Stage 2 Workflow . You can run the upgrading in silent mode by setting the UpgradeSpec.auto_answer to true. The default value of UpgradeSpec.auto_answer is false and the upgrading is in interactive mode, in which you must provide answers to the raised questions.
For information about the classes, variables, and default values, see the API reference documentation.