@@ -76,6 +76,7 @@ static void container_free_volumes(struct hyper_container *c)
7676 free (c -> vols [i ].device );
7777 free (c -> vols [i ].mountpoint );
7878 free (c -> vols [i ].fstype );
79+ free (c -> vols [i ].scsiaddr );
7980 }
8081 free (c -> vols );
8182 c -> vols = NULL ;
@@ -115,6 +116,9 @@ static int container_parse_volumes(struct hyper_container *c, char *json, jsmnto
115116 c -> vols [j ].device =
116117 strdup (json_token_str (json , & toks [++ i ]));
117118 fprintf (stdout , "volume %d device %s\n" , j , c -> vols [j ].device );
119+ } else if (json_token_streq (json , & toks [i ], "addr" )) {
120+ c -> vols [j ].scsiaddr = strdup (json_token_str (json , & toks [++ i ]));
121+ fprintf (stdout , "volume %d scsi id %s\n" , j , c -> vols [j ].scsiaddr );
118122 } else if (json_token_streq (json , & toks [i ], "mount" )) {
119123 c -> vols [j ].mountpoint =
120124 strdup (json_token_str (json , & toks [++ i ]));
@@ -321,6 +325,9 @@ void hyper_free_container(struct hyper_container *c)
321325 free (c -> image );
322326 c -> image = NULL ;
323327
328+ free (c -> scsiaddr );
329+ c -> scsiaddr = NULL ;
330+
324331 free (c -> workdir );
325332 c -> workdir = NULL ;
326333
@@ -403,6 +410,10 @@ static int hyper_parse_container(struct hyper_pod *pod, struct hyper_container *
403410 c -> image = strdup (json_token_str (json , & toks [++ i ]));
404411 fprintf (stdout , "container image %s\n" , c -> image );
405412 i ++ ;
413+ } else if (json_token_streq (json , t , "addr" ) && t -> size == 1 ) {
414+ c -> scsiaddr = strdup (json_token_str (json , & toks [++ i ]));
415+ fprintf (stdout , "container image scsi id %s\n" , c -> scsiaddr );
416+ i ++ ;
406417 } else if (json_token_streq (json , t , "fstype" ) && t -> size == 1 ) {
407418 c -> fstype = strdup (json_token_str (json , & toks [++ i ]));
408419 fprintf (stdout , "container fstype %s\n" , c -> fstype );
@@ -1098,6 +1109,8 @@ int hyper_parse_read_file(struct hyper_reader *reader, char *json, int length)
10981109 return ret ;
10991110fail :
11001111 free (reader -> id );
1112+ reader -> id = NULL ;
11011113 free (reader -> file );
1114+ reader -> file = NULL ;
11021115 goto out ;
11031116}
0 commit comments