Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: 4.18
Choose a base branch
from

Conversation

weizhouapache
Copy link
Member

@weizhouapache weizhouapache commented Oct 17, 2024

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

  • register a template or update template guest os type to "Other PV (VirtIO SCSI)"
  • create vm
  • attach 6 disks. check vm xml dump, it looks good
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none' discard='unmap'/>
      <source file='/mnt/3bdc199b-d6f8-3a19-a139-3b0ae09379d5/e613dd6e-e0df-41ba-bf24-75bc0c5d4771' index='8'/>
      <backingStore/>
      <target dev='sdg' bus='scsi'/>
      <serial>e613dd6ee0df41babf24</serial>
      <alias name='scsi0-0-0-6'/>
      <address type='drive' controller='0' bus='0' target='0' unit='6'/>
    </disk>
    <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='9'/>
      <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'>
      <alias name='scsi1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </controller>
  • stop and start the vm

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

  • 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?

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

@weizhouapache
Copy link
Member Author

@blueorangutan package

@blueorangutan
Copy link

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

Copy link

codecov bot commented Oct 17, 2024

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 ⚠️
Additional details and impacted files
@@             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 Coverage Δ
unittests 12.27% <90.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.

@blueorangutan
Copy link

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

@weizhouapache
Copy link
Member Author

@blueorangutan test

@blueorangutan
Copy link

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

@rohityadavcloud rohityadavcloud added this to the 4.19.2.0 milestone Oct 17, 2024
@weizhouapache weizhouapache marked this pull request as ready for review October 17, 2024 14:04
@blueorangutan
Copy link

[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

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

@weizhouapache
Copy link
Member Author

@blueorangutan package

@blueorangutan
Copy link

@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
Copy link

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

@rohityadavcloud
Copy link
Member

@blueorangutan test

@blueorangutan
Copy link

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

@blueorangutan
Copy link

[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

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.

Data Disks get unavailable when VM is shut down
5 participants