2. Auto-Scaling and Cloud Bursting : 2.5 The Downscaling and Unbursting Process : 2.5.2 Input Parameters and Workflow Outline
   
2.5.2 Input Parameters and Workflow Outline
The Workflow input parameters are the same as in the Upscale and burst a vApp workflow:
*A mandatory vApp scaling configuration name (the vApp Template name).
*A mandatory tier number to upscale.
*An optional preferred virtual datacenter.
The same wrapper workflows can be used to control the upscale and downscale workflows from the monitoring systems.
By default, the downscaling process downscales the vApps in the order of the burst virtual datacenters that have been defined during the configuration, but it is possible to provide as a parameter the first virtual datacenter in which the downscale should occur. One difference with the upscaling workflow is that vApps are not powered off. In this implementation, they are downscaled or deleted right away, to limit disk space usage. Also, the downscaling process keeps at least one vApp in each burst virtual datacenters to maintain the overall service resiliency.
This workflow is designed so that different sections call one other.
2.5.2.1. Workflow Steps
1. Wait for a single workflow execution.
2. Get the scaling and bursting configuration.
3. If a preferred virtual datacenter was provided as input, set it. Otherwise, use the ones in the burst configuration. For each of these virtual datacenters:
a. Downscale an existing vApp that did not reach the minimum number of instances for a given tier by deleting a virtual machine for a given tier.
b. If no vApp is available, or if downscaling fails, undeploy and delete a vApp.
4. Before the virtual machine or vApp has been deleted, get the Tier 1 IP addresses, and remove them as members of the load balancer pool matching the current virtual datacenter.
2.5.2.2. Error Handling
If undeploying or deleting a vApp virtual machine, or if a vApp fails, try the operation on the next available vApp.
If removing members from a pool fails, there is no particular remedy. Undeploying and deleting the virtual machine or vApp effectively removes the resource, leaving the member in the pool but with an unavailable status. The member is eventually reassigned to a newly-provisioned vApp virtual machine.
2.5.2.3. Logs
Information : "Check for vApps to downscale"
Information : "Undeploying and deleting VM [virtual machine name] from vApp [vApp name]"
Information : "vApp [vApp name] has [VM instance Nb] tier [tier number] VMs, which is under or equal to the minimum. Skipping"
Warning : "Failed to remove a member"
Warning : "Failed to undeploy or delete VM [virtual machine name] from vApp [vApp name]"
Information : "No vApp available for being downscaled"
Information : "Undeploying and deleting vApp [vApp name]"
Warning: "Only one vApp left : [vApp name] , impossible to downscale without removing the service"