amazonlinux / amazon-linux-2023

Amazon Linux 2023
https://aws.amazon.com/linux/amazon-linux-2023/
Other
500 stars 37 forks source link

[Bug] - LVM json report format broken #698

Closed lukebakare closed 2 months ago

lukebakare commented 2 months ago

Describe the bug Adding the --reportformat json flag to lvm doesn't work.

To Reproduce Steps to reproduce the behavior: Run pvdisplay --reportformat json vgdisplay --reportformat json lsdisplay --reportformat json It outputs text in basic mode instead of json.

Expected behavior The command should provide json output.

elsaco commented 2 months ago

@lukebakare it does work, depending on the command:

[ec2-user] $ sudo pvs
  PV         VG Fmt  Attr PSize PFree
  /dev/sdb      lvm2 ---  8.00g 8.00g

[ec2-user] $ sudo pvs --reportformat json
  {
      "report": [
          {
              "pv": [
                  {"pv_name":"/dev/sdb", "vg_name":"", "pv_fmt":"lvm2", "pv_attr":"---", "pv_size":"8.00g", "pv_free":"8.00g"}
              ]
          }
      ]
  }
[ec2-user] $

Notice that pvdisplay doesn't have that option:

  pvdisplay
        [ -a|--all ]
        [ -c|--colon ]
        [ -C|--columns ]
        [ -m|--maps ]
        [ -o|--options String ]
        [ -S|--select String ]
        [ -s|--short ]
        [ -O|--sort String ]
        [    --aligned ]
        [    --binary ]
        [    --configreport log|vg|lv|pv|pvseg|seg ]
        [    --foreign ]
        [    --ignorelockingfailure ]
        [    --logonly ]
        [    --noheadings ]
        [    --nosuffix ]
        [    --readonly ]
        [    --separator String ]
        [    --shared ]
        [    --unbuffered ]
        [    --units [Number]r|R|h|H|b|B|s|S|k|K|m|M|g|G|t|T|p|P|e|E ]
        [ COMMON_OPTIONS ]
        [ PV|Tag ... ]
lukebakare commented 2 months ago

Okay thanks.

Running pvdisplay does seem to recognise it as an option though:

[root@ip-172-31-31-74 ~]# pvdisplay --reportformat pvdisplay: option '--reportformat' requires an argument Error during parsing of command line.