From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42942) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bw65L-0007Kl-P7 for qemu-devel@nongnu.org; Mon, 17 Oct 2016 07:28:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bw65K-0006DU-O2 for qemu-devel@nongnu.org; Mon, 17 Oct 2016 07:28:03 -0400 Date: Mon, 17 Oct 2016 13:27:49 +0200 From: Kevin Wolf Message-ID: <20161017112749.GE4821@noname.redhat.com> References: <1476522280-23211-1-git-send-email-ashijeetacharya@gmail.com> <1476522280-23211-3-git-send-email-ashijeetacharya@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="5QAgd0e35j3NYeGe" Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [v2 2/5] block/ssh: Add InetSocketAddress and accept it List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: Ashijeet Acharya , 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 --5QAgd0e35j3NYeGe Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Am 16.10.2016 um 00:30 hat Max Reitz geschrieben: > > +static InetSocketAddress *ssh_config(BDRVSSHState *s, QDict *options, > > + Error **errp) > > +{ > > + InetSocketAddress *inet =3D NULL; > > + QDict *addr =3D NULL; > > + QObject *crumpled_addr =3D NULL; > > + Visitor *iv =3D NULL; > > + Error *local_error =3D NULL; > > + > > + qdict_extract_subqdict(options, &addr, "server."); > > + if (!qdict_size(addr)) { > > + error_setg(errp, "SSH server address missing"); > > + goto out; > > + } > > + > > + crumpled_addr =3D qdict_crumple(addr, true, errp); > > + if (!crumpled_addr) { > > + goto out; > > + } > > + > > + iv =3D qobject_input_visitor_new_autocast(crumpled_addr, true, 1, = true); >=20 > In contrast to what Kevin said in v1, I think you do not want to use > autocast here. >=20 > 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". >=20 > 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. >=20 > 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 cas= e. 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 --5QAgd0e35j3NYeGe Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJYBLW1AAoJEH8JsnLIjy/W+UgP/jhhSyTzA+O7jawW/c/KTp7K 3vqFb7w0pDCeNqpx1Y+/gA9teVORWMEwN4dio0uHJBIuwzmGh+L4W/mYnqO7iBAI LEZPlvcN8LAWkKsSIBXwVMRiiLsK+vxebprwgrgVgwV352rSCkfgaEUlUTUXP31G xXaf7fbq2T4KQTeM6x3LufqvRdFUpDWTxa2lBXLKjta92SSzksyVV7b0AXKegn8h i2dG4sv1J60+nkyYmWcxsHFteuFcVfzn5d8dYgGiLnwIyF/lT8jxAzGpir4xDsob WpzAr0TeC1vnfB5wdW1A+ObE5UJ9fGzSYu9WmjXUuUYgY73rgEuWEHOljYqi0Y/4 y88OXfUBLWI68hj1EHEPhnNw3RF6yvexM69AIX/NxY/HN7Qxlosa+eIdsRLpmjWz df/7zzkv3Vu310JxYrqAVx9YK0zBv2z2V4O9P3gGATlybfqywO5xU6U6J+AQKl2H mFgxdZr/AuoHNH/SVWlmN5V9P1ItCpEOhUrHwMxlAya0Hk21OF04X4PBWP+D71Hz 7bgyWmGwGpqE5vtn3ERB4ppu3oiXOl45rSifIhMQ1WzQ2QCZbOIyI/7dOg8GYXOf xkrJQRMvsFxmYRN9zeLh6K5adIHKjtjOVrjOS3ZIwBybKw0kYJe2pAEg0+M/jAxO i2F55EwfPFAgrKT2ePkP =pVUU -----END PGP SIGNATURE----- --5QAgd0e35j3NYeGe--