diff options
author | 2010-11-12 15:49:40 +0000 | |
---|---|---|
committer | 2010-11-23 15:00:35 +0000 | |
commit | 174d737d952ac13f7f34cc096023a204b5dcd6c6 (patch) | |
tree | fab09e70161333933e31ef8d5db48762ac84c861 | |
parent | Fix error codes returned when a storage pool is inactive (diff) | |
download | libvirt-174d737d952ac13f7f34cc096023a204b5dcd6c6.tar.gz libvirt-174d737d952ac13f7f34cc096023a204b5dcd6c6.tar.bz2 libvirt-174d737d952ac13f7f34cc096023a204b5dcd6c6.zip |
Improve SCSI volume name generation
The SCSI volumes currently get a name like '17:0:0:1' based
on $host:$bus:$target:$lun. The names are intended to be unique
per pool and stable across pool restarts. The inclusion of the
$host component breaks this, because the $host number for iSCSI
pools is dynamically allocated by the kernel at time of login.
This changes the name to be 'unit:0:0:1', ie removes the leading
host component. The 'unit:' prefix is just to ensure the volume
name doesn't start with a number and make it clearer when seen
out of context.
* src/storage/storage_backend_scsi.c: Improve volume name
field value stability and uniqueness
-rw-r--r-- | src/storage/storage_backend_scsi.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/storage/storage_backend_scsi.c b/src/storage/storage_backend_scsi.c index 8fa2f5246..95ae54645 100644 --- a/src/storage/storage_backend_scsi.c +++ b/src/storage/storage_backend_scsi.c @@ -162,7 +162,7 @@ cleanup: static int virStorageBackendSCSINewLun(virStoragePoolObjPtr pool, - uint32_t host, + uint32_t host ATTRIBUTE_UNUSED, uint32_t bus, uint32_t target, uint32_t lun, @@ -180,7 +180,12 @@ virStorageBackendSCSINewLun(virStoragePoolObjPtr pool, vol->type = VIR_STORAGE_VOL_BLOCK; - if (virAsprintf(&(vol->name), "%u.%u.%u.%u", host, bus, target, lun) < 0) { + /* 'host' is dynamically allocated by the kernel, first come, + * first served, per HBA. As such it isn't suitable for use + * in the volume name. We only need uniqueness per-pool, so + * just leave 'host' out + */ + if (virAsprintf(&(vol->name), "unit:%u:%u:%u", bus, target, lun) < 0) { virReportOOMError(); retval = -1; goto free_vol; |