[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [v2 2/5] block/ssh: Add InetSocketAddress and accept it
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [v2 2/5] block/ssh: Add InetSocketAddress and accept it |
Date: |
Mon, 17 Oct 2016 13:27:49 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
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
pgpWeVfMVJkg6.pgp
Description: PGP signature
- [Qemu-devel] [v2 0/5] Allow blockdev-add for SSH, Ashijeet Acharya, 2016/10/15
- [Qemu-devel] [v2 1/5] block/ssh: Add ssh_has_filename_options_conflict(), Ashijeet Acharya, 2016/10/15
- [Qemu-devel] [v2 2/5] block/ssh: Add InetSocketAddress and accept it, Ashijeet Acharya, 2016/10/15
- Re: [Qemu-devel] [v2 2/5] block/ssh: Add InetSocketAddress and accept it, Max Reitz, 2016/10/15
- Re: [Qemu-devel] [v2 2/5] block/ssh: Add InetSocketAddress and accept it,
Kevin Wolf <=
- Re: [Qemu-devel] [v2 2/5] block/ssh: Add InetSocketAddress and accept it, Ashijeet Acharya, 2016/10/17
- Re: [Qemu-devel] [v2 2/5] block/ssh: Add InetSocketAddress and accept it, Kevin Wolf, 2016/10/17
- Re: [Qemu-devel] [v2 2/5] block/ssh: Add InetSocketAddress and accept it, Ashijeet Acharya, 2016/10/17
- Re: [Qemu-devel] [v2 2/5] block/ssh: Add InetSocketAddress and accept it, Kevin Wolf, 2016/10/17
- Re: [Qemu-devel] [v2 2/5] block/ssh: Add InetSocketAddress and accept it, Ashijeet Acharya, 2016/10/17
- Re: [Qemu-devel] [v2 2/5] block/ssh: Add InetSocketAddress and accept it, Eric Blake, 2016/10/17
- Re: [Qemu-devel] [v2 2/5] block/ssh: Add InetSocketAddress and accept it, Ashijeet Acharya, 2016/10/17
[Qemu-devel] [v2 3/5] block/ssh: Use inet_connect_saddr() to establish socket connection, Ashijeet Acharya, 2016/10/15
[Qemu-devel] [v2 4/5] block/ssh: Use InetSocketAddress options, Ashijeet Acharya, 2016/10/15