From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jiri Pirko Subject: Re: [PATCH iproute2 2/2] devlink: add batch command support Date: Sun, 12 Nov 2017 09:21:32 +0100 Message-ID: <20171112082132.GF1993@nanopsycho> 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> <20171112081923.GV18825@mtr-leonro.local> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Ivan Vecera , netdev@vger.kernel.org, jiri@mellanox.com, arkadis@mellanox.com To: Leon Romanovsky Return-path: Received: from mail-wr0-f193.google.com ([209.85.128.193]:57311 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751573AbdKLIVe (ORCPT ); Sun, 12 Nov 2017 03:21:34 -0500 Received: by mail-wr0-f193.google.com with SMTP id q66so11861064wrb.13 for ; Sun, 12 Nov 2017 00:21:33 -0800 (PST) Content-Disposition: inline In-Reply-To: <20171112081923.GV18825@mtr-leonro.local> Sender: netdev-owner@vger.kernel.org List-ID: Sun, Nov 12, 2017 at 09:19:23AM CET, leon@kernel.org wrote: >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. Good. I think it is more than enough for now :) Thanks! > >Thanks > >>