From mboxrd@z Thu Jan 1 00:00:00 1970 From: Leon Romanovsky Subject: Re: [PATCH iproute2 2/2] devlink: add batch command support Date: Sun, 12 Nov 2017 10:19:23 +0200 Message-ID: <20171112081923.GV18825@mtr-leonro.local> References: <20171110062014.2693-1-ivecera@redhat.com> <20171110062014.2693-3-ivecera@redhat.com> <20171110065727.GM18825@mtr-leonro.local> <3c672b8b-d3ca-1d50-c4e1-78a36aae6ed7@redhat.com> <20171110194735.GN18825@mtr-leonro.local> <20171112050642.GC1993@nanopsycho> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="cxpasEumJqkFnF/n" Cc: Ivan Vecera , netdev@vger.kernel.org, jiri@mellanox.com, arkadis@mellanox.com To: Jiri Pirko Return-path: Received: from mail.kernel.org ([198.145.29.99]:32880 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751573AbdKLIT0 (ORCPT ); Sun, 12 Nov 2017 03:19:26 -0500 Content-Disposition: inline In-Reply-To: <20171112050642.GC1993@nanopsycho> Sender: netdev-owner@vger.kernel.org List-ID: --cxpasEumJqkFnF/n Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Nov 12, 2017 at 06:06:42AM +0100, Jiri Pirko wrote: > Fri, Nov 10, 2017 at 08:47:35PM CET, leon@kernel.org wrote: > >On Fri, Nov 10, 2017 at 08:10:43AM +0100, Ivan Vecera wrote: > >> On 10.11.2017 07:57, Leon Romanovsky wrote: > >> > On Fri, Nov 10, 2017 at 07:20:14AM +0100, Ivan Vecera wrote: > >> >> The patch adds support to batch devlink commands. > >> >> > >> >> Cc: Jiri Pirko > >> >> Cc: Arkadi Sharshevsky > >> >> Signed-off-by: Ivan Vecera > >> >> --- > >> >> devlink/devlink.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++------- > >> >> man/man8/devlink.8 | 16 +++++++++++++ > >> >> 2 files changed, 78 insertions(+), 8 deletions(-) > >> >> > >> > > >> > <..> > >> > > >> >> diff --git a/man/man8/devlink.8 b/man/man8/devlink.8 > >> >> index a480766c..a975ef34 100644 > >> >> --- a/man/man8/devlink.8 > >> >> +++ b/man/man8/devlink.8 > >> >> @@ -12,6 +12,12 @@ devlink \- Devlink tool > >> >> .sp > >> >> > >> >> .ti -8 > >> >> +.B devlink > >> >> +.RB "[ " -force " ] " > >> >> +.BI "-batch " filename > >> >> +.sp > >> >> + > >> >> +.ti -8 > >> >> .IR OBJECT " := { " > >> >> .BR dev " | " port " | " monitor " }" > >> >> .sp > >> >> @@ -32,6 +38,16 @@ Print the version of the > >> >> utility and exit. > >> >> > >> >> .TP > >> >> +.BR "\-b", " \-batch " > >> >> +Read commands from provided file or standard input and invoke them. > >> >> +First failure will cause termination of devlink. > >> > > >> > It is worth to document the expected format of that file. > >> > And IMHO, it is better to have ability to load JSON fie which was > >> > generated by -j, instead of declaring new format/knob. > >> It's just a list of command-lines... like other utils (bridge,ip...) > > > >I'm implementing similar thing in RDMAtool (part of iproute2) and choose JSON > >approach, it is more user and script friendly. > > Leon, we should really do things in a way they are currently done and > used. Batching is implemented in "ip" for a long time. It makes perfect > sense to have one command line per line of the batch file. > > In contrary, json output sounds really odd in this case. With json, > there is no relation to ordinary ip command line params. Or do you want > to extend it to accept json as well? Yes, I wanted to add new field - "cmd", and whole logic to parse JSON to properly rebuild command from that with right parameters and device name. However, most probably, I'll never finish it near future, so in meanwhile I will provide the same batch format as Ivan proposed. Thanks > --cxpasEumJqkFnF/n Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEkhr/r4Op1/04yqaB5GN7iDZyWKcFAloIBAsACgkQ5GN7iDZy WKejQA/9F6LlZ8PG5k/ruB//g6E4b8lndt3DEiTZQklk0EYfbg45+8ImsveBgeWI 5W1jQ4/3oJDsNb7MQvNSNeMjBfJS3pO8ocXF9pf9cK1Kvy8C/TsyW6Lat93ZzydO +9ObzNvMXJ8Uj8m0Ew69nvreWtYRCbvx9B3m8lgt5WgJH+3S2UKUeU8RuaSr18+7 jD/jxnFDvJGUoRVXrrxGX7/pJ0Px5MQJG6dDukg3HBPHIZxauq9+8GaVvI5iANN8 kqC0S0I6yi+bAhTdE6y1O6FS1V4IbUPXYyRedMG/BO3EC/ESs8rEx4WEAkx/vKAD o7nIhpLm2ukm2yFKxR1BKe8s3YnlVFGdQZ9glhQtPfLByje7aCsRvX3fLpJ8GOD/ LrsMAAj+IuRMvvC1JBC58FeC0Y0NzaAVA8JY8Ew8z1OzkwBXekjnygSLlFUA2wl9 C408IdxnWbkfFpcT+NHCux4umg5VixH6ErmSMdTSO8ZQvHcxcnXr7c3kM2DJqSfv C0SpxY+HO5V0JWSyxQ0QhjdVx1GK/sH24moWNxLCJ5rhWltT47ovYQOEmw0dUhky K9GQuh+ndGmq5tnolMrlJcID2Ji3IUhE8x0gToYAiW3707LVVwFi2KXj63on84Vf AtoWXoJW8ZMCNHu3GifN/pH1z4tw8KZTPEV7Fva9Lwf+8dLc08E= =+4OE -----END PGP SIGNATURE----- --cxpasEumJqkFnF/n--