From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56156) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRMKL-0002Vm-UR for qemu-devel@nongnu.org; Thu, 04 Feb 2016 11:00:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRMKF-0000Lg-SI for qemu-devel@nongnu.org; Thu, 04 Feb 2016 11:00:13 -0500 References: <1454417864-18774-1-git-send-email-berrange@redhat.com> <1454417864-18774-8-git-send-email-berrange@redhat.com> From: Eric Blake Message-ID: <56B3757C.5060401@redhat.com> Date: Thu, 4 Feb 2016 08:59:56 -0700 MIME-Version: 1.0 In-Reply-To: <1454417864-18774-8-git-send-email-berrange@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="R7tAD7W65mWxdEp7IoPO64RSW8xJdAxRt" Subject: Re: [Qemu-devel] [PATCH v5 07/10] qemu-img: allow specifying image as a set of options args 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) --R7tAD7W65mWxdEp7IoPO64RSW8xJdAxRt Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 02/02/2016 05:57 AM, Daniel P. Berrange wrote: > Currently qemu-img allows an image filename to be passed on the > command line, but unless using the JSON format, it does not have > a way to set any options except the format eg >=20 > qemu-img info https://127.0.0.1/images/centos7.iso >=20 > This adds a --image-opts arg that indicates that the positional > filename should be interpreted as a full option string, not > just a filename. >=20 > qemu-img info --image-opts driver=3Dhttps,url=3Dhttps://127.0.0.1/im= ages,sslverify=3Doff >=20 > This flag is mutually exclusive with the '-f' / '-F' flags. >=20 > Signed-off-by: Daniel P. Berrange > --- > qemu-img-cmds.hx | 44 +++++++-------- > qemu-img.c | 164 +++++++++++++++++++++++++++++++++++++++++++++++= -------- > qemu-img.texi | 6 ++ > 3 files changed, 170 insertions(+), 44 deletions(-) >=20 > +static BlockBackend *img_open_opts(const char *id, > + QemuOpts *opts, int flags) > +{ > + QDict *options; > + Error *local_err =3D NULL; > + char *file =3D NULL; > + BlockBackend *blk; > + file =3D g_strdup(qemu_opt_get(opts, "file")); > + qemu_opt_unset(opts, "file"); > + options =3D qemu_opts_to_qdict(opts, NULL); > + blk =3D blk_new_open(id, file, NULL, options, flags, &local_err); > + if (!blk) { > + error_report("Could not open '%s': %s", file ? file : "", > + error_get_pretty(local_err)); Markus' code has landed; this would be cleaner with error_reportf_err() from commit 8277d2aa. > @@ -2720,6 +2828,7 @@ static int img_rebase(int argc, char **argv) > if (optind !=3D argc - 1) { > error_exit("Expecting one image file name"); > } > + > if (!unsafe && !out_baseimg) { > error_exit("Must specify backing file (-b) or use unsafe mode = (-u)"); > } Spurious hunk? --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --R7tAD7W65mWxdEp7IoPO64RSW8xJdAxRt 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/ iQEcBAEBCAAGBQJWs3V8AAoJEKeha0olJ0NqTIQIAJE6j7nFEQPCfRfNMK48BXeS JLmt87pHf9wJDZKiVOwM5qBD8IbPW6brlxfRTBTlLq//9ub/EXu2vpCpnkYP6URQ 3WuIbNniROyBBNz65cPEqGZdYzF5LMgY4/sYvSkGPiL7GTJm75IVNHsCL8hlTjuS LgYANpbqzQ+9yjG8z/T5im+VIiPopV+nsySRAl9GrFp1CVOCbXe3cdVuZajeTcE1 L9AHUe6Nw+kT1Jst5wAj0yPW/iNubIJ/btYS297ZDhpxWhppyAZbHyTKaAZOCqx7 vcV5nPcOivo8PJRDH9MvlkXRIBmOy+uWnDIQch9zP8cQpvP9yU7RLxHbjnVNCq8= =BZtf -----END PGP SIGNATURE----- --R7tAD7W65mWxdEp7IoPO64RSW8xJdAxRt--