You can use the vcenter deployment API to run the upgrade stage 2 process of your vCenter Server Appliance and Platform Services Controller appliance.
Upgrade Workflow and Upgrade Stage 2 Workflow show example upgrade workflows.
During stage 1, the appliance is in a NOT_INITIALIZED state. After a successful deployment, the appliance enters in an INITIALIZED state. If there are errors during stage 1, the appliance stays in a NOT_INITIALIZED state and you must redeploy it.
You can check the state of the appliance before, during, and after the upgrade process. You can run the upgrade stage 2 process if the appliance is initialized. You can check the upgrade configuration before you run the upgrade by running the appliance 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 appliance can enter in a FAILED or QUESTION_RASED state. If a question appears during the upgrade, the appliance 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 appliance does not generate questions, and uses default answers.
If errors appear during the upgrade, the appliance enters in a FAILED state and you must remove the causes, redeploy the appliance and restart the upgrade. If stage 2 of the upgrade process is successful, the appliance enters in a CONFIGURED state. If the appliance is configured, you can check its services and pause the historical data transfer.
For information about the states of the appliance and available operations, see Upgrading the vCenter Server Appliance and Platform Services Controller Appliance.
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 appliance and the source ESXi host in SourceApplianceSpec and LocationSpec. See Upgrade Stage 2 Workflow , Upgrade Python Class Diagram, and UpgradeSpec Python Class Diagram. 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.
If your vCenter Server Appliance uses an external database and you want to transfer the historical data of your appliance, you must create a HistoryMigrationSpec and include it in the UpgradeSpec with the SourceAppliance and LocationSpec. In the HistoryMigrationSpec, you can specify the data scope and whether you want to use the deferred import feature. For information about the transfer of historical data, see Historical Data Transfer chapter.
If you upgrade an external Platform Services Controller appliance, you must create a PscSpec and include it in the UpgradeSpec. If you upgrade a vCenter Server Appliance with embedded Platform Services Controller, you must create a VcsaEmbeddedSpec and include it in the UpgradeSpec. If you upgrade a vCenter Server Appliance that works with an external Platform Services Controller, you must not create a VcsaEmbeddedSpec. You must provide only SourceApplianceSpec and LocationSpec.
Upgrade Python Class Diagram and UpgradeSpec Python Class Diagram show the classes that you can use to upgrade your appliance on stage 2.
For information about the classes, variables, and default values, see the API Reference documentation.