diff --git a/dist/adastra-vtl-installer-1.0.0.tar.gz b/dist/adastra-vtl-installer-1.0.0.tar.gz index fcbeead..bc12467 100644 Binary files a/dist/adastra-vtl-installer-1.0.0.tar.gz and b/dist/adastra-vtl-installer-1.0.0.tar.gz differ diff --git a/dist/adastra-vtl-installer/VERSION b/dist/adastra-vtl-installer/VERSION index 884a96b..710b07d 100644 --- a/dist/adastra-vtl-installer/VERSION +++ b/dist/adastra-vtl-installer/VERSION @@ -1,4 +1,4 @@ Adastra VTL Installer Version: 1.0.0 -Build Date: 2025-12-10 12:05:52 +Build Date: 2025-12-10 12:13:48 Build Host: vtl-dev diff --git a/dist/adastra-vtl-installer/web-ui/api.php b/dist/adastra-vtl-installer/web-ui/api.php index 45dd8e8..398a860 100644 --- a/dist/adastra-vtl-installer/web-ui/api.php +++ b/dist/adastra-vtl-installer/web-ui/api.php @@ -325,18 +325,36 @@ function addLun($params) { return; } - // Determine backing store type + // Determine backing store type and device type $bstypeParam = ''; + $deviceTypeParam = ''; + if (strpos($device, '/dev/sg') === 0) { $bstypeParam = '--bstype sg'; // Use sg (passthrough) for generic scsi devices + + // Detect specific device type (tape or changer) + $lsscsiOutput = []; + exec("sudo /usr/bin/lsscsi -g | grep " . escapeshellarg($device), $lsscsiOutput); + + if (!empty($lsscsiOutput)) { + $line = $lsscsiOutput[0]; + if (strpos($line, 'mediumx') !== false) { + $deviceTypeParam = '--device-type changer'; + } elseif (strpos($line, 'tape') !== false) { + $deviceTypeParam = '--device-type tape'; + } else { + $deviceTypeParam = '--device-type pt'; // Default to passthrough if unknown + } + } } $command = sprintf( - 'sudo /usr/sbin/tgtadm --lld iscsi --mode logicalunit --op new --tid %d --lun %d --backing-store %s %s 2>&1', + 'sudo /usr/sbin/tgtadm --lld iscsi --mode logicalunit --op new --tid %d --lun %d --backing-store %s %s %s 2>&1', $tid, $lun, escapeshellarg($device), - $bstypeParam + $bstypeParam, + $deviceTypeParam ); $output = []; diff --git a/web-ui/api.php b/web-ui/api.php index 45dd8e8..398a860 100644 --- a/web-ui/api.php +++ b/web-ui/api.php @@ -325,18 +325,36 @@ function addLun($params) { return; } - // Determine backing store type + // Determine backing store type and device type $bstypeParam = ''; + $deviceTypeParam = ''; + if (strpos($device, '/dev/sg') === 0) { $bstypeParam = '--bstype sg'; // Use sg (passthrough) for generic scsi devices + + // Detect specific device type (tape or changer) + $lsscsiOutput = []; + exec("sudo /usr/bin/lsscsi -g | grep " . escapeshellarg($device), $lsscsiOutput); + + if (!empty($lsscsiOutput)) { + $line = $lsscsiOutput[0]; + if (strpos($line, 'mediumx') !== false) { + $deviceTypeParam = '--device-type changer'; + } elseif (strpos($line, 'tape') !== false) { + $deviceTypeParam = '--device-type tape'; + } else { + $deviceTypeParam = '--device-type pt'; // Default to passthrough if unknown + } + } } $command = sprintf( - 'sudo /usr/sbin/tgtadm --lld iscsi --mode logicalunit --op new --tid %d --lun %d --backing-store %s %s 2>&1', + 'sudo /usr/sbin/tgtadm --lld iscsi --mode logicalunit --op new --tid %d --lun %d --backing-store %s %s %s 2>&1', $tid, $lun, escapeshellarg($device), - $bstypeParam + $bstypeParam, + $deviceTypeParam ); $output = [];