feat: Major VTL System Upgrade (Auth, Monitoring, CLI, Installer)
- Web UI: - Added secure Authentication system (Login, 2 Roles: Admin/Viewer) - Added System Monitoring Dashboard (Health, Services, Power Mgmt) - Added User Management Interface (Create, Delete, Enable/Disable) - Added Device Mapping view in iSCSI tab (lsscsi output) - Backend: - Implemented secure session management (auth.php) - Added power management APIs (restart/shutdown appliance) - Added device mapping API - CLI: - Created global 'vtl' management tool - Added scripts for reliable startup (vtllibrary fix) - Installer: - Updated install.sh with new dependencies (tgt, sudoers, permissions) - Included all new components in build-installer.sh - Docs: - Consolidated documentation into docs/ folder
This commit is contained in:
273
docs/WEB_UI_FIX_REPORT.md
Normal file
273
docs/WEB_UI_FIX_REPORT.md
Normal file
@@ -0,0 +1,273 @@
|
||||
# 🌐 Web UI Fix Report - Drive ID Convention
|
||||
|
||||
## 📋 Issue Found
|
||||
|
||||
The web UI was generating incorrect drive IDs in the `device.conf` file, using **sequential 0-based numbering** (00, 01, 02, 03) instead of following the **MHVTL convention**.
|
||||
|
||||
### ❌ Previous Behavior
|
||||
|
||||
**Generated Configuration:**
|
||||
```
|
||||
Library: 10 CHANNEL: 00 TARGET: 00 LUN: 00
|
||||
Drive: 00 CHANNEL: 00 TARGET: 01 LUN: 00 # ❌ Wrong!
|
||||
Drive: 01 CHANNEL: 00 TARGET: 02 LUN: 00 # ❌ Wrong!
|
||||
Drive: 02 CHANNEL: 00 TARGET: 03 LUN: 00 # ❌ Wrong!
|
||||
Drive: 03 CHANNEL: 00 TARGET: 04 LUN: 00 # ❌ Wrong!
|
||||
```
|
||||
|
||||
**Problem:**
|
||||
- Drive IDs started from 00, 01, 02, 03
|
||||
- This caused `vtllibrary` to fail with: `error: Can not find entry for '0' in config file`
|
||||
- Library (changer) would not be detected in `lsscsi -g`
|
||||
|
||||
---
|
||||
|
||||
## ✅ Fix Applied
|
||||
|
||||
### MHVTL Drive ID Convention
|
||||
|
||||
**Rule:** Drive ID = Library ID (tens digit) + Slot Number (ones digit)
|
||||
|
||||
**For Library 10:**
|
||||
- Slot 1 → Drive ID **11** (10 + 1)
|
||||
- Slot 2 → Drive ID **12** (10 + 2)
|
||||
- Slot 3 → Drive ID **13** (10 + 3)
|
||||
- Slot 4 → Drive ID **14** (10 + 4)
|
||||
|
||||
**For Library 30:**
|
||||
- Slot 1 → Drive ID **31** (30 + 1)
|
||||
- Slot 2 → Drive ID **32** (30 + 2)
|
||||
|
||||
### ✅ Corrected Configuration
|
||||
|
||||
```
|
||||
Library: 10 CHANNEL: 00 TARGET: 00 LUN: 00
|
||||
Drive: 11 CHANNEL: 00 TARGET: 01 LUN: 00 # ✅ Correct!
|
||||
Drive: 12 CHANNEL: 00 TARGET: 02 LUN: 00 # ✅ Correct!
|
||||
Drive: 13 CHANNEL: 00 TARGET: 03 LUN: 00 # ✅ Correct!
|
||||
Drive: 14 CHANNEL: 00 TARGET: 04 LUN: 00 # ✅ Correct!
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Changes Made
|
||||
|
||||
### 1. **Updated `addDrive()` Function**
|
||||
|
||||
**File:** `/builder/adastra-vtl/web-ui/script.js`
|
||||
|
||||
**Before:**
|
||||
```javascript
|
||||
function addDrive(driveType = 'IBM ULT3580-TD5') {
|
||||
const driveId = driveCounter++;
|
||||
const drive = {
|
||||
id: driveId,
|
||||
driveNum: drives.length, // ❌ 0, 1, 2, 3...
|
||||
// ...
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
**After:**
|
||||
```javascript
|
||||
function addDrive(driveType = 'IBM ULT3580-TD5') {
|
||||
const driveId = driveCounter++;
|
||||
const slot = drives.length + 1;
|
||||
const libraryId = 10;
|
||||
// MHVTL Convention: Drive ID = Library ID (tens) + Slot (ones)
|
||||
const driveNum = libraryId + slot; // ✅ 11, 12, 13, 14...
|
||||
|
||||
const drive = {
|
||||
id: driveId,
|
||||
driveNum: driveNum,
|
||||
// ...
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### 2. **Updated `removeDrive()` Function**
|
||||
|
||||
Recalculates drive numbers when a drive is removed to maintain correct numbering:
|
||||
|
||||
```javascript
|
||||
function removeDrive(driveId) {
|
||||
// ... remove drive ...
|
||||
|
||||
// Recalculate drive numbers and slots using MHVTL convention
|
||||
drives.forEach((drive, idx) => {
|
||||
const slot = idx + 1;
|
||||
drive.slot = slot;
|
||||
drive.driveNum = drive.libraryId + slot; // ✅ Recalculate
|
||||
});
|
||||
|
||||
// Re-render drives
|
||||
document.getElementById('drives-container').innerHTML = '';
|
||||
drives.forEach(drive => renderDrive(drive));
|
||||
}
|
||||
```
|
||||
|
||||
### 3. **Enhanced `updateDrive()` Function**
|
||||
|
||||
Automatically recalculates drive number when Library ID or Slot changes:
|
||||
|
||||
```javascript
|
||||
function updateDrive(driveId, field, value) {
|
||||
const drive = drives.find(d => d.id === driveId);
|
||||
if (drive) {
|
||||
drive[field] = value;
|
||||
|
||||
// Recalculate drive number if library ID or slot changes
|
||||
if (field === 'libraryId' || field === 'slot') {
|
||||
drive.driveNum = drive.libraryId + drive.slot; // ✅ Auto-recalculate
|
||||
// Re-render to update the display
|
||||
document.getElementById('drives-container').innerHTML = '';
|
||||
drives.forEach(d => renderDrive(d));
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 4. **Added Documentation**
|
||||
|
||||
Added comprehensive documentation at the top of `script.js`:
|
||||
|
||||
```javascript
|
||||
/**
|
||||
* MHVTL Configuration Web UI
|
||||
*
|
||||
* IMPORTANT: MHVTL Drive ID Convention
|
||||
* -------------------------------------
|
||||
* Drive IDs must follow the format: Library ID (tens digit) + Slot Number (ones digit)
|
||||
*
|
||||
* Examples for Library 10:
|
||||
* - Slot 1 → Drive ID 11 (10 + 1)
|
||||
* - Slot 2 → Drive ID 12 (10 + 2)
|
||||
* - Slot 3 → Drive ID 13 (10 + 3)
|
||||
* - Slot 4 → Drive ID 14 (10 + 4)
|
||||
*
|
||||
* Examples for Library 30:
|
||||
* - Slot 1 → Drive ID 31 (30 + 1)
|
||||
* - Slot 2 → Drive ID 32 (30 + 2)
|
||||
*
|
||||
* This convention is enforced throughout the UI to ensure compatibility with mhvtl.
|
||||
*/
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Impact
|
||||
|
||||
### Before Fix:
|
||||
- ❌ Generated configs would cause `vtllibrary` to fail
|
||||
- ❌ Library/changer would not be detected
|
||||
- ❌ Users would need to manually edit generated configs
|
||||
- ❌ Inconsistent with MHVTL documentation and examples
|
||||
|
||||
### After Fix:
|
||||
- ✅ Generated configs work correctly with MHVTL
|
||||
- ✅ Library/changer is properly detected
|
||||
- ✅ No manual editing required
|
||||
- ✅ Follows MHVTL best practices and conventions
|
||||
- ✅ Auto-recalculates when Library ID or Slot changes
|
||||
- ✅ Maintains correct numbering when drives are added/removed
|
||||
|
||||
---
|
||||
|
||||
## 🧪 Testing
|
||||
|
||||
### Test Case 1: Default Configuration
|
||||
|
||||
**Action:** Open web UI, use default 4 drives
|
||||
|
||||
**Expected Result:**
|
||||
```
|
||||
Drive: 11 CHANNEL: 00 TARGET: 01 LUN: 00
|
||||
Drive: 12 CHANNEL: 00 TARGET: 02 LUN: 00
|
||||
Drive: 13 CHANNEL: 00 TARGET: 03 LUN: 00
|
||||
Drive: 14 CHANNEL: 00 TARGET: 04 LUN: 00
|
||||
```
|
||||
|
||||
### Test Case 2: Change Library ID
|
||||
|
||||
**Action:** Change Library ID from 10 to 30
|
||||
|
||||
**Expected Result:**
|
||||
```
|
||||
Drive: 31 CHANNEL: 00 TARGET: 01 LUN: 00 # Auto-updated!
|
||||
Drive: 32 CHANNEL: 00 TARGET: 02 LUN: 00 # Auto-updated!
|
||||
Drive: 33 CHANNEL: 00 TARGET: 03 LUN: 00 # Auto-updated!
|
||||
Drive: 34 CHANNEL: 00 TARGET: 04 LUN: 00 # Auto-updated!
|
||||
```
|
||||
|
||||
### Test Case 3: Remove Middle Drive
|
||||
|
||||
**Action:** Remove Drive 12 (slot 2)
|
||||
|
||||
**Expected Result:**
|
||||
```
|
||||
Drive: 11 CHANNEL: 00 TARGET: 01 LUN: 00 # Slot 1
|
||||
Drive: 12 CHANNEL: 00 TARGET: 02 LUN: 00 # Slot 2 (renumbered)
|
||||
Drive: 13 CHANNEL: 00 TARGET: 03 LUN: 00 # Slot 3 (renumbered)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📁 Files Modified
|
||||
|
||||
1. **`/builder/adastra-vtl/web-ui/script.js`**
|
||||
- Updated `addDrive()` function
|
||||
- Updated `removeDrive()` function
|
||||
- Enhanced `updateDrive()` function
|
||||
- Added documentation header
|
||||
|
||||
2. **`/var/www/html/mhvtl-config/script.js`**
|
||||
- Deployed updated version to web server
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Deployment
|
||||
|
||||
The fix has been automatically deployed to the web server:
|
||||
|
||||
```bash
|
||||
# Updated file location
|
||||
/var/www/html/mhvtl-config/script.js
|
||||
|
||||
# Access URL
|
||||
http://localhost/mhvtl-config/
|
||||
```
|
||||
|
||||
Users can now:
|
||||
1. Open the web UI
|
||||
2. Configure library and drives
|
||||
3. Export `device.conf`
|
||||
4. Apply configuration directly to the server
|
||||
5. **No manual editing required!**
|
||||
|
||||
---
|
||||
|
||||
## 📚 Related Documentation
|
||||
|
||||
- **Library Fix Report:** `/builder/adastra-vtl/LIBRARY_FIX_REPORT.md`
|
||||
- **MHVTL iSCSI Guide:** `/builder/adastra-vtl/MHVTL_ISCSI_BINDING_GUIDE.md`
|
||||
- **Web UI README:** `/builder/adastra-vtl/web-ui/README.md`
|
||||
|
||||
---
|
||||
|
||||
## ✅ Verification Checklist
|
||||
|
||||
- [x] Drive ID calculation follows MHVTL convention
|
||||
- [x] Auto-recalculation when Library ID changes
|
||||
- [x] Auto-recalculation when Slot changes
|
||||
- [x] Correct renumbering when drives are removed
|
||||
- [x] Documentation added to code
|
||||
- [x] Changes deployed to web server
|
||||
- [x] Compatible with existing MHVTL installations
|
||||
|
||||
---
|
||||
|
||||
**Status:** ✅ **FIXED**
|
||||
**Date:** December 9, 2025
|
||||
**Tested On:** Ubuntu 24.04.3 LTS
|
||||
**Web Server:** Apache 2.4
|
||||
**PHP Version:** 8.x
|
||||
Reference in New Issue
Block a user