qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Max Reitz <mreitz@redhat.com>
Cc: Ashijeet Acharya <ashijeetacharya@gmail.com>,
	rjones@redhat.com, jcody@redhat.com, eblake@redhat.com,
	armbru@redhat.com, berrange@redhat.com, kraxel@redhat.com,
	pbonzini@redhat.com, qemu-devel@nongnu.org,
	qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [v2 2/5] block/ssh: Add InetSocketAddress and accept it
Date: Mon, 17 Oct 2016 13:27:49 +0200	[thread overview]
Message-ID: <20161017112749.GE4821@noname.redhat.com> (raw)
In-Reply-To: <e80a6a46-7ceb-9f6f-6a36-bb141e28fdd4@redhat.com>

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

Am 16.10.2016 um 00:30 hat Max Reitz geschrieben:
> > +static InetSocketAddress *ssh_config(BDRVSSHState *s, QDict *options,
> > +                                     Error **errp)
> > +{
> > +    InetSocketAddress *inet = NULL;
> > +    QDict *addr = NULL;
> > +    QObject *crumpled_addr = NULL;
> > +    Visitor *iv = NULL;
> > +    Error *local_error = NULL;
> > +
> > +    qdict_extract_subqdict(options, &addr, "server.");
> > +    if (!qdict_size(addr)) {
> > +        error_setg(errp, "SSH server address missing");
> > +        goto out;
> > +    }
> > +
> > +    crumpled_addr = qdict_crumple(addr, true, errp);
> > +    if (!crumpled_addr) {
> > +        goto out;
> > +    }
> > +
> > +    iv = qobject_input_visitor_new_autocast(crumpled_addr, true, 1, true);
> 
> In contrast to what Kevin said in v1, I think you do not want to use
> autocast here.
> 
> Or, to be more specific, it's difficult. The thing is that the autocast
> documentation says: "Any scalar values in the @obj input data structure
> should always be represented as strings".
> 
> So if you do use the autocast version, command line works great because
> from there everything comes as a string. But blockdev-add no longer
> works because from there everything comes with the correct type (and you
> cannot give it the wrong type).
> [...]
> In contrast, if you do not use the autocast version, blockdev-add will
> work just fine, but you can no longer specify non-string values from the
> command line.

Ah, right, I missed that. :-/

> I don't think this is your problem, though. There should be a way for
> the command line options to be converted to the correct types while we
> continue to use strict type-checking for blockdev-add.
> 
> Therefore, I think you'll have to sacrifice one or the other here. All
> of the non-string options are optional, so it won't be too bad in any case.

If we have to sacrifice one, then yes, blockdev-add is the one that must
work. The new -blockdev command line option will then automatically
work, too, so at least there will be a way to create such nodes.

The usual way to get around the type conflicts is going through a
QemuOpts. So maybe qemu_opts_from_dict() with a QemuOptionsList that
accepts anythign, and then qobject_input_visitor_new_opts() could be a
workaround to keep -drive working at the same time. It's kind of ugly,
though.

Kevin

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2016-10-17 11:28 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-15  9:04 [Qemu-devel] [v2 0/5] Allow blockdev-add for SSH Ashijeet Acharya
2016-10-15  9:04 ` [Qemu-devel] [v2 1/5] block/ssh: Add ssh_has_filename_options_conflict() Ashijeet Acharya
2016-10-15 21:28   ` Max Reitz
2016-10-15  9:04 ` [Qemu-devel] [v2 2/5] block/ssh: Add InetSocketAddress and accept it Ashijeet Acharya
2016-10-15 22:30   ` Max Reitz
2016-10-16  8:53     ` Ashijeet Acharya
2016-10-16  9:10       ` Ashijeet Acharya
2016-10-17 11:27     ` Kevin Wolf [this message]
2016-10-17 12:33     ` Ashijeet Acharya
2016-10-17 12:57       ` Kevin Wolf
2016-10-17 15:44         ` Ashijeet Acharya
2016-10-17 15:53           ` Kevin Wolf
2016-10-17 15:56             ` Ashijeet Acharya
2016-10-17 15:59           ` Eric Blake
2016-10-17 16:08             ` Ashijeet Acharya
2016-10-15  9:04 ` [Qemu-devel] [v2 3/5] block/ssh: Use inet_connect_saddr() to establish socket connection Ashijeet Acharya
2016-10-15 22:34   ` Max Reitz
2016-10-15  9:04 ` [Qemu-devel] [v2 4/5] block/ssh: Use InetSocketAddress options Ashijeet Acharya
2016-10-15 22:37   ` Max Reitz
2016-10-15  9:04 ` [Qemu-devel] [v2 5/5] qapi: allow blockdev-add for ssh Ashijeet Acharya
2016-10-15 22:43   ` Max Reitz
2016-10-15  9:25 ` [Qemu-devel] [v2 0/5] Allow blockdev-add for SSH no-reply
2016-10-17 11:29 ` Kevin Wolf
2016-10-17 12:33   ` Ashijeet Acharya

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=20161017112749.GE4821@noname.redhat.com \
    --to=kwolf@redhat.com \
    --cc=armbru@redhat.com \
    --cc=ashijeetacharya@gmail.com \
    --cc=berrange@redhat.com \
    --cc=eblake@redhat.com \
    --cc=jcody@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rjones@redhat.com \
    /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).