apache / cloudstack

Apache CloudStack is an opensource Infrastructure as a Service (IaaS) cloud computing platform
https://cloudstack.apache.org/
Apache License 2.0
2.11k stars 1.11k forks source link

kvm: add SCSI controllers based on the number of virtio-SCSI disks #9823

Open weizhouapache opened 1 month ago

weizhouapache commented 1 month ago

Description

This PR fixes #7490

According to libvirt code, the units per scsi controller is set to 7 therefore, we need to create scsi controller every 7 disks (including CDROM).

https://github.com/libvirt/libvirt/blob/50cc7a0d9d2b9df085ec073a6d60820a9642158a/src/conf/domain_conf.h#L3007-L3008

https://github.com/libvirt/libvirt/blob/50cc7a0d9d2b9df085ec073a6d60820a9642158a/src/conf/domain_conf.c#L6701-L6704

Steps to reproduce the issue

Prior to this PR, a scsi controller with model lsilogic is created automatically

    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none' discard='unmap'/>
      <source file='/mnt/c8c866fd-5553-3dc7-99a2-6df2a6ff516e/6d21d6ec-7f0f-4acb-abe4-ae4da1f1e83e' index='2'/>
      <backingStore/>
      <target dev='sdh' bus='scsi'/>
      <serial>6d21d6ec7f0f4acbabe4</serial>
      <alias name='scsi1-0-0'/>
      <address type='drive' controller='1' bus='0' target='0' unit='0'/>
    </disk>
...
    <controller type='scsi' index='0' model='virtio-scsi'>
      <driver queues='1'/>
      <alias name='scsi0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </controller>
...
    <controller type='scsi' index='1' model='lsilogic'>
      <alias name='scsi1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </controller>

With this PR, a scsi controller with model virtio-scsi is created automatically

    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none' discard='unmap'/>
      <source file='/mnt/c8c866fd-5553-3dc7-99a2-6df2a6ff516e/6d21d6ec-7f0f-4acb-abe4-ae4da1f1e83e' index='2'/>
      <backingStore/>
      <target dev='sdh' bus='scsi'/>
      <serial>6d21d6ec7f0f4acbabe4</serial>
      <alias name='scsi1-0-0-0'/>
      <address type='drive' controller='1' bus='0' target='0' unit='0'/>
    </disk>
......
    <controller type='scsi' index='0' model='virtio-scsi'>
      <driver queues='1'/>
      <alias name='scsi0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </controller>
    <controller type='scsi' index='1' model='virtio-scsi'>
      <driver queues='1'/>
      <alias name='scsi1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
    </controller>

Types of changes

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

Bug Severity

Screenshots (if appropriate):

How Has This Been Tested?

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

weizhouapache commented 1 month ago

@blueorangutan package

blueorangutan commented 1 month ago

@weizhouapache 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[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 12.27%. Comparing base (1af4158) to head (89eb4eb). Report is 2 commits behind head on 4.18.

Files with missing lines Patch % Lines
...ervisor/kvm/resource/LibvirtComputingResource.java 90.00% 0 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## 4.18 #9823 +/- ## =========================================== Coverage 12.27% 12.27% - Complexity 9335 9339 +4 =========================================== Files 4699 4699 Lines 414691 414698 +7 Branches 53409 50767 -2642 =========================================== + Hits 50891 50903 +12 + Misses 357475 357468 -7 - Partials 6325 6327 +2 ``` | [Flag](https://app.codecov.io/gh/apache/cloudstack/pull/9823/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/apache/cloudstack/pull/9823/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `12.27% <90.00%> (+<0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

blueorangutan commented 1 month ago

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

weizhouapache commented 1 month ago

@blueorangutan test

blueorangutan commented 1 month ago

@weizhouapache a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

blueorangutan commented 1 month ago

[SF] Trillian test result (tid-11684) Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8 Total time taken: 46725 seconds Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr9823-t11684-kvm-ol8.zip Smoke tests completed. 110 look OK, 1 have errors, 0 did not run Only failed and skipped tests results shown below:

Test Result Time (s) Test File
ContextSuite context=TestISOUsage>:setup Error 0.00 test_usage.py
weizhouapache commented 4 weeks ago

@blueorangutan package

blueorangutan commented 4 weeks ago

@weizhouapache 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.

blueorangutan commented 4 weeks ago

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

rohityadavcloud commented 2 weeks ago

@blueorangutan test

blueorangutan commented 2 weeks ago

@rohityadavcloud a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

blueorangutan commented 2 weeks ago

[SF] Trillian test result (tid-11762) Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8 Total time taken: 47024 seconds Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr9823-t11762-kvm-ol8.zip Smoke tests completed. 110 look OK, 1 have errors, 0 did not run Only failed and skipped tests results shown below:

Test Result Time (s) Test File
ContextSuite context=TestISOUsage>:setup Error 0.00 test_usage.py