summaryrefslogtreecommitdiffstats
path: root/sys/geom
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2013-06-12 13:36:20 +0000
committermav <mav@FreeBSD.org>2013-06-12 13:36:20 +0000
commitd745b9017bc6a38ecf70c8846a67ab8072fd64c4 (patch)
treed09e17bbf840c32b25e49d56a97f5305525efeeb /sys/geom
parentceed11ef6c834cd21b2984cc4c55fe7917b0a083 (diff)
downloadFreeBSD-src-d745b9017bc6a38ecf70c8846a67ab8072fd64c4.zip
FreeBSD-src-d745b9017bc6a38ecf70c8846a67ab8072fd64c4.tar.gz
Make CAM return and GEOM DISK pass through new GEOM::lunid attribute.
SPC-4 specification states that serial number may be property of device, but not a specific logical unit. People reported about FC storages using serial number in that way, making it unusable for purposes of LUN multipath detection. SPC-4 states that designators associated with logical unit from the VPD page 83h "Device Identification" should be used for that purpose. Report first of them in the new attribute in such preference order: NAA, EUI-64, T10 and SCSI name string. While there, make GEOM DISK properly report GEOM::ident in XML output also using d_getattr() method, if available. This fixes serial numbers reporting for SCSI disks in `geom disk list` output and confxml. Discussed with: gibbs, ken Sponsored by: iXsystems, Inc. MFC after: 2 weeks
Diffstat (limited to 'sys/geom')
-rw-r--r--sys/geom/geom_disk.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c
index b645040..a9f7048 100644
--- a/sys/geom/geom_disk.c
+++ b/sys/geom/geom_disk.c
@@ -427,8 +427,11 @@ g_disk_start(struct bio *bp)
static void
g_disk_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, struct g_consumer *cp, struct g_provider *pp)
{
+ struct bio *bp;
struct disk *dp;
struct g_disk_softc *sc;
+ char *buf;
+ int res = 0;
sc = gp->softc;
if (sc == NULL || (dp = sc->dp) == NULL)
@@ -443,7 +446,27 @@ g_disk_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, struct g
indent, dp->d_fwheads);
sbuf_printf(sb, "%s<fwsectors>%u</fwsectors>\n",
indent, dp->d_fwsectors);
- sbuf_printf(sb, "%s<ident>%s</ident>\n", indent, dp->d_ident);
+ if (dp->d_getattr != NULL) {
+ buf = g_malloc(DISK_IDENT_SIZE, M_WAITOK);
+ bp = g_alloc_bio();
+ bp->bio_disk = dp;
+ bp->bio_attribute = "GEOM::ident";
+ bp->bio_length = DISK_IDENT_SIZE;
+ bp->bio_data = buf;
+ res = dp->d_getattr(bp);
+ sbuf_printf(sb, "%s<ident>%s</ident>\n", indent,
+ res == 0 ? buf: dp->d_ident);
+ bp->bio_attribute = "GEOM::lunid";
+ bp->bio_length = DISK_IDENT_SIZE;
+ bp->bio_data = buf;
+ if (dp->d_getattr(bp) == 0)
+ sbuf_printf(sb, "%s<lunid>%s</lunid>\n",
+ indent, buf);
+ g_destroy_bio(bp);
+ g_free(buf);
+ } else
+ sbuf_printf(sb, "%s<ident>%s</ident>\n", indent,
+ dp->d_ident);
sbuf_printf(sb, "%s<descr>%s</descr>\n", indent, dp->d_descr);
}
}
OpenPOWER on IntegriCloud