From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60036) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBQ7y-0008WC-TZ for qemu-devel@nongnu.org; Tue, 22 Dec 2015 11:49:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aBQ7x-0007lo-Lz for qemu-devel@nongnu.org; Tue, 22 Dec 2015 11:49:34 -0500 References: <1450782389-17326-1-git-send-email-berrange@redhat.com> <1450782389-17326-4-git-send-email-berrange@redhat.com> From: Eric Blake Message-ID: <56797F12.1080403@redhat.com> Date: Tue, 22 Dec 2015 09:49:22 -0700 MIME-Version: 1.0 In-Reply-To: <1450782389-17326-4-git-send-email-berrange@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="EWc7xSCpRpHANbqh96KsghnAVQR9wujbt" Subject: Re: [Qemu-devel] [PATCH 3/7] qemu-nbd: add support for --object command line arg List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" , qemu-devel@nongnu.org Cc: Kevin Wolf , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, =?UTF-8?Q?Andreas_F=c3=a4rber?= This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --EWc7xSCpRpHANbqh96KsghnAVQR9wujbt Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 12/22/2015 04:06 AM, Daniel P. Berrange wrote: > Allow creation of user creatable object types with qemu-nbd > via a --object command line arg. This will be used to supply > passwords and/or encryption keys to the various block driver > backends via the recently added 'secret' object type. >=20 > # echo -n letmein > mypasswd.txt > # qemu-nbd --object secret,id=3Dsec0,file=3Dmypasswd.txt \ > ...other nbd args... Same comments as on 2/7. > @@ -45,6 +48,7 @@ > #define QEMU_NBD_OPT_AIO 2 > #define QEMU_NBD_OPT_DISCARD 3 > #define QEMU_NBD_OPT_DETECT_ZEROES 4 > +#define QEMU_NBD_OPT_OBJECT 5 Pre-existing, but these are unsafe; they conflict with actual byte values. As long as you are touching this, you should fix them to start at 256 (a separate patch wouldn't hurt). > +static int object_create(void *opaque, QemuOpts *opts, Error **errp) > +{ > + Error *err =3D NULL; > + char *type =3D NULL; > + char *id =3D NULL; > + void *dummy =3D NULL; > + OptsVisitor *ov; > + QDict *pdict; > + > + ov =3D opts_visitor_new(opts); > + pdict =3D qemu_opts_to_qdict(opts, NULL); > + > + visit_start_struct(opts_get_visitor(ov), &dummy, NULL, NULL, 0, &e= rr); Same comments as on 2/7. > @@ -417,6 +485,7 @@ int main(int argc, char **argv) > { "format", 1, NULL, 'f' }, > { "persistent", 0, NULL, 't' }, > { "verbose", 0, NULL, 'v' }, > + { "object", 1, NULL, QEMU_NBD_OPT_OBJECT }, > { NULL, 0, NULL, 0 } Pre-existing, but 0 and 1 are magic numbers; I prefer the symbolic names no_argument and required_argument (and optional_argument for 2). > +++ b/qemu-nbd.texi > @@ -14,6 +14,13 @@ Export QEMU disk image using NBD protocol. > @table @option > @item @var{filename} > is a disk image filename > +@item --object type,id=3D@var{id},...props... > + define a new instance of the @var{type} object class > + identified by @var{id}. See the @code{qemu(1)} manual > + page for full details of the properties supported. > + The only object type that it makes sense to define > + is the @code{secret} object, which is used to supply > + passwords and/or encryption keys. Awfully short line-wrapping; although it doesn't matter in the final generated docs. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --EWc7xSCpRpHANbqh96KsghnAVQR9wujbt Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWeX8SAAoJEKeha0olJ0NqC2YH/3GGmKyJHCsij/WjFGGZGJca 76xKjRKI7KxY03YI5pHFbLy2XsZ3WEur565aE0T5jBzJaXEXRlFL1qKuLJeiZxAd QvY7whhl6szlCixaxQ8a15sIi5sWN+XKcVYxIttSshDVndr49VOL6ssGZAsVF0iS 7HSfoCd0o9A5+Dkc6tulnp6Yl3bzOcN2ZuZZs8LJNDlugE55LjPqkYGZ6R454GA1 Xbqrgh92HM3ALBrYO6Jk+HyNe/CnOQes4CY/l6dxWb03xqknsES24frSQDwmEdin JR3VbsaeFp9sswc4j+6uPPACElwZey5oLrVpDEs9LcOUQ1WTGOS7XKMCo5kj/7c= =qtl4 -----END PGP SIGNATURE----- --EWc7xSCpRpHANbqh96KsghnAVQR9wujbt--