Re: [PATCH] show backing store type

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

 



show backing store type

Signed-off-by: Doron Shoham <dorons@xxxxxxxxxxxx>
---
 scripts/tgt-admin |   23 +++++++++++++++--------
 usr/target.c      |    6 ++++--
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/scripts/tgt-admin b/scripts/tgt-admin
index 634066a..4c97c25 100755
--- a/scripts/tgt-admin
+++ b/scripts/tgt-admin
@@ -703,9 +703,9 @@ sub dump_config {
 			print "\tdriver $driver\n";
 		}
 
-		my @backing_stores = show_target_info($current_target, "backing_stores");
-		foreach my $backing_store (@backing_stores) {
-			print "\tbacking-store $backing_store\n";
+		my @backing_store_paths = show_target_info($current_target, "backing_store_paths");
+		foreach my $backing_store (@backing_store_paths) {
+			print "\tbacking-store $backing_store \n";
 		}
 
 		my @account_information = show_target_info($current_target, "account_information");
@@ -785,11 +785,18 @@ sub show_target_info {
 		if ($tgtadm_output{$existing_target} =~ m/\s+Driver: (.+)/ ) {
 			return $1;
 		}
-	# 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;
-			return @backing_stores;
+	# Returns backing store path
+	} elsif ($task eq "backing_store_paths") {
+		if ($tgtadm_output{$existing_target} =~ m/\s+Backing Store path: (?!None)(.+)/ ) {
+			my @backing_store_paths = $tgtadm_output{$existing_target} =~ m{\s+Backing Store path: (?!None\n)(.+)}g;
+			return @backing_store_paths;
+		}
+		return;
+	# Returns backing store type
+	} elsif ($task eq "backing_store_types") {
+		if ($tgtadm_output{$existing_target} =~ m/\s+Backing Store type: (?!N\/A)(.+)/ ) {
+			my @backing_store_types = $tgtadm_output{$existing_target} =~ m{\s+Backing Store type: (?!N/\A\n)(.+)}g;
+			return @backing_store_types;
 		}
 		return;
 	# Returns account information:
diff --git a/usr/target.c b/usr/target.c
index dc30c87..a6a1364 100644
--- a/usr/target.c
+++ b/usr/target.c
@@ -1589,7 +1589,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 path: %s\n"
+				 _TAB3 "Backing Store type: %s\n",
 				 lu->lun,
   				 print_type(lu->attrs.device_type),
 				 lu->attrs.scsi_id,
@@ -1597,7 +1598,8 @@ 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->path ? : "None",
+				 lu->path ? lu->bst->bs_name : "N/A");
 
 		if (!strcmp(tgt_drivers[target->lid]->name, "iscsi")) {
 			int i, aid;
-- 
1.5.3.8

--
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