qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH, RFC] Allow adding empty SCSI controllers
@ 2009-12-15 17:30 Wolfgang Mauerer
  2009-12-16 11:54 ` [Qemu-devel] " Gerd Hoffmann
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Mauerer @ 2009-12-15 17:30 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: qemu-devel@nongnu.org

[-- Attachment #1: Type: text/plain, Size: 515 bytes --]

Hi Gerd,

in commit 5b684b5a56e81f6f, you introduced an explicit check
to prevent adding SCSI controllers without attached disks
to the system. Is there any other method to introduce
disk-less controllers into the system? If not, I'd suggest
to remove the check (patch is attached) -- there are some
situations when you want empty SCSI controllers, for instance for
the libvirt hotplug/remove framework currently under development
(see http://article.gmane.org/gmane.comp.emulators.libvirt/19043)

Thanks, Wolfgang

[-- Attachment #2: allow_empty_scsi_controllers.patch --]
[-- Type: text/x-patch, Size: 2146 bytes --]

commit c827742224b9a3a0d9dad0ce36c7e59c1a796ec1
Author: Wolfgang Mauerer <wolfgang.mauerer@siemens.com>
Date:   Tue Dec 15 18:06:19 2009 +0100

    Revert "hotplug: fix "pci_add storage if=scsi""
    
    This reverts commit 5b684b5a56e81f6f88234952fe8ed68010c36e19, and
    also includes some manual adaptions. There are some cases
    where addding an empty SCSI controller to a system makes
    sense, so we should not prohibit this option.
    
    Signed-off-by: Wolfgang Mauerer <wolfgang.mauerer@siemens.com>

diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c
index 8b8a80b..eee206b 100644
--- a/hw/lsi53c895a.c
+++ b/hw/lsi53c895a.c
@@ -2103,9 +2103,7 @@ static int lsi_scsi_init(PCIDevice *dev)
     lsi_soft_reset(s);
 
     scsi_bus_new(&s->bus, &dev->qdev, 1, LSI_MAX_DEVS, lsi_command_complete);
-    if (!dev->qdev.hotplugged) {
-        scsi_bus_legacy_handle_cmdline(&s->bus);
-    }
+    scsi_bus_legacy_handle_cmdline(&s->bus);
     vmstate_register(-1, &vmstate_lsi_scsi, s);
     return 0;
 }
diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c
index 6e42776..075be31 100644
--- a/hw/pci-hotplug.c
+++ b/hw/pci-hotplug.c
@@ -183,14 +183,10 @@ static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon,
 
     switch (type) {
     case IF_SCSI:
-        if (!dinfo) {
-            monitor_printf(mon, "scsi requires a backing file/device.\n");
-            return NULL;
-        }
         dev = pci_create(bus, devfn, "lsi53c895a");
         if (qdev_init(&dev->qdev) < 0)
             dev = NULL;
-        if (dev) {
+        if (dev && dinfo) {
             if (scsi_hot_add(&dev->qdev, dinfo, 0) != 0) {
                 qdev_unplug(&dev->qdev);
                 dev = NULL;
@@ -204,12 +200,15 @@ static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon,
         }
         dev = pci_create(bus, devfn, "virtio-blk-pci");
         qdev_prop_set_drive(&dev->qdev, "drive", dinfo);
-        if (qdev_init(&dev->qdev) < 0)
-            dev = NULL;
         break;
     default:
         dev = NULL;
     }
+    if (!dev)
+        return NULL;
+    if (dinfo && qdev_init(&dev->qdev) < 0)
+        return NULL;
+
     return dev;
 }
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Qemu-devel] Re: [PATCH, RFC] Allow adding empty SCSI controllers
  2009-12-15 17:30 [Qemu-devel] [PATCH, RFC] Allow adding empty SCSI controllers Wolfgang Mauerer
@ 2009-12-16 11:54 ` Gerd Hoffmann
  2009-12-16 14:34   ` Wolfgang Mauerer
  0 siblings, 1 reply; 3+ messages in thread
From: Gerd Hoffmann @ 2009-12-16 11:54 UTC (permalink / raw)
  To: Wolfgang Mauerer; +Cc: qemu-devel@nongnu.org

On 12/15/09 18:30, Wolfgang Mauerer wrote:
> Hi Gerd,
>
> in commit 5b684b5a56e81f6f, you introduced an explicit check
> to prevent adding SCSI controllers without attached disks
> to the system.

There was a patch from Daniel removing that check, isn't that one merged 
meanwhile?  Hmm, looks like it isn't.

Your patch does more than just killing the check, especially the chunk 
in lsi53c895a.c is clearly wrong.  I'd prefer Daniels patch being merged 
instead.

> Is there any other method to introduce
> disk-less controllers into the system?

device_add lsi,id=<hba-name>,addr=<slot.func>

adding disks then:

drive_add unused if=none,id=<disk-name>,file=...
device_add scsi-disk,drive=<disk-name>,bus=<hba-name>.0,scsi-id=<nr>

Note that this is the only way you can expect to work reliable with more 
than one scsi adapter being present in the system.

cheers,
   Gerd

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Qemu-devel] Re: [PATCH, RFC] Allow adding empty SCSI controllers
  2009-12-16 11:54 ` [Qemu-devel] " Gerd Hoffmann
@ 2009-12-16 14:34   ` Wolfgang Mauerer
  0 siblings, 0 replies; 3+ messages in thread
From: Wolfgang Mauerer @ 2009-12-16 14:34 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: qemu-devel@nongnu.org

Gerd Hoffmann wrote:
> On 12/15/09 18:30, Wolfgang Mauerer wrote:
>> Hi Gerd,
>>
>> in commit 5b684b5a56e81f6f, you introduced an explicit check
>> to prevent adding SCSI controllers without attached disks
>> to the system.
> 
> There was a patch from Daniel removing that check, isn't that one merged 
> meanwhile?  Hmm, looks like it isn't.
> 
> Your patch does more than just killing the check, especially the chunk 
> in lsi53c895a.c is clearly wrong.  I'd prefer Daniels patch being merged 
> instead.

after sending the patch, Daniel told me that he had already sent one,
and I don't care which one you merge as long as I can add empty
contollers again ;-)
> 
>> Is there any other method to introduce
>> disk-less controllers into the system?
> 
> device_add lsi,id=<hba-name>,addr=<slot.func>
> 
> adding disks then:
> 
> drive_add unused if=none,id=<disk-name>,file=...
> device_add scsi-disk,drive=<disk-name>,bus=<hba-name>.0,scsi-id=<nr>
> 
> Note that this is the only way you can expect to work reliable with more 
> than one scsi adapter being present in the system.

Thanks!

Cheers, Wolfgang

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-12-16 14:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-15 17:30 [Qemu-devel] [PATCH, RFC] Allow adding empty SCSI controllers Wolfgang Mauerer
2009-12-16 11:54 ` [Qemu-devel] " Gerd Hoffmann
2009-12-16 14:34   ` Wolfgang Mauerer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).