[stgt] Machine readable output for tgtadm --lld [driver] --op show --mode target

Dr. Volker Jaenisch volker.jaenisch at inqbus.de
Fri Jun 5 02:56:28 CEST 2009

Hi stgt People!

We are coding a fencing daemon for the stgt target in python/zope3/grok.
To achieve this we have to parse the output of

tgtadm --lld [driver] --op show --mode target

We have two ways solve this challange:
1) Parse the output that tgtadm delivers
2) Extend tgtadm with a machine readable output

1) We have already coded a parser for the output - but it is a quite
long and explicit code and and will be ugly to maintain.

2) So we like to tend to the second solution which gives us more
generically code

If there is any interest of the community and some support from the core
programmers we will code a

tgtadm --lld [driver] --op show-json --mode target

routine for tgt that delivers a hirarchie of JSON dictionaries sort of

killer:/home/volker/workspace/tgt-0.9.6/usr# ./tgtadm --lld iscsi --op
show --mode target
    {'class' : 'target'
      'name' : 'de.inqbus.storage:vmigration',
      'driver' :'iscsi',
      'state' : 'ready',
      'nexus' : {                          <<<< here we stopped coding :-)
    LUN information:
        LUN: 0
            Type: controller
            SCSI ID: IET     00010000
            SCSI SN: beaf10
            Size: 0 MB
            Online: Yes
            Removable media: No
            Backing store: No backing store
    Account information:
    ACL information:

This is only a short hack. We may find better structures to serialize
to. Please advice us on defining those structures.

The machine readable status output may be easily deserialized into
objects in all languages which support the JSON object notation.
E.G. Python, Java, PHP, Perl etc.

Best Regards


   inqbus it-consulting      +49 ( 341 )  5643800
   Dr.  Volker Jaenisch      http://www.inqbus.de
   Herloßsohnstr.    12      0 4 1 5 5    Leipzig
   N  O  T -  F Ä L L E      +49 ( 170 )  3113748

To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

More information about the stgt mailing list