From: Anthony Liguori <anthony@codemonkey.ws>
To: Alexander Graf <agraf@suse.de>
Cc: Markus Armbruster <armbru@redhat.com>,
Luiz Capitulino <lcapitulino@redhat.com>,
qemu-devel List <qemu-devel@nongnu.org>,
Aurelien Jarno <aurelien@aurel32.net>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 4/5] Add generic drive hotplugging
Date: Mon, 23 Aug 2010 17:21:33 -0500 [thread overview]
Message-ID: <4C72F46D.5040606@codemonkey.ws> (raw)
In-Reply-To: <1282600951-30803-5-git-send-email-agraf@suse.de>
On 08/23/2010 05:02 PM, Alexander Graf wrote:
> The monitor command for hotplugging is in i386 specific code. This is just
> plain wrong, as S390 just learned how to do hotplugging too and needs to
> get drives for that.
>
> So let's add a generic copy to generic code that handles drive_add in a
> way that doesn't have pci dependencies.
>
> I'm not fully happy with the patch as is. IMHO there should only be a
> single target agnostic drive_hot_add function available. How we could
> potentially fit IF_SCSI in there I don't know though.
>
> Signed-off-by: Alexander Graf<agraf@suse.de>
>
I think you really want device_add plus a blockdev_add.
Regards,
Anthony Liguori
> ---
> hw/device-hotplug.c | 43 +++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 43 insertions(+), 0 deletions(-)
>
> diff --git a/hw/device-hotplug.c b/hw/device-hotplug.c
> index c1a9a56..f311c7f 100644
> --- a/hw/device-hotplug.c
> +++ b/hw/device-hotplug.c
> @@ -25,6 +25,9 @@
> #include "hw.h"
> #include "boards.h"
> #include "net.h"
> +#include "qemu-config.h"
> +#include "sysemu.h"
> +#include "monitor.h"
>
> DriveInfo *add_init_drive(const char *optstr)
> {
> @@ -44,3 +47,43 @@ DriveInfo *add_init_drive(const char *optstr)
>
> return dinfo;
> }
> +
> +#if !defined(TARGET_I386)
> +
> +/*
> + * This version of drive_hot_add does not know anything about PCI specifics.
> + * It is used as fallback on architectures that don't implement pci-hotplug.
> + */
> +void drive_hot_add(Monitor *mon, const QDict *qdict)
> +{
> + int type;
> + DriveInfo *dinfo = NULL;
> + const char *opts = qdict_get_str(qdict, "opts");
> +
> + dinfo = add_init_drive(opts);
> + if (!dinfo)
> + goto err;
> + if (dinfo->devaddr) {
> + monitor_printf(mon, "Parameter addr not supported\n");
> + goto err;
> + }
> + type = dinfo->type;
> +
> + switch (type) {
> + case IF_NONE:
> + monitor_printf(mon, "OK\n");
> + break;
> + default:
> + monitor_printf(mon, "Can't hot-add drive to type %d\n", type);
> + goto err;
> + }
> + return;
> +
> +err:
> + if (dinfo)
> + drive_uninit(dinfo);
> + return;
> +}
> +
> +#endif /* !defined(TARGET_I386) */
> +
>
next prev parent reply other threads:[~2010-08-23 22:21 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-23 22:02 [Qemu-devel] [PATCH 0/5] Add S390 hotplug add support Alexander Graf
2010-08-23 22:02 ` [Qemu-devel] [PATCH 1/5] [S390] Add hotplug support Alexander Graf
2010-08-23 22:02 ` [Qemu-devel] [PATCH 2/5] [S390] Increase amount of virtio pages Alexander Graf
2010-08-23 22:02 ` [Qemu-devel] [PATCH 3/5] Compile device-hotplug on all targets Alexander Graf
2010-08-23 22:02 ` [Qemu-devel] [PATCH 4/5] Add generic drive hotplugging Alexander Graf
2010-08-23 22:21 ` Anthony Liguori [this message]
2010-08-23 22:23 ` Alexander Graf
2010-08-23 22:45 ` Alexander Graf
2010-08-23 22:50 ` Anthony Liguori
2010-08-23 22:54 ` Alexander Graf
2010-08-24 9:31 ` Daniel P. Berrange
2010-08-24 10:45 ` Alexander Graf
2010-08-24 10:51 ` Daniel P. Berrange
2010-08-24 13:40 ` Alexander Graf
2010-08-24 13:44 ` Daniel P. Berrange
2010-08-24 13:46 ` Alexander Graf
2010-08-24 13:51 ` Daniel P. Berrange
2010-08-27 9:27 ` Markus Armbruster
2010-08-24 18:35 ` Anthony Liguori
2010-08-24 21:53 ` Alexander Graf
2010-08-27 9:53 ` Markus Armbruster
2010-08-27 9:56 ` Alexander Graf
2010-08-23 22:02 ` [Qemu-devel] [PATCH 5/5] Expose drive_add on all architectures Alexander Graf
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=4C72F46D.5040606@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=agraf@suse.de \
--cc=armbru@redhat.com \
--cc=aurelien@aurel32.net \
--cc=kraxel@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=qemu-devel@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).