[LU-16491] "lfs getdirstripe -y" doesn't print YAML formatted output Created: 18/Jan/23  Updated: 22/Mar/23  Resolved: 22/Mar/23

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.16.0, Lustre 2.12.9
Fix Version/s: Lustre 2.16.0

Type: Bug Priority: Minor
Reporter: Andreas Dilger Assignee: Tim Day
Resolution: Fixed Votes: 0
Labels: easy

Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

It appears that the "lfs getdirstripe -y <striped_dir>" command does not print YAML-formatted output (the output is the same regardless of whether -y is used or not).

Unsurprisingly, there is also no subtest that is using "lfs getdirstripe -y", which is why nobody noticed if it was broken and/or even worked in the first place.

Looking at lmv_dump_user_lmm(), it appears that the "LDF_YAML" flag is being checked, which was in turn set in llapi_lov_dump_user_lmm() from "fp_yaml", but this appears to be ignored in the stripe-printing loop:

        if (verbose & VERBOSE_OBJID && lum->lum_magic != LMV_USER_MAGIC) {
                llapi_printf(LLAPI_MSG_NORMAL, "%s", separator);
                if (lum->lum_stripe_count > 0)
                        llapi_printf(LLAPI_MSG_NORMAL,
                                     "mdtidx\t\t FID[seq:oid:ver]\n");
                for (i = 0; i < lum->lum_stripe_count; i++) {
                        int idx = objects[i].lum_mds;
                        struct lu_fid *fid = &objects[i].lum_fid;

                        if ((obdindex == OBD_NOT_FOUND) || (obdindex == idx))
                                llapi_printf(LLAPI_MSG_NORMAL,
                                             "%6u\t\t "DFID"\t\t%s\n",
                                            idx, PFID(fid),
                                            obdindex == idx ? " *" : "");
                }
        }

It would also make sense to print the lmv_pool line in the header block before the dirstripes, should there ever be an MDT pool added.

The behavior of the "v|-verbose" flag is also puzzling, since using it will print nothing when "lfs getdirstripe" is run.



 Comments   
Comment by Gerrit Updater [ 05/Mar/23 ]

"Timothy Day <timday@amazon.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/50208
Subject: LU-16491 lfs: test getdirstripe YAML
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: cf3a37ba5d39b0c0e9305b3186c834e3ff5d8170

Comment by Gerrit Updater [ 21/Mar/23 ]

"Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/50208/
Subject: LU-16491 lfs: test getdirstripe YAML
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 25a53cdc80a03df42aa884cf85dfc725876994f4

Comment by Peter Jones [ 22/Mar/23 ]

Landed for 2.16

Generated at Sat Feb 10 03:27:28 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.