Branch
master, planner_reserve
Introduction
Currently CloudStack has following 3 deployment planners available out-of-the-box:
...
- Expose deployment planner as part of a ServiceOffering API. By default, the value can be set to the default CS FirstFitPlanner, but admin can override it and set some other strategy as per needs.
- Add a resource reservation mechanism to let deployment planners co-exist
Resource reservation between planners
When the Deployment planner gets exposed per ServiceOffering, then in a CS deployment multiple planners will have to co-exist.
...
e.g Refer to the Implicit Dedication Planner being added as part of this 4.2 release.
Design
- Planner Choice in ServiceOffering:
- Admin can set a deployment_planner to be used while creating a service offering. Changes are needed to createServiceOffering API to add a deployment_planner.
- During VM deployment, each planner can check if it is supposed to execute based on the ServiceOffering of the VM being deployed. DeploymentPlanner :: canHandle() can be modified to do this check.
- Reservation Mechanism:
- As part of the Affinity feature, a new manager on top of deployment planners is added, called as the DeploymentPlanningManager. This manager can handle the resource reservation as well.
- Currently, the DPM invokes the planners to find suitable host and storage pools for the VM being deployed.
- After a planner finds a host to use, DPM can make a check if that host is reserved by any planner explicitly or if it can be shared across planners.
Wiki Markup |
---|
When a planner like the \[Implicit Dedication Planner\] chooses a host for deployment, DPM can store it as a 'dedicated' host. No other planner will be able to pick it up for any other VM deployment. |
- VMs deployed through FirstFitPlanner, UserDispersingPlanner and UserConcentratedPodPlanner can share hosts - so DPM can mark those hosts as 'shared'.
- DPM will store this reservation info in a separate table 'op_host_planner_reservation'
- Also in order to free up the reservations, DPM can listen to VM state transitions. When a VM is stopped, DPM can check if the host has no other VMs. If yes, it can free up the reservation so that it can be picked up by other planner.
API Changes
- listDeploymentPlanners Admin API - This will be a new API that will let Admin list the available set of deployment planners.
- createServiceOffering API changes - Following new field will be added to this API
- deploymentplanner - String value (default: 'FirstFitPlanner' )
DB Changes
- Additional column to service_offering:
ALTER TABLE `cloud`.`service_offering` ADD COLUMN `deployment_planner` varchar(255) NOT NULL DEFAULT 'FirstFitPlanner' COMMENT 'Planner heuristics used to deploy a VM of this offering'; - A new table to store planner reservations. Following are some columns needed:
CREATE TABLE `cloud`.`op_host_planner_reservation` (
`id` bigint unsigned NOT NULL auto_increment,
`data_center_id` bigint unsigned NOT NULL,
`pod_id` bigint unsigned,
`cluster_id` bigint unsigned,
`host_id` bigint unsigned,
`account_id` bigint unsigned,
`domain_id` bigint unsigned,
`deployment_planner` int(1) unsigned NOT NULL COMMENT 'Name of the Planner',
`resource_type` datetime COMMENT 'shared(0) Vs dedicated(1)',
PRIMARY KEY (`id`),
INDEX `i_op_host_capacity__host_type`(`host_id`, `resource_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
UI Changes
Following UI changes are needed:
...