fix: Optimize TGT LUN params for passthrough
This commit is contained in:
BIN
dist/adastra-vtl-installer-1.0.0.tar.gz
vendored
BIN
dist/adastra-vtl-installer-1.0.0.tar.gz
vendored
Binary file not shown.
2
dist/adastra-vtl-installer/VERSION
vendored
2
dist/adastra-vtl-installer/VERSION
vendored
@@ -1,4 +1,4 @@
|
||||
Adastra VTL Installer
|
||||
Version: 1.0.0
|
||||
Build Date: 2025-12-10 12:20:01
|
||||
Build Date: 2025-12-10 12:25:11
|
||||
Build Host: vtl-dev
|
||||
|
||||
11
dist/adastra-vtl-installer/web-ui/api.php
vendored
11
dist/adastra-vtl-installer/web-ui/api.php
vendored
@@ -325,17 +325,20 @@ function addLun($params) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Determine backing store type (simplify to just bstype)
|
||||
// For generic SCSI devices (sg), we MUST specify bstype=sg AND device-type=pt (passthrough)
|
||||
$bstypeParam = '';
|
||||
if (strpos($device, '/dev/sg') === 0) {
|
||||
$bstypeParam = '--bstype sg';
|
||||
|
||||
// Validate device path strictly to avoid needing escapeshellarg (which adds quotes that might confuse tgtadm parsing in some versions)
|
||||
// Regex allows /dev/sg0-999 or /dev/st0-999 or /dev/nst0-999
|
||||
if (preg_match('#^/dev/(sg|st|nst)[0-9]+$#', $device)) {
|
||||
$bstypeParam = '--bstype sg --device-type pt';
|
||||
}
|
||||
|
||||
$command = sprintf(
|
||||
'sudo /usr/sbin/tgtadm --lld iscsi --mode logicalunit --op new --tid %d --lun %d --backing-store %s %s 2>&1',
|
||||
$tid,
|
||||
$lun,
|
||||
escapeshellarg($device),
|
||||
$device, // Safe to use raw because we validated usage above or in previous regex check
|
||||
$bstypeParam
|
||||
);
|
||||
|
||||
|
||||
@@ -325,17 +325,20 @@ function addLun($params) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Determine backing store type (simplify to just bstype)
|
||||
// For generic SCSI devices (sg), we MUST specify bstype=sg AND device-type=pt (passthrough)
|
||||
$bstypeParam = '';
|
||||
if (strpos($device, '/dev/sg') === 0) {
|
||||
$bstypeParam = '--bstype sg';
|
||||
|
||||
// Validate device path strictly to avoid needing escapeshellarg (which adds quotes that might confuse tgtadm parsing in some versions)
|
||||
// Regex allows /dev/sg0-999 or /dev/st0-999 or /dev/nst0-999
|
||||
if (preg_match('#^/dev/(sg|st|nst)[0-9]+$#', $device)) {
|
||||
$bstypeParam = '--bstype sg --device-type pt';
|
||||
}
|
||||
|
||||
$command = sprintf(
|
||||
'sudo /usr/sbin/tgtadm --lld iscsi --mode logicalunit --op new --tid %d --lun %d --backing-store %s %s 2>&1',
|
||||
$tid,
|
||||
$lun,
|
||||
escapeshellarg($device),
|
||||
$device, // Safe to use raw because we validated usage above or in previous regex check
|
||||
$bstypeParam
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user