tgt target: Provide unique scsi_sn and scsi_id

Provide unique scsi_sn and scsi_id fields so that
attachments can more reliably locate the correct
block device for a volume.

Closes-Bug: #1917750
Depends-On: I91cd5e262513b5427377ce1892e9acfe29e22b21
Change-Id: Ifc17afa115c669ab5aa8dfc063638b9dfd929942
(cherry picked from commit 67b063e920)
This commit is contained in:
Eric Harney
2025-04-11 12:17:24 -04:00
parent 8df631859d
commit dbf1034bb0

View File

@@ -42,6 +42,8 @@ class TgtAdm(iscsi.ISCSITarget):
%(chap_auth)s
%(target_flags)s
write-cache %(write_cache)s
scsi_sn %(scsi_sn)s
scsi_id %(scsi_id)s
</target>
""")
@@ -139,10 +141,16 @@ class TgtAdm(iscsi.ISCSITarget):
if target_flags:
target_flags = 'bsoflags ' + target_flags
# Create unique scsi_sn and scsi_id fields based on the volume id
scsi_sn = vol_id
scsi_id = vol_id
volume_conf = self.VOLUME_CONF % {
'name': name, 'path': path, 'driver': driver,
'chap_auth': chap_str, 'target_flags': target_flags,
'write_cache': write_cache}
'write_cache': write_cache,
'scsi_sn': scsi_sn,
'scsi_id': scsi_id}
LOG.debug('Creating iscsi_target for Volume ID: %s', vol_id)
volumes_dir = self.volumes_dir