1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
lvm2/tools
Peter Rajnoha 2fa9916493 shell: also output error message about max number of args hit with JSON format
If using JSON format for lvm shell's output, the error message about
exceeding the maximum number of arguments was not reported on output if
this condition was ever hit.

This is because the JSON format (as well as any other future format)
requires extra formatting compared to "basic" format and so it also
requires extra calls when it comes to reporting. The report needs to
be added to a report group and then popped and put on output with
specialized "dm_report_group_output_and_pop_all".

This "output and pop" is normally executed after we execute the command
in the lvm shell. When we didn't get to the command exection at all because
some precondition was not met (like hitting the limit for the number of
arguments for the command here), we skipped this important call and
so there was no log report output.

Right now, it's only this exact error message for which we need to call
"output and pop" directly, all the other error messages are about
initializing and setting the log report itself which we can't report
obviously.

Before this patch:

  lvm> pvs 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
  lvm>

With this patch applied:

  lvm> pvs 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
  {
      "log": [
          {"log_seq_num":"1", "log_type":"error", "log_context":"shell", "log_object_type":"cmd", "log_object_name":"", "log_object_id":"", "log_object_group":"", "log_object_group_id":"", "log_message":"Too many arguments, sorry.", "log_errno":"-1", "log_ret_code":"0"}
      ]
  }

If there's any other error message in the future before we execute the
command itself, we also need to call the "output and pop" directly.
2022-08-08 15:46:52 +02:00
..
.exported_symbols generate liblvm2cmd exported symbols too 2010-06-25 18:23:10 +00:00
.gitignore tools: add generated headers to .gitignore 2017-03-10 13:13:41 +00:00
args.h man: space after size 2022-07-11 01:18:24 +02:00
cmdnames.h doc: change fsf address 2016-01-21 12:11:37 +01:00
command-lines.in pvdisplay: restore --reportformat option 2022-06-24 10:40:54 -05:00
command.c asan: fix some reports from libasan 2022-02-07 20:02:11 +01:00
command.h commands: use AUTOTYPE in definitions 2021-04-21 08:41:37 -05:00
commands.h devices file: limit warnings about devices file entries not found 2021-08-05 13:20:26 -05:00
dumpconfig.c lvmconfig: Add options to produce file preamble 2017-08-05 16:23:34 +01:00
errors.h tools: Introduce exit code EINIT_FAILED. 2017-07-26 23:18:03 +01:00
formats.c doc: change fsf address 2016-01-21 12:11:37 +01:00
license.inc pre-release 2017-03-28 16:11:35 +01:00
lv_props.h Allow dm-integrity to be used for raid images 2020-04-15 12:10:32 -05:00
lv_types.h Allow dm-integrity to be used for raid images 2020-04-15 12:10:32 -05:00
lvchange.c vdo: support --vdosettings 2022-05-03 19:09:52 +02:00
lvconvert_poll.c thin: ignore parallel merge while polling 2021-03-18 18:34:57 +01:00
lvconvert_poll.h build: Don't generate symlinks in include/ dir 2018-05-14 10:30:20 +01:00
lvconvert.c vdo: support --vdosettings 2022-05-03 19:09:52 +02:00
lvcreate.c vdo: enhance lvcreate validation 2022-07-11 01:18:24 +02:00
lvdisplay.c process_each_lv: add check_single_lv function 2017-02-13 08:20:10 -06:00
lvextend.c doc: change fsf address 2016-01-21 12:11:37 +01:00
lvm2cmd-static.c lvmcmdlib: lvm2_init_threaded 2020-10-20 22:22:52 +02:00
lvm2cmd.c lvmcmdlib: lvm2_init_threaded 2020-10-20 22:22:52 +02:00
lvm2cmd.h lvmcmdlib: lvm2_init_threaded 2020-10-20 22:22:52 +02:00
lvm2cmdline.h lvmcmdlib: lvm2_init_threaded 2020-10-20 22:22:52 +02:00
lvm-static.c doc: change fsf address 2016-01-21 12:11:37 +01:00
lvm.c shell: also output error message about max number of args hit with JSON format 2022-08-08 15:46:52 +02:00
lvmcmdlib.c cmdlib_lvm2_init: release cmd on failure path 2021-09-13 12:34:41 +02:00
lvmcmdline.c devices file: move clean up after command is run 2022-05-27 12:38:43 -05:00
lvmdevices.c lvmdevices: --deldev using device id 2022-04-06 12:51:34 -05:00
lvmdiskscan.c remove unused full filter 2018-12-04 14:06:46 -06:00
lvpoll.c build: Don't generate symlinks in include/ dir 2018-05-14 10:30:20 +01:00
lvreduce.c doc: change fsf address 2016-01-21 12:11:37 +01:00
lvremove.c process_each_lv: add check_single_lv function 2017-02-13 08:20:10 -06:00
lvrename.c toollib: make it possible to also process internal VGs, add 'include_internal' switch to process_each_vg fn 2016-06-20 11:33:42 +02:00
lvresize.c lvresize: allow mixing striped with errors or zero 2021-03-18 18:56:49 +01:00
lvscan.c Remove lvmetad 2018-07-11 11:26:42 -05:00
Makefile.in asan: fix some reports from libasan 2022-02-07 20:02:11 +01:00
polldaemon.c polldaemon: improve support for interruptions 2021-04-06 22:02:31 +02:00
pvchange.c cov: clean up pvid and vgid usage 2021-08-16 11:31:15 -05:00
pvck.c cov: make more obvious buffer is zero ended 2021-09-27 18:56:13 +02:00
pvcreate.c exit with error when --devicesfile name doesn't exist 2022-07-06 10:10:58 -05:00
pvdisplay.c add device hints to reduce scanning 2019-01-15 10:23:47 -06:00
pvmove_poll.c backup: automatically store data on vg_unlock 2021-06-09 14:56:13 +02:00
pvmove_poll.h doc: change fsf address 2016-01-21 12:11:37 +01:00
pvmove.c archiving: take archive automatically 2021-06-09 14:56:13 +02:00
pvremove.c exit with error when --devicesfile name doesn't exist 2022-07-06 10:10:58 -05:00
pvresize.c exported vg handling 2019-06-25 15:39:08 -05:00
pvscan.c exit with error when --devicesfile name doesn't exist 2022-07-06 10:10:58 -05:00
reporter.c cleanup: use dm_list_empty 2021-10-06 15:43:31 +02:00
segtypes.c doc: change fsf address 2016-01-21 12:11:37 +01:00
stub.h Remove vgconvert 2018-06-13 14:14:03 -05:00
tags.c doc: change fsf address 2016-01-21 12:11:37 +01:00
tool.h configure: avoid repeative inclusion of configure.h 2018-12-21 19:19:50 +01:00
toollib.c vdo: suffle code for better error path handling 2022-07-11 01:18:24 +02:00
toollib.h vdo: support --vdosettings 2022-05-03 19:09:52 +02:00
tools.h move code from pvscan.c to online.c 2021-11-04 11:09:29 -05:00
vals.h tools: correct units description 2021-04-19 14:40:14 +02:00
vgcfgbackup.c improve reading and repairing vg metadata 2019-06-07 15:54:04 -05:00
vgcfgrestore.c exit with error when --devicesfile name doesn't exist 2022-07-06 10:10:58 -05:00
vgchange.c vgchange monitor: don't use udev info 2022-03-25 14:13:56 -05:00
vgck.c vgck: fix updatemetadata writing different descriptions 2019-10-11 12:57:32 -05:00
vgcreate.c exit with error when --devicesfile name doesn't exist 2022-07-06 10:10:58 -05:00
vgdisplay.c tidy: Add missing underscores to statics. 2017-10-18 15:58:13 +01:00
vgexport.c backup: automatically store data on vg_unlock 2021-06-09 14:56:13 +02:00
vgextend.c exit with error when --devicesfile name doesn't exist 2022-07-06 10:10:58 -05:00
vgimport.c backup: automatically store data on vg_unlock 2021-06-09 14:56:13 +02:00
vgimportclone.c change messages about filtered devices 2022-04-01 13:38:21 -05:00
vgimportdevices.c vgimportdevices: fix incorrect deviceidtype usage 2022-04-06 12:20:26 -05:00
vgmerge.c exit with error when --devicesfile name doesn't exist 2022-07-06 10:10:58 -05:00
vgmknodes.c process_each_lv: add check_single_lv function 2017-02-13 08:20:10 -06:00
vgreduce.c backup: automatically store data on vg_unlock 2021-06-09 14:56:13 +02:00
vgremove.c vgremove: remove forgotten pmspare 2021-07-21 13:19:51 +02:00
vgrename.c cov: clean up pvid and vgid usage 2021-08-16 11:31:15 -05:00
vgscan.c locking: unify global lock for flock and lockd 2019-04-29 13:01:05 -05:00
vgsplit.c exit with error when --devicesfile name doesn't exist 2022-07-06 10:10:58 -05:00