[stgt] [PATCH] tgt-admin: avoid in-use and backing_store existence tests for rbd

Dan Mick dan.mick at inktank.com
Sat Oct 12 00:59:01 CEST 2013


Signed-off-by: Dan Mick <dan.mick at inktank.com>
---
 scripts/tgt-admin |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/scripts/tgt-admin b/scripts/tgt-admin
index d374172..55b7a55 100755
--- a/scripts/tgt-admin
+++ b/scripts/tgt-admin
@@ -479,14 +479,15 @@ sub add_backing_direct {
 	my $data_key_ref = $_[2];
 	my $direct_store = $_[3];
 	my $driver = $$target_options_ref{"driver"};
+	my $bstype = $$target_options_ref{"bs-type"};
 
 	# Is the device in use?
 	my $can_alloc = 1;
-	if ($force != 1 && $$target_options_ref{'allow-in-use'} ne "yes") {
+	if ($bstype != "rbd" && $force != 1 && $$target_options_ref{'allow-in-use'} ne "yes") {
 		$can_alloc = check_device($backing_store,$data_key_ref);
 	}
 
-	if (-e $backing_store && ! -d $backing_store && $can_alloc == 1) {
+	if ($can_alloc == 1 && $bstype == "rbd" || (-e $backing_store && ! -d $backing_store)) {
 		my @exec_commands;
 		my $device_type;
 		my $bs_type;
-- 
1.7.10.4

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