From: Doug Ledford Date: Mon, 11 Jan 2010 20:38:10 +0000 (-0500) Subject: Make the IMSM_DEVNAME_AS_SERIAL option work when creating containers. X-Git-Tag: mdadm-3.1.2~61 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fmdadm.git;a=commitdiff_plain;h=9ef5dbff4adc7979102e71efe8efd83d8e0dc775 Make the IMSM_DEVNAME_AS_SERIAL option work when creating containers. This allows a person to testing using loopback devices that don't support serial number queries. Signed-off-by: Doug Ledford Signed-off-by: NeilBrown --- diff --git a/super-intel.c b/super-intel.c index d6951cc2..fcf438c1 100644 --- a/super-intel.c +++ b/super-intel.c @@ -3208,7 +3208,10 @@ static int add_to_super_imsm(struct supertype *st, mdu_disk_info_t *dk, dd->fd = fd; dd->e = NULL; rv = imsm_read_serial(fd, devname, dd->serial); - if (rv) { + if (rv && check_env("IMSM_DEVNAME_AS_SERIAL")) { + memset(dd->serial, 0, MAX_RAID_SERIAL_LEN); + fd2devname(fd, (char *) dd->serial); + } else if (rv) { fprintf(stderr, Name ": failed to retrieve scsi serial, aborting\n"); free(dd);