Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

A table named disk_controller_mapping will be created in the cloud schema with the following columns:`

NameTypeNullableDefaultDescription
idbigint(20) unsignedNoAuto increment-
uuidvarchar(40)No--
nametextNo- Name used to identify the disk controller in configurations such as rootDiskController, dataDiskController and vmware.root.disk.controller
controller_referencetextNo-This column represents the reference to the controller. For VMware, it will be the disk controller's classpath; e.g: com.vmware.vim25.VirtualLsiLogicController. For KVM, it will be the controller's model; e.g. lsilogic
bus_nametextNo-Name of the disk controller's bus; e.g: scsi for lsilogic controllers
hypervisortextNo-Hypervisor this mapping should be available for
max_device_countint unsignedYesNULLVMware: maximum number of virtual disks a single controller can be associated with
max_controller_countint unsignedYesNULLVMware: maximum number of the controllers that a single virtual machine can have; controllers sharing the same `supertype` will be considered together
vmdk_adapter_typetextYesNULLVMware: the VMDK file's ddb.adapterType value for disks using this controller
min_hardware_versiontextYesNULL

Minimum hardware/software version of the VM which supports the disk controller; if null, no restriction will be applied

In VMware, for instance, PVSCSI requires a minimum virtual hardware version of 7, SATA requires version 10, and NVME requires 13

2.2 VM start

The relevant parts from the current VM start process are summarized in the following workflow.

...

  1. VmwareStorageProcessor will receive an AttachCommand containing a pair with the VM's rootDiskController and dataDiskController settings.
  2. Choose which disk controller to use:
    1. Execute the same process as in VM start's step 1 to get the disk controller mappings for rootDiskController and dataDiskController.
    2. If the controllers are OS recommended, obtain the recommended controllers.
      1. After obtaining the recommended controllers, if both root and data disk controllers share the same bus, prioritize using the root disk controller type for the data disks.
    3. If the disk is being attached as a root disk, choose the controller required for the root disk; otherwise, choose the controller required by the data disks.
  3. Find which controller the disk should be associated with:
    1. Iterate through all the instance's devices, verifying if they match the required disk controller's class, if the maximum amount of associated devices has not been reached, and if its bus number does not exceed the maximum amount of that controller type. If all conditions are met, choose that controller. For SCSI devices, device number 7 will need to be considered in the second validation.
  4. Find which device number the disk should be associated with:
    1. Iterate through all devices again, verifying if they are associated with the chosen disk controller. If a device is, store its device number in a list.
    2. If the controller is a subtype of SCSI, add device number 7 to the list.
    3. Based on the stored values, choose the minimum available device number.
  5. Update the VMDK adapter (ddb.adapterType) to the new disk controller's vmdk_adapter_type column.
  6. Instantiate a VirtualMachineConfigSpec.
  7. Instantiate the disk, associate it with the chosen disk controller, device number and a new VirtualDeviceConfigSpec that gets added to the VirtualMachineConfigSpec.
  8. Send a virtual machine reconfiguration task to VMware in order to configure the instance based on the VirtualMachineConfigSpec.

3

...

Future works

This spec addressed the creation of a flexible method of adding support for new disk controllers without having to extend CloudStack. This initial proposal is for environments using VMware; however, this feature can also be extended for KVM and XenServer in the future. Moreover, we can also create APIs to allow adding, removing and listing the controllers available for each hypervisor.