From: "Michael S. Tsirkin" <mst@redhat.com>
To: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: kwolf@redhat.com, aliguori@us.ibm.com, mark.burton@greensocs.com,
qemu-stable@nongnu.org, qemu-devel@nongnu.org,
pbonzini@redhat.com, fred.konrad@greensocs.com
Subject: Re: [Qemu-devel] [RESEND PATCH] virtio-scsi: forward scsibus for virtio-scsi-pci.
Date: Wed, 12 Jun 2013 14:52:06 +0300 [thread overview]
Message-ID: <20130612115206.GA29747@redhat.com> (raw)
In-Reply-To: <51B859C5.3080707@ozlabs.ru>
On Wed, Jun 12, 2013 at 09:21:41PM +1000, Alexey Kardashevskiy wrote:
> On 06/12/2013 07:16 PM, Michael S. Tsirkin wrote:
> > On Wed, Jun 12, 2013 at 07:04:48PM +1000, Alexey Kardashevskiy wrote:
> >> On 06/12/2013 07:03 PM, Michael S. Tsirkin wrote:
> >>> On Wed, Jun 12, 2013 at 08:15:17AM +0200, fred.konrad@greensocs.com wrote:
> >>>> From: KONRAD Frederic <fred.konrad@greensocs.com>
> >>>>
> >>>> 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: qemu-stable@nongnu.org
> >>>> Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> >>>> Reviewed-by: Andreas Färber <afaerber@suse.de>
> >>>> Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
> >>>
> >>> Acked-by: Michael S. Tsirkin <mst@redhat.com>
> >>>
> >>> 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".
> >>
> >
> > Then documentation in hmp-commands.hx is wrong, isn't it?
> > Add that to the list.
> >
> > if=none can't be actually used to hot-add
> > a disk to a device, can it? It creates a disc and assumes you will
> > use it by a device created later.
>
>
> Yep. I run QEMU with -device "virtio-scsi-pci,id=device0" and then do in
> console:
> drive_add auto file=virtimg/fc18guest,if=none,id=bar1
> device_add scsi-disk,bus=device0.0,drive=bar1
>
> Pretty hot plug :)
I see. So you pass the device id of a patent as a bus option?
So the real problem is that there's no documentation
and what is there in hmp-commands.hx, is wrong.
>
> >
> >
> >>
> >>>> ---
> >>>> 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);
> >>>> }
> >>>>
> >>>> /*
>
>
> --
> Alexey
next prev parent reply other threads:[~2013-06-12 11:51 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-12 6:15 [Qemu-devel] [RESEND PATCH] virtio-scsi: forward scsibus for virtio-scsi-pci fred.konrad
2013-06-12 9:03 ` Michael S. Tsirkin
2013-06-12 9:04 ` Alexey Kardashevskiy
2013-06-12 9:16 ` Michael S. Tsirkin
2013-06-12 11:21 ` Alexey Kardashevskiy
2013-06-12 11:52 ` Michael S. Tsirkin [this message]
2013-06-12 14:13 ` Alexey Kardashevskiy
2013-06-13 6:28 ` Frederic Konrad
2013-06-13 6:46 ` Alexey Kardashevskiy
2013-06-13 6:52 ` Frederic Konrad
2013-06-13 7:23 ` Michael S. Tsirkin
2013-06-13 7:34 ` Frederic Konrad
2013-06-13 7:59 ` Michael S. Tsirkin
2013-06-14 6:13 ` Frederic Konrad
2013-06-18 15:21 ` Michael S. Tsirkin
2013-06-20 8:26 ` Frederic Konrad
2013-06-20 8:37 ` Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130612115206.GA29747@redhat.com \
--to=mst@redhat.com \
--cc=aik@ozlabs.ru \
--cc=aliguori@us.ibm.com \
--cc=fred.konrad@greensocs.com \
--cc=kwolf@redhat.com \
--cc=mark.burton@greensocs.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).