From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:45852) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlGTy-0007yW-4k for qemu-devel@nongnu.org; Thu, 12 Jan 2012 03:58:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RlGTt-0005IJ-Vz for qemu-devel@nongnu.org; Thu, 12 Jan 2012 03:58:02 -0500 Received: from e23smtp07.au.ibm.com ([202.81.31.140]:56379) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlGTt-0005Hx-D8 for qemu-devel@nongnu.org; Thu, 12 Jan 2012 03:57:57 -0500 Received: from /spool/local by e23smtp07.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 12 Jan 2012 08:54:18 +1000 Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q0C8rSPV2105500 for ; Thu, 12 Jan 2012 19:53:28 +1100 Received: from d23av04.au.ibm.com (loopback [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q0C8vpkR029185 for ; Thu, 12 Jan 2012 19:57:51 +1100 Received: from [127.0.0.1] (ibm-e673136c94d.cn.ibm.com [9.115.122.131] (may be forged)) by d23av04.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q0C8vnrY029121 for ; Thu, 12 Jan 2012 19:57:51 +1100 Message-ID: <4F0EA08B.2090402@linux.vnet.ibm.com> Date: Thu, 12 Jan 2012 16:57:47 +0800 From: Shu Ming MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] The reversion of hot adding a storage disk to Linux guest. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: QEMU Developers Hi, I am testing the hot plug of scsi disk to the KVM Linux guest with the following command. [root@kvm-rhel-01 bin]# ./virsh qemu-monitor-command RHEL6.1-C "pci_add auto storage file=/nfs/images/storage1-qcow2.img,if=scsi" OK domian 0, bus 0, slot 7, function 0 [root@kvm-rhel-01 bin]# lspci ... 00:05.0 SCSI storage controller: Red Hat, Inc Virtio block device 00:06.0 RAM memory: Red Hat, Inc Virtio memory balloon 00:07.0 SCSI storage controller: LSI Logic / Symbios Logic 53c895a <---new deviced added in the KVM guest: [root@RHEL6 ~]#cat /proc/scsi/scsi Attached devices: Host: scsi1 Channel: 00 Id: 00 Lun: 00 Vendor: QEMU Model: QEMU DVD-ROM Rev: 1.0. Type: CD-ROM Host: scsi2 Channel: 00 Id: 00 Lun: 00 Vendor: QEMU Model: QEMU HARDDISK Rev: 1.0. Type: Direct-Access ANSI SCSI revision: 05 <------new scsi disk attached The command successfully created a HBA device in the guest and also a scsi disk was enumerated under the HBA device. My next request is to hot detach the scsi disk from the HBA device, not necessarily detach the HBA device. That is to emulate the swapping out of the scsi disk from a physical machine and to release the image file in the backend. Because the scsi disk is not PCI device, "pci_del" command can not be used in this case. Can we have a way to send some commands to notice the HBA device to offline the scsi disk? By that way, HBA device can do some cleanup in their driver to fully offline the scsi disk. BTW: In the linux guest, we can do "echo "scsi remove-single-device 2 0 0 0" > /proc/scsi/scsi" to disable the disk. But I don't think it is fully removed, because you can bring it back again by "echo "scsi add-single-device 2 0 0 0" > /proc/scsi/scsi" -- Shu Ming IBM China Systems and Technology Laboratory