Skip to content

Conversation

@sureshanaparti
Copy link
Contributor

@sureshanaparti sureshanaparti commented Dec 24, 2025

Description

This PR add 'dataDiskController' VM setting/detail for KVM hypervisor.

'dataDiskController' VM setting support added to KVM in 4.16.0, here: #4569, but the option is not included in the VM settings shown for KVM hypervisor.

public DiskDef.DiskBus getDataDiskModelFromVMDetail(final VirtualMachineTO vmTO) {
Map<String, String> details = vmTO.getDetails();
if (details == null) {
return null;
}
String dataDiskController = details.get(VmDetailConstants.DATA_DISK_CONTROLLER);
if (StringUtils.isNotBlank(dataDiskController)) {
LOGGER.debug("Passed custom disk controller for DATA disk " + dataDiskController);
for (DiskDef.DiskBus bus : DiskDef.DiskBus.values()) {
if (bus.toString().equalsIgnoreCase(dataDiskController)) {
LOGGER.debug("Found matching enum for disk controller for DATA disk " + dataDiskController);
return bus;
}
}
}
return null;
}

Fixes #12327

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

Able to set dataDiskController setting for VM on KVM hypervisor.

VM_Setting_dataDiskController_options_KVM VM_Setting_dataDiskController-scsi_KVM
# virsh dumpxml i-2-3-VM 
<domain type='kvm' id='7'>
  <name>i-2-3-VM</name>
  <uuid>1b2491bb-7589-44a8-864c-c176422adf5d</uuid>
...
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/mnt/4d215758-18a9-335e-8c9d-ecb4d19c9d94/e6149bbd-9025-4692-b03e-520c0fddd249' index='3'/>
      <backingStore type='file' index='4'>
        <format type='qcow2'/>
        <source file='/mnt/4d215758-18a9-335e-8c9d-ecb4d19c9d94/f6e89dbd-e0a4-11f0-846d-1e00ea0001ad'/>
        <backingStore/>
      </backingStore>
      <target dev='vda' bus='virtio'/>
      <serial>e6149bbd90254692b03e</serial>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/mnt/4d215758-18a9-335e-8c9d-ecb4d19c9d94/14118dd4-66f9-4fee-95a8-85c5c92690d1' index='2'/>
      <backingStore/>
      <target dev='sdb' bus='scsi'/>
      <serial>14118dd466f94fee95a8</serial>
      <alias name='scsi0-0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
...    

How did you try to break this feature and the system with this change?

@sureshanaparti
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@codecov
Copy link

codecov bot commented Dec 24, 2025

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 16.23%. Comparing base (b394b5b) to head (cda3c8d).

Files with missing lines Patch % Lines
...ain/java/com/cloud/api/query/QueryManagerImpl.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               4.20   #12334   +/-   ##
=========================================
  Coverage     16.23%   16.23%           
- Complexity    13377    13378    +1     
=========================================
  Files          5657     5657           
  Lines        498865   498866    +1     
  Branches      60545    60545           
=========================================
+ Hits          80991    81010   +19     
+ Misses       408843   408822   -21     
- Partials       9031     9034    +3     
Flag Coverage Δ
uitests 4.00% <ø> (ø)
unittests 17.09% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 16150

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clgtm

Copy link
Member

@weizhouapache weizhouapache left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code lgtm

Not sure if scsi means virtio iSCSI

@sureshanaparti
Copy link
Contributor Author

sureshanaparti commented Dec 24, 2025

code lgtm

Not sure if scsi means virtio iSCSI

I think, it uses the same as for root disk controller. for 'scsi', uses scsi and for others, uses virtio .

DiskDef.DiskBus diskBusTypeData = getDataDiskModelFromVMDetail(vmSpec);
if (diskBusTypeData == null) {
diskBusTypeData = (diskBusType == DiskDef.DiskBus.SCSI) ? diskBusType : DiskDef.DiskBus.VIRTIO;
}

@sureshanaparti sureshanaparti marked this pull request as ready for review December 24, 2025 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show "dataDiskController" option under vm setting for a vm launched on kvm hypervisor

5 participants