[stgt] [PATCH 1/3] Allow creating SBC devices without any media loaded.
Ronnie Sahlberg
ronniesahlberg at gmail.com
Sat Jan 28 04:28:42 CET 2012
When creating a device that is supposed to have a backing file
but no path was provided. Treat this as creating a removable device
without any media loaded.
Set removable=1 and make sure online=0 to indicate this is a
removable device and that all media access commands will fail with
check-condition/not ready/medium not present.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg at gmail.com>
---
usr/target.c | 6 +++---
usr/tgtadm.c | 3 ++-
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/usr/target.c b/usr/target.c
index dd4b358..fad6801 100644
--- a/usr/target.c
+++ b/usr/target.c
@@ -586,9 +586,9 @@ int tgt_device_create(int tid, int dev_type, uint64_t lun, char *params,
goto fail_lu_init;
}
- if (backing && !path && !lu->attrs.removable) {
- ret = TGTADM_INVALID_REQUEST;
- goto fail_bs_init;
+ if (backing && !path) {
+ lu->attrs.removable = 1;
+ lu->attrs.online = 0;
}
if (backing && path) {
diff --git a/usr/tgtadm.c b/usr/tgtadm.c
index 7dca0f8..26c82bc 100644
--- a/usr/tgtadm.c
+++ b/usr/tgtadm.c
@@ -779,7 +779,8 @@ int main(int argc, char **argv)
"allowed/supported\n", rc);
exit(EINVAL);
}
- if (!path && dev_type != TYPE_MMC) {
+ if (!path && dev_type != TYPE_MMC
+ && dev_type != TYPE_DISK) {
eprintf("'backing-store' option "
"is necessary\n");
exit(EINVAL);
--
1.7.3.1
--
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