qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RESEND PATCH] virtio-scsi: forward scsibus for virtio-


From: Alexey Kardashevskiy
Subject: Re: [Qemu-devel] [RESEND PATCH] virtio-scsi: forward scsibus for virtio-scsi-pci.
Date: Wed, 12 Jun 2013 19:04:48 +1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6

On 06/12/2013 07:03 PM, Michael S. Tsirkin wrote:
> On Wed, Jun 12, 2013 at 08:15:17AM +0200, address@hidden wrote:
>> From: KONRAD Frederic <address@hidden>
>>
>> This fix a bug with scsi hotplug on virtio-scsi-pci:
>>
>> As virtio-scsi-pci doesn't have any scsi bus, we need to forward scsi-hot-add
>> to the virtio-scsi-device plugged on the virtio-bus.
>>
>> Cc: address@hidden
>> Reported-by: Alexey Kardashevskiy <address@hidden>
>> Reviewed-by: Andreas Färber <address@hidden>
>> Signed-off-by: KONRAD Frederic <address@hidden>
> 
> Acked-by: Michael S. Tsirkin <address@hidden>
> 
> Note: we don't seem to have any decent way to
> add disks to devices: no QMP interface,
> pci address is required instead of using an id ...
> 
> Anyone can be bothered to fix this?


Actually PCI address is not always required, this field (we are talking
about "drive_add"?) is ignored when "if=none".



>> ---
>>  hw/pci/pci-hotplug.c | 19 +++++++++++++++++--
>>  1 file changed, 17 insertions(+), 2 deletions(-)
>>
>> diff --git a/hw/pci/pci-hotplug.c b/hw/pci/pci-hotplug.c
>> index 12287d1..c708752 100644
>> --- a/hw/pci/pci-hotplug.c
>> +++ b/hw/pci/pci-hotplug.c
>> @@ -30,6 +30,8 @@
>>  #include "monitor/monitor.h"
>>  #include "hw/scsi/scsi.h"
>>  #include "hw/virtio/virtio-blk.h"
>> +#include "hw/virtio/virtio-scsi.h"
>> +#include "hw/virtio/virtio-pci.h"
>>  #include "qemu/config-file.h"
>>  #include "sysemu/blockdev.h"
>>  #include "qapi/error.h"
>> @@ -79,13 +81,26 @@ static int scsi_hot_add(Monitor *mon, DeviceState 
>> *adapter,
>>  {
>>      SCSIBus *scsibus;
>>      SCSIDevice *scsidev;
>> +    VirtIOPCIProxy *virtio_proxy;
>>  
>>      scsibus = (SCSIBus *)
>>          object_dynamic_cast(OBJECT(QLIST_FIRST(&adapter->child_bus)),
>>                              TYPE_SCSI_BUS);
>>      if (!scsibus) {
>> -    error_report("Device is not a SCSI adapter");
>> -    return -1;
>> +        /*
>> +         * Check if the adapter is a virtio-scsi-pci, and forward 
>> scsi_hot_add
>> +         * to the virtio-scsi-device.
>> +         */
>> +        if (!object_dynamic_cast(OBJECT(adapter), TYPE_VIRTIO_SCSI_PCI)) {
>> +            error_report("Device is not a SCSI adapter");
>> +            return -1;
>> +        }
>> +        virtio_proxy = VIRTIO_PCI(adapter);
>> +        adapter = DEVICE(virtio_proxy->bus.vdev);
>> +        scsibus = (SCSIBus *)
>> +                  
>> object_dynamic_cast(OBJECT(QLIST_FIRST(&adapter->child_bus)),
>> +                            TYPE_SCSI_BUS);
>> +        assert(scsibus);
>>      }
>>  
>>      /*
>> -- 
>> 1.8.1.4


-- 
Alexey



reply via email to

[Prev in Thread] Current Thread [Next in Thread]