# 📝 Added Device Mapping to iSCSI Tab ## 📅 December 9, 2025 ## 📋 Request The user requested to display the current SCSI device mapping (`lsscsi -g` output) on the iSCSI management tab in the Web UI. This allows for easier identification of which "sg" device corresponds to which tape drive or library. ## 🛠️ Changes Implemented ### 1. Web UI (`index.html`) - Added a "Device Mapping" card at the top of the **iSCSI** section. - Included a "Refresh" button for this specific section. ### 2. Backend (`api.php`) - Added a new API action `device_mapping`. - Implemented `getDeviceMapping()` function: - Executes `lsscsi -g`. - Filters output for `mediumx` (library) and `tape` devices. - Parses output to extract SCSI ID, Type, Vendor, Model, and Device Path. - Returns JSON structure. ### 3. Frontend (`script.js`) - Implement `loadDeviceMapping()` function. - Fetches data from `device_mapping` API. - Renders a table with: - SCSI ID (e.g., `[3:0:0:0]`) - Type (e.g., `mediumx`, `tape`) - Vendor/Product (e.g., `ADASTRA HEPHAESTUS-V`) - Device Path (e.g., `/dev/sg6`) - **Highlighted** as this is crucial for LUN mapping. ## ✅ Verification - The feature relies on `lsscsi` being available (which is standard in this environment). - The `vtl` CLI tool also uses similar logic. - The UI now clearly shows which `/dev/sgX` path to use when creating iSCSI LUNs. ## 📁 Files Modified - `/builder/adastra-vtl/web-ui/index.html` - `/builder/adastra-vtl/web-ui/api.php` - `/builder/adastra-vtl/web-ui/script.js` ## 🚀 Status Feature deployed to `/var/www/html/mhvtl-config/`.