diff options
author | mav <mav@FreeBSD.org> | 2014-10-10 19:41:09 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2014-10-10 19:41:09 +0000 |
commit | 96aaf8224f413fc723e4d3f75271dda0fcf43049 (patch) | |
tree | d1a00a90a72ae29ed58f4ac2ec1e1c0ee65c9ea7 /usr.sbin/ctladm | |
parent | a9e5625f70e9f41a8bbface0fe26b4d84927695b (diff) | |
download | FreeBSD-src-96aaf8224f413fc723e4d3f75271dda0fcf43049.zip FreeBSD-src-96aaf8224f413fc723e4d3f75271dda0fcf43049.tar.gz |
Make ctld start even if some LUNs are unable to open backing storage.
Such LUNs will be visible to initiators, but return "not ready" status
on media access commands. If backing storage become available later,
`ctladm modify ...` or `service ctld reload` can trigger its reopen.
Diffstat (limited to 'usr.sbin/ctladm')
-rw-r--r-- | usr.sbin/ctladm/ctladm.c | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/usr.sbin/ctladm/ctladm.c b/usr.sbin/ctladm/ctladm.c index c362f5c..29fdd50 100644 --- a/usr.sbin/ctladm/ctladm.c +++ b/usr.sbin/ctladm/ctladm.c @@ -3174,14 +3174,18 @@ cctl_create_lun(int fd, int argc, char **argv, char *combinedopt) goto bailout; } - if (req.status == CTL_LUN_ERROR) { - warnx("%s: error returned from LUN creation request:\n%s", - __func__, req.error_str); + switch (req.status) { + case CTL_LUN_ERROR: + warnx("LUN creation error: %s", req.error_str); retval = 1; goto bailout; - } else if (req.status != CTL_LUN_OK) { - warnx("%s: unknown LUN creation request status %d", - __func__, req.status); + case CTL_LUN_WARNING: + warnx("LUN creation warning: %s", req.error_str); + break; + case CTL_LUN_OK: + break; + default: + warnx("unknown LUN creation status: %d", req.status); retval = 1; goto bailout; } @@ -3320,19 +3324,23 @@ cctl_rm_lun(int fd, int argc, char **argv, char *combinedopt) goto bailout; } - if (req.status == CTL_LUN_ERROR) { - warnx("%s: error returned from LUN removal request:\n%s", - __func__, req.error_str); + switch (req.status) { + case CTL_LUN_ERROR: + warnx("LUN removal error: %s", req.error_str); retval = 1; goto bailout; - } else if (req.status != CTL_LUN_OK) { - warnx("%s: unknown LUN removal request status %d", - __func__, req.status); + case CTL_LUN_WARNING: + warnx("LUN removal warning: %s", req.error_str); + break; + case CTL_LUN_OK: + break; + default: + warnx("unknown LUN removal status: %d", req.status); retval = 1; goto bailout; } - printf("LUN %d deleted successfully\n", lun_id); + printf("LUN %d removed successfully\n", lun_id); bailout: return (retval); @@ -3397,14 +3405,18 @@ cctl_modify_lun(int fd, int argc, char **argv, char *combinedopt) goto bailout; } - if (req.status == CTL_LUN_ERROR) { - warnx("%s: error returned from LUN modification request:\n%s", - __func__, req.error_str); + switch (req.status) { + case CTL_LUN_ERROR: + warnx("LUN modification error: %s", req.error_str); retval = 1; goto bailout; - } else if (req.status != CTL_LUN_OK) { - warnx("%s: unknown LUN modification request status %d", - __func__, req.status); + case CTL_LUN_WARNING: + warnx("LUN modification warning: %s", req.error_str); + break; + case CTL_LUN_OK: + break; + default: + warnx("unknown LUN modification status: %d", req.status); retval = 1; goto bailout; } |