Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No issue: sg_ses now supports JSON output #25

Open
doug-gilbert opened this issue Dec 5, 2022 · 4 comments
Open

No issue: sg_ses now supports JSON output #25

doug-gilbert opened this issue Dec 5, 2022 · 4 comments
Assignees

Comments

@doug-gilbert
Copy link

Over at https://github.com/doug-gilbert/sg3_utils I recently updated sg_ses to support JSON output. The default is still human readable output and associated with the JSON additions some of the human readable output has been tweaked. Over 2000 lines were added, and around 900 removed, so its a big change. You may like to test that the newer sg_ses does not trip up ses_report .
I would like some feedback on the JSON additions before releasing sg3_utils version 1.48 .

@thiell
Copy link
Member

thiell commented Dec 5, 2022

Hi @doug-gilbert! I really appreciate the heads-up and your interest in sasutils! I will test your latest version of sg_ses with JSON support and report back.

@thiell thiell self-assigned this Dec 5, 2022
@thiell
Copy link
Member

thiell commented Dec 16, 2022

Hi @doug-gilbert,

That seems to change a lot what does --page=ed display. This would mainly break our parsing for ses_report --status and--carbon. I can easily adapt but I can't seem to access various status anymore, I tried using legacy output or even the new json output.

As an example, with sg3_utils 1.47, I can access various status from each element. I am particularly interested in "status: OK"

$ sg_ses --page=ed --join /dev/sg2 | head -20
  SEAGATE   SP-3224A-E12EBD   5280
  Primary enclosure logical identifier (hex): 500c0ff064ddd23c
[0,-1]  Element type: Array device slot
  Enclosure Status:
    Predicted failure=0, Disabled=0, Swap=0, status: Unsupported
    OK=0, Reserved device=0, Hot spare=0, Cons check=0
    In crit array=0, In failed array=0, Rebuild/remap=0, R/R abort=0
    App client bypass A=0, Do not remove=0, Enc bypass A=0, Enc bypass B=0
    Ready to insert=0, RMV=0, Ident=0, Report=0
    App client bypass B=0, Fault sensed=0, Fault reqstd=0, Device off=0
    Bypassed A=0, Bypassed B=0, Dev bypassed A=0, Dev bypassed B=0
[0,0]  Element type: Array device slot
  Enclosure Status:
    Predicted failure=0, Disabled=0, Swap=0, status: OK
    OK=0, Reserved device=0, Hot spare=0, Cons check=0
    In crit array=0, In failed array=0, Rebuild/remap=0, R/R abort=0
    App client bypass A=0, Do not remove=0, Enc bypass A=0, Enc bypass B=0
    Ready to insert=0, RMV=0, Ident=0, Report=0
    App client bypass B=0, Fault sensed=0, Fault reqstd=0, Device off=0
    Bypassed A=0, Bypassed B=0, Dev bypassed A=0, Dev bypassed B=0

Full output: sg_ses_1.47.txt

With your latest version, even the "legacy" output is very different:

[root@fir-io1-s1 ~]# sg_ses --page=ed --join /dev/sg2 | head -20
  SEAGATE   SP-3224A-E12EBD   5280
Element descriptor diagnostic page:
  generation code: 0x0
  Element descriptor by type list:
    Element type: Array device slot, subenclosure id: 0 [ti=0]
      Overall descriptor: <empty>
      Element 0 descriptor: <empty>
      Element 1 descriptor: <empty>
      Element 2 descriptor: <empty>
      Element 3 descriptor: <empty>
      Element 4 descriptor: <empty>
      Element 5 descriptor: <empty>
      Element 6 descriptor: <empty>
      Element 7 descriptor: <empty>
      Element 8 descriptor: <empty>
      Element 9 descriptor: <empty>
      Element 10 descriptor: <empty>
      Element 11 descriptor: <empty>
      Element 12 descriptor: <empty>
      Element 13 descriptor: <empty>

Full output: sg_ses_latest_dec15.txt

If I can get the status and also various counters using json instead, I would be happy to support it in sasutils. It might even be easier for me. But right now, there is no status or counters in the output. See an example in the file attached below:

sg_ses_ed_json_dec15.txt

@doug-gilbert
Copy link
Author

Thanks for testing this. The action of the combination of '--page=ed --join' is not defined in my documentation (but '--page=aes --join' is). But I agree, this is a regression and it should be changed to do the same thing as the 1.47 release. That should appear soon on my github mirror as svn revision 990.
Many (most ?) SES implementations are broken at the margin. For example a Chenboro expander is putting 0100h in a two byte language code field (it should be 0000h which defaults to English, or something like 6465h ("de") for German) and the 01h byte gets into a JSON string which makes the string invalid. Sometimes even the spec is broken (see --eiioe). So making sg_ses resilient is a challenge. I'm currently trying to expand the utility of --inner-hex option to be able to drill down when something is awry.

@doug-gilbert
Copy link
Author

It took a while but revision 990 is now mirrored on github. Got rid of an internal flag called partial_join that was causing more problems than it was worth. Added a --no-config option mainly for debugging (my program and SES implementation that don't meet t10's expectations). In JSON now encoding control characters (apart from the 'usual 5') using \xhh notation rather than the Unicode-ish \unnnn that JSON specs want. \xhh in C like with the second backslash making it valid JSON.Various Linux utilities are adopting the \xhh form. And that notation shows that several SES implementations like to leave the ASCII characters in fields that should be space filled to the right.
So if you find time, could you re-test it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants