[stgt] [PATCH] scripts/tgt-setup-lun small improvements

FUJITA Tomonori fujita.tomonori at lab.ntt.co.jp
Wed Sep 9 12:36:44 CEST 2009


On Tue, 08 Sep 2009 17:24:32 +0300
Alexander Nezhinsky <alexandern at Voltaire.COM> wrote:

> FUJITA Tomonori wrote:
> > BTW, if you change the show option format, can you please check
> > scripts/tgt-setup-lun too?
> 
> Here are some fixes that improve usability, including an option to
> set the backing-store type and transport (lld type).
> Did you mean something else?

I meant that changing the format breaks the scripts so a patch that
changes the format needs to update scripts.

For example, we need the following fix for your backing store type
patch.

BTW, you use aio backing store? The patch is fine but I guess that
everyone use the rdwr backing store.



diff --git a/scripts/tgt-admin b/scripts/tgt-admin
index 1d3e427..7ebeb24 100755
--- a/scripts/tgt-admin
+++ b/scripts/tgt-admin
@@ -791,8 +791,8 @@ sub show_target_info {
 		}
 	# Returns backing store
 	} elsif ($task eq "backing_stores") {
-		if ($tgtadm_output{$existing_target} =~ m/\s+Backing store: (?!No backing store)(.+)/ ) {
-			my @backing_stores = $tgtadm_output{$existing_target} =~ m{\s+Backing store: (?!No backing store\n)(.+)}g;
+		if ($tgtadm_output{$existing_target} =~ m/\s+Backing store path: (?!None)(.+)/ ) {
+			my @backing_stores = $tgtadm_output{$existing_target} =~ m{\s+Backing store path: (?!None\n)(.+)}g;
 			return @backing_stores;
 		}
 		return;
diff --git a/usr/target.c b/usr/target.c
index 9d979bf..14ab298 100644
--- a/usr/target.c
+++ b/usr/target.c
@@ -1601,7 +1601,8 @@ int tgt_target_show_all(char *buf, int rest)
 				 _TAB3 "Size: %s\n"
 				 _TAB3 "Online: %s\n"
 				 _TAB3 "Removable media: %s\n"
-				 _TAB3 "Backing store: %s\n",
+				 _TAB3 "Backing store type: %s\n"
+				 _TAB3 "Backing store path: %s\n",
 				 lu->lun,
   				 print_type(lu->attrs.device_type),
 				 lu->attrs.scsi_id,
@@ -1609,7 +1610,10 @@ int tgt_target_show_all(char *buf, int rest)
 				 print_disksize(lu->size),
 				 lu->attrs.online ? "Yes" : "No",
 				 lu->attrs.removable ? "Yes" : "No",
-				 lu->path ? : "No backing store");
+				 lu->bst ?
+					(lu->bst->bs_name ? : "Unknown") :
+					"None",
+				 lu->path ? : "None");
 
 		if (!strcmp(tgt_drivers[target->lid]->name, "iscsi")) {
 			int i, aid;
--
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