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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Chris!

Thanks for your support.

Chris Webb schrieb:
"Dr. Volker Jaenisch" <volker.jaenisch@xxxxxxxxx> writes:

We are coding a fencing daemon for the stgt target in python/zope3/grok.

We use stgt as part of a infrastructure management system too, and would
find more regular and parseable output invaluable. However, our system is
written in shell and C, so JSON would be as bad for us as the current 'human
readable' form: it's just not a very 'system-level' format choice.
JSON you may easily use from within C (And some dozens of other languages).
Please have a look at http://json.org where you will find to 5 JSON libraries for C.

But I agree that some other output views are needed. E.G. someone only likes to have the information "What initiators are currently connectet to target foo". Then he should get a simple list of the initiators.

killer:/home/volker/workspace/tgt-0.9.6/usr# ./tgtadm --lld iscsi --op
show --mode target
{'1':
   {'class' : 'target'
     'name' : 'de.inqbus.storage:vmigration'
How about just a straight list of

  de.inqbus.storage:vmigration iscsi ready
  [...]

for --op show-brief --mode target, which is a small change given where
you've stopped coding :-) and can be trivially parsed in any language
including C and shell, so it'll be more widely useful to administrators.
If you like to get the whole status picture as one big chunk there will have to be more than just a simple list since there are some 1:N relations which do not fit into one list. For instance we need the ACL information as well as the intitiators over all targets at once. This is only possible with a data structure that can handle hirachically organized data. Beside XML which may be an overkill I know only JSON as a common and standard following and easily parseable exchange format.

This is the actual state of coding

{'1':
   {'name' : 'de.inqbus.storage:vmigration',
   'Driver' :'iscsi',
   'State' : 'ready',
   'nexus' : {
       '1': {
           'Initiator': iqn.1993-08.org.debian:01:d48cfa3cdf83,
           'Connection': 0,
           'ip' : '127.0.0.1'
           }
       }
   'luns' : {
       '0': {
           'Type': controller,
           'SCSI ID': 'IET     00010000',
           'SCSI SN': 'beaf10',
           'Size': '0 MB',
           'Online': 'Yes',
           'Removable media': 'No',
           'Backing store': 'No backing store'
       }
       '1': {
           'Type': disk,
           'SCSI ID': 'IET     00010001',
           'SCSI SN': 'beaf11',
           'Size': '250059 MB',
           'Online': 'Yes',
           'Removable media': 'No',
           'Backing store': '/dev/sda'
       }
   }               <<< here we are now
   Account information:
   ACL information:
       127.0.0.0/24



Best Regards,

Volker

--
====================================================
  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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux