diff options
author | mav <mav@FreeBSD.org> | 2014-10-20 07:41:37 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2014-10-20 07:41:37 +0000 |
commit | b61a1b57066a1970646c5aaa2208f8d6ef5f387d (patch) | |
tree | cf99588a2d23350c68eae8dc499b27aa55565441 /usr.sbin/ctladm | |
parent | db78e6d004fdce4ef766960eece656231d60e5b0 (diff) | |
download | FreeBSD-src-b61a1b57066a1970646c5aaa2208f8d6ef5f387d.zip FreeBSD-src-b61a1b57066a1970646c5aaa2208f8d6ef5f387d.tar.gz |
MFC r272911:
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; } |