diff options
author | mav <mav@FreeBSD.org> | 2014-07-15 17:06:10 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2014-07-15 17:06:10 +0000 |
commit | f1200cac157574450e2e32e4098cb478bc3e04db (patch) | |
tree | 43ff50bf3584751d0e7b2d11280d3e5a582f2f46 /usr.sbin | |
parent | b40b547aa1da9759435fa451a9927dadeeef00d2 (diff) | |
download | FreeBSD-src-f1200cac157574450e2e32e4098cb478bc3e04db.zip FreeBSD-src-f1200cac157574450e2e32e4098cb478bc3e04db.tar.gz |
MFC r268293:
Burry devid port method, which was a gross hack.
Instead make ports provide wanted port and target IDs, and LUNs provide
wanted LUN IDs. After that core Device ID VPD code only had to link all
of them together and add relative port and port group numbers.
LUN ID for iSCSI LUNs no longer created by CTL, but by ctld, and passed
to CTL as "scsiname" LUN option. This makes LUNs to report the same set
of IDs, independently from the port through which it is accessed, as
required by SCSI specifications.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ctladm/ctladm.8 | 2 | ||||
-rw-r--r-- | usr.sbin/ctld/kernel.c | 28 |
2 files changed, 15 insertions, 15 deletions
diff --git a/usr.sbin/ctladm/ctladm.8 b/usr.sbin/ctladm/ctladm.8 index 1699022..a832dbb 100644 --- a/usr.sbin/ctladm/ctladm.8 +++ b/usr.sbin/ctladm/ctladm.8 @@ -945,6 +945,8 @@ Specifies LUN vendor string up to 8 chars. Specifies LUN product string up to 16 chars. .It Va revision Specifies LUN revision string up to 4 chars. +.It Va scsiname +Specifies LUN SCSI name string. .It Va unmap Set to "on", enables UNMAP support for the LUN. .El diff --git a/usr.sbin/ctld/kernel.c b/usr.sbin/ctld/kernel.c index 0225691..3c958c8 100644 --- a/usr.sbin/ctld/kernel.c +++ b/usr.sbin/ctld/kernel.c @@ -113,7 +113,6 @@ struct cctl_lun { char *serial_number; char *device_id; char *cfiscsi_target; - char *cfiscsi_target_alias; int cfiscsi_lun; STAILQ_HEAD(,cctl_lun_nv) attr_list; STAILQ_ENTRY(cctl_lun) links; @@ -230,9 +229,6 @@ cctl_end_element(void *user_data, const char *name) } else if (strcmp(name, "cfiscsi_target") == 0) { cur_lun->cfiscsi_target = str; str = NULL; - } else if (strcmp(name, "cfiscsi_target_alias") == 0) { - cur_lun->cfiscsi_target_alias = str; - str = NULL; } else if (strcmp(name, "cfiscsi_lun") == 0) { cur_lun->cfiscsi_lun = strtoul(str, NULL, 0); } else if (strcmp(name, "lun") == 0) { @@ -640,17 +636,6 @@ kernel_lun_add(struct lun *lun) assert(lo != NULL); } - if (lun->l_target->t_alias != NULL) { - lo = lun_option_find(lun, "cfiscsi_target_alias"); - if (lo != NULL) { - lun_option_set(lo, lun->l_target->t_alias); - } else { - lo = lun_option_new(lun, "cfiscsi_target_alias", - lun->l_target->t_alias); - assert(lo != NULL); - } - } - asprintf(&tmp, "%d", lun->l_lun); if (tmp == NULL) log_errx(1, "asprintf"); @@ -664,6 +649,19 @@ kernel_lun_add(struct lun *lun) assert(lo != NULL); } + asprintf(&tmp, "%s,lun,%d", lun->l_target->t_name, lun->l_lun); + if (tmp == NULL) + log_errx(1, "asprintf"); + lo = lun_option_find(lun, "scsiname"); + if (lo != NULL) { + lun_option_set(lo, tmp); + free(tmp); + } else { + lo = lun_option_new(lun, "scsiname", tmp); + free(tmp); + assert(lo != NULL); + } + num_options = 0; TAILQ_FOREACH(lo, &lun->l_options, lo_next) num_options++; |