From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:48349) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWjPp-0001yM-FV for qemu-devel@nongnu.org; Mon, 29 Apr 2013 04:26:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UWjPo-0003DQ-8M for qemu-devel@nongnu.org; Mon, 29 Apr 2013 04:26:29 -0400 Received: from mail-bk0-x234.google.com ([2a00:1450:4008:c01::234]:57432) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWjPo-0003DL-20 for qemu-devel@nongnu.org; Mon, 29 Apr 2013 04:26:28 -0400 Received: by mail-bk0-f52.google.com with SMTP id je9so1625086bkc.39 for ; Mon, 29 Apr 2013 01:26:27 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <517E2EA6.3000201@redhat.com> Date: Mon, 29 Apr 2013 10:26:14 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <3353B972624C8B49AB43F74428B4701D40AEC462@SZXEML552-MBX.china.huawei.com> In-Reply-To: <3353B972624C8B49AB43F74428B4701D40AEC462@SZXEML552-MBX.china.huawei.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] SCSI CD-ROM hotplug problem List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Liuji (Jeremy)" Cc: "Luohao (brian)" , "qemu-devel@nongnu.org" , Haofeng Il 25/04/2013 15:40, Liuji (Jeremy) ha scritto: > Hello, everyone > > I have a question about hotplug of cd-rom. > > version of qemu: Apr-22-2013 bb71623811686ce3c34ce724f073f5c5dd95f51b > > 1) start the vm: > qemu-kvm -enable-kvm -m 1024 -smp 2 -boot c -drive file=/home/vm/winxp.qcow2,if=none,id=drive0,format=qcow2 > -device virtio-blk-pci,scsi=off,drive=drive0,id=disk0 -monitor stdio -vnc 186.100.8.136:1 > -device lsi,id=scsi0,bus=pci.0 > > 2) use "drive_add" and "device_add" commands to hotplug a cd-rom: > (qemu) drive_add 0 file=/home/vm/aaa.iso,if=none,id=my-cdrom-drive,readonly=on,format=raw > (qemu) device_add scsi-cd,bus=scsi0.0,scsi-id=2,drive=my-cdrom-drive,id=my-cdrom > > 3) but I can't find the new cd-rom in the WindowXP vm. This is because Windows has not rescanned the SCSI bus. To force a rescan, open a command prompt, then type "diskpart" and then "rescan". > 4) and then, I use "pci_add" command to hotplug another cd-rom: > (qemu) pci_add auto storage file=/home/vm/bbb.iso,if=scsi,readonly=on,format=raw,media=cdrom This works because it adds an entirely new SCSI controller. > 5) I not only found the second cd-rom, but also found first cd-rom in the WindowXP vm. This is probably some oddity of Windows, which forces a rescan of all SCSI buses when a new controller is hot-plugged---or something like that. Paolo