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

Dr. Volker Jaenisch volker.jaenisch at inqbus.de
Mon Jun 8 10:03:20 CEST 2009

Hi Tomonori!

FUJITA Tomonori schrieb:
> Supporting multiple formats sounds fine to me but I have one comment
> about how to implement it. I want:
> tgtd -> verbose an easy-processing-for-machine format -> tgtadm ->
> a format module (like human readable, brief human readable, XML, etc).
This should be easily achieved. I have so far only defined two new 

struct it_nexus {
        uint64_t itn_id;

        struct list_head cmd_hash_list[1 << HASH_ORDER];

        struct target *nexus_target;

        /* the list of i_t_nexus belonging to a target */
        struct list_head nexus_siblings;

        /* dirty hack for IBMVIO */
        int host_no;

        struct list_head it_nexus_lu_info_list;

        /* only used for show operation */
        char *info;

        char *addr;      << new
        long cid;           << new
        char *initiator; << new

and changed the preprocessing of an other

static int iscsi_tcp_show(struct iscsi_connection *conn, char *buf, int 
        total = snprintf(buf, rest, "%s", dst);  << removed "IPAddress:"

These changes suffice to have all the data in convertable form in the 
textual output section.
In the output section now there can be several routines that process the 
data into different formats.
In the Moment our code processes into the --target Form and in the JSON 
form alternatively.

But this is no more than a proove of concept. And it is definitivly no 
solution since there are deeply burried problems in the
actual design of rendering the status output. It is no good to render 
the status output at creation time of the data structure (as it is at 
the moment). If after creation there are changes to the data (done by 
will or by erroneous code) they actually do definitively NOT be 
reflected in the status output.

So it will be much better to render the status according to the actual 
data in the datastructure. This goal is NOT achived with
the changes I performed at the code! I just made the prerendered textual 
output from the creation state avaible to the datastructure that already 
is addressable via the target struct.

The basis for truly rendering the status from the actual state of the 
datastructure will be that the
whole datastructure is addressable from the target-struct:

target -> it_nexus -!> session -!> connection

The -!> indicate not avaible links. Maybe there will be some more links 
that are usefull  ...
Please correct me if I interprete your code wrong. I have limited 
knowledge in C programming and have only striven your code from a 10000 
feet perspective.

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