diff options
author | mav <mav@FreeBSD.org> | 2014-07-05 19:30:20 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2014-07-05 19:30:20 +0000 |
commit | dd9568e89220188d1c2f0861713f1ec90ccaae02 (patch) | |
tree | d9d1bc31625bc0a1bcdb8fb67f74fe2df92960d4 /usr.sbin/ctld/kernel.c | |
parent | 40297ad93010083dc2b2edc6c393e280170d47fb (diff) | |
download | FreeBSD-src-dd9568e89220188d1c2f0861713f1ec90ccaae02.zip FreeBSD-src-dd9568e89220188d1c2f0861713f1ec90ccaae02.tar.gz |
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/ctld/kernel.c')
-rw-r--r-- | usr.sbin/ctld/kernel.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/usr.sbin/ctld/kernel.c b/usr.sbin/ctld/kernel.c index ecc43cf..dc07591 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++; |