RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 855211 - index of SCSI controller is not decremented after hot-plug scsi-hd device again
Summary: index of SCSI controller is not decremented after hot-plug scsi-hd device again
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm
Version: 6.4
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Virtualization Maintenance
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-09-07 01:53 UTC by Sibiao Luo
Modified: 2012-09-10 10:54 UTC (History)
13 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-09-10 08:33:50 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Sibiao Luo 2012-09-07 01:53:29 UTC
Description of problem:
boot a guest with scsi disk interface, and hot-plug a scsi-hd data disk to guest, and then hot-remove it, then hot-add it again, verify the index for SCSI controller of two times of hot-plug data disk, the index of SCSI controller was not decremented after hot-plug scsi-hd device again. btw, if reboot the guest, the number of the SCSI controller can drop back into the old SCSI controller correctly.

Version-Release number of selected component (if applicable):
host info:
# uname -r && rpm -q qemu-kvm
2.6.32-303.el6.x86_64
qemu-kvm-0.12.1.2-2.311.el6.x86_64
guest info:
# uname -r
2.6.32-303.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1.boot a guest.
eg: # /usr/libexec/qemu-kvm -M rhel6.4.0 -cpu SandyBridge -enable-kvm -m 2048 -smp 2,sockets=2,cores=1,threads=1 -usb -device usb-tablet,id=input0 -name virtio-scsi-pci -uuid `uuidgen` -device virtio-scsi-pci,bus=pci.0,addr=0x3,id=scsi0 -drive file=/home/RHEL-Server-6.3-64-sluo.qcow2,format=qcow2,if=none,id=drive-disk,cache=none,werror=stop,rerror=stop,aio=native -device scsi-hd,drive=drive-disk,bus=scsi0.0,scsi-id=0,lun=0,bootindex=1 -netdev tap,id=hostnet0,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,id=virtio-net-pci0,mac=98:3B:CB:2E:90:A8,bus=pci.0,addr=0x4 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 -serial unix:/tmp/ttyS1,server,nowait -vnc :2 -bios /usr/share/seabios/bios-pm.bin -qmp tcp:0:5555,server,nowait -boot menu=on -monitor stdio
2.hot-plug a scsi-hd data disk, rescan the SCSI bus and check it in guest.
(qemu) device_add virtio-scsi-pci,bus=pci.0,addr=0x6,id=scsi1
(qemu)  __com.redhat_drive_add file=/mnt/my-data-disk.qcow2,format=qcow2,id=sluo-disk,cache=none,werror=stop,rerror=stop,aio=native
(qemu) device_add  scsi-hd,drive=sluo-disk,bus=scsi1.0,scsi-id=1,lun=1,id=sluo
guest]# echo "- - -" > /sys/class/scsi_host/host3/scan
guest]# ls /dev/sd*
/dev/sda  /dev/sda1  /dev/sda2  /dev/sdb
guest]# ls /sys/class/scsi_host/
host0  host1  host2  host3  <-----current SCSI controller is 'host3'
3.hot-remove the data disk and check it.
(qemu) device_del sluo
(qemu) device_del scsi1
guest]# ls /dev/sd*
/dev/sda  /dev/sda1  /dev/sda2
guest]# ls /sys/class/scsi_host/
host0  host1  host2
4.hot-plug the scsi-hd data disk again and rescan it as step 2.
(qemu) device_add virtio-scsi-pci,bus=pci.0,addr=0x6,id=scsi1
(qemu) __com.redhat_drive_add file=/mnt/my-data-disk.qcow2,format=qcow2,id=sluo-disk,cache=none,werror=stop,rerror=stop,aio=native
(qemu) device_add  scsi-hd,drive=sluo-disk,bus=scsi1.0,scsi-id=1,lun=1,id=sluo

Actual results:
after the step 4, the index of SCSI controller is not decremented after hot-plug scsi-hd device again.
guest]# echo "- - -" > /sys/class/scsi_host/host4/scan 
guest]# ls /dev/sd*
/dev/sda  /dev/sda1  /dev/sda2  /dev/sdb
guest]# ls /sys/class/scsi_host/
host0  host1  host2  host4  <-----it should be 'host3'

Expected results:
the index of SCSI controller can be decremented after hot-plug scsi-hd device again, hot-plug the SCSI data disk again should be in the current SCSI controller ('host3'), not in a new one ('host4').

Additional info:

Comment 2 Paolo Bonzini 2012-09-10 08:33:50 UTC
Not a bug, this is just how hosts are numbered in Linux.

Note that you do not need to delete and readd the virtio-scsi-pci device, only the scsi-hd device.  If you do so, the scsi-hd device will reside on host3.

Comment 3 Sibiao Luo 2012-09-10 10:54:04 UTC
(In reply to comment #2)
> Not a bug, this is just how hosts are numbered in Linux.
> 
> Note that you do not need to delete and readd the virtio-scsi-pci device,
> only the scsi-hd device. If you do so, the scsi-hd device will reside on
> host3.

yes, i test it as your indication. if do not delete the virtio-scsi-pci controller, noly remove the scsi-hd device, the index of the SCSI controller and partition table for the disk can be sequential.

But why cann't delete the virtio-scsi-pci controller? if hot-remove SCSI controller, then hot-add it again, the index of SCSI controller was not decremented after hot-plug it again, while the partition table can decrement to the right number. 

Paolo, could you help explain it here & thx.

Best Regards.
sluo


Note You need to log in before you can comment on or make changes to this bug.