feat: add LXC container support to Proxmox extension
- Add is_lxc boolean column to ext_proxmox_nodes (default false, existing nodes unaffected) - Add LXC checkbox to admin node creation form (disabled on edit) - Dynamic API path selection via Node::vmType() (returns 'lxc' or 'qemu') - LXC deployment: syncLxcSettings() for cores, memory, swap, hostname, rootfs, net config - LXC network uses name=eth0 format with applyLxcPoolSettings() for VLAN/firewall/MTU - All lifecycle operations LXC-aware: install, suspend, unsuspend, terminate, upgrade, reinstall - VNC/xterm console uses correct type (lxc vs kvm) - All 20+ Livewire components use vmType() for Proxmox API paths - LXC user interface shows basic-only view (no advanced toggle, no KVM-specific tabs) - Basic tabs for LXC: Overview, Network Configuration, Backups, Console
This commit is contained in:
@@ -169,7 +169,7 @@ class Storage extends Component
|
||||
try {
|
||||
$proxmox = new Proxmox;
|
||||
$config = $proxmox->request(
|
||||
'/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/config'
|
||||
'/nodes/' . $this->server->node->name . '/' . $this->server->node->vmType() . '/' . $this->server->vm_id . '/config'
|
||||
)->json()['data'] ?? [];
|
||||
|
||||
$this->parseStorageConfiguration($config);
|
||||
@@ -573,7 +573,7 @@ class Storage extends Component
|
||||
$driveKey = $this->newDriveBus . $index;
|
||||
|
||||
$proxmox->request(
|
||||
'/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/config',
|
||||
'/nodes/' . $this->server->node->name . '/' . $this->server->node->vmType() . '/' . $this->server->vm_id . '/config',
|
||||
'put',
|
||||
[
|
||||
$driveKey => $this->storagePool . ':' . $this->newDriveSize . ($driveConfig ? ',' . $driveConfig : ''),
|
||||
@@ -724,7 +724,7 @@ class Storage extends Component
|
||||
try {
|
||||
$proxmox = new Proxmox;
|
||||
$proxmox->request(
|
||||
'/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/config',
|
||||
'/nodes/' . $this->server->node->name . '/' . $this->server->node->vmType() . '/' . $this->server->vm_id . '/config',
|
||||
'put',
|
||||
[
|
||||
$this->editingDriveKey => $newConfig,
|
||||
@@ -816,7 +816,7 @@ class Storage extends Component
|
||||
|
||||
// Get current config to find next unused slot
|
||||
$config = $proxmox->request(
|
||||
'/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/config'
|
||||
'/nodes/' . $this->server->node->name . '/' . $this->server->node->vmType() . '/' . $this->server->vm_id . '/config'
|
||||
);
|
||||
|
||||
$configData = $config->json()['data'] ?? [];
|
||||
@@ -829,7 +829,7 @@ class Storage extends Component
|
||||
|
||||
// First, assign the volume to an unused slot to preserve it
|
||||
$proxmox->request(
|
||||
'/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/config',
|
||||
'/nodes/' . $this->server->node->name . '/' . $this->server->node->vmType() . '/' . $this->server->vm_id . '/config',
|
||||
'put',
|
||||
[
|
||||
'unused' . $unusedIndex => $drive['volume'],
|
||||
@@ -839,7 +839,7 @@ class Storage extends Component
|
||||
// Then remove the drive configuration using delete (not 'none' which creates CD-ROM on SCSI)
|
||||
// The volume is already safe in the unused slot
|
||||
$proxmox->request(
|
||||
'/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/config',
|
||||
'/nodes/' . $this->server->node->name . '/' . $this->server->node->vmType() . '/' . $this->server->vm_id . '/config',
|
||||
'put',
|
||||
[
|
||||
'delete' => $driveKey,
|
||||
@@ -893,7 +893,7 @@ class Storage extends Component
|
||||
|
||||
// Get current config to check actual slot availability
|
||||
$config = $proxmox->request(
|
||||
'/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/config'
|
||||
'/nodes/' . $this->server->node->name . '/' . $this->server->node->vmType() . '/' . $this->server->vm_id . '/config'
|
||||
);
|
||||
$configData = $config->json()['data'] ?? [];
|
||||
|
||||
@@ -925,7 +925,7 @@ class Storage extends Component
|
||||
|
||||
// Step 1: Detach - assign the volume to an unused slot to preserve it
|
||||
$proxmox->request(
|
||||
'/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/config',
|
||||
'/nodes/' . $this->server->node->name . '/' . $this->server->node->vmType() . '/' . $this->server->vm_id . '/config',
|
||||
'put',
|
||||
[
|
||||
'unused' . $unusedIndex => $drive['volume'],
|
||||
@@ -934,7 +934,7 @@ class Storage extends Component
|
||||
|
||||
// Step 2: Remove the old drive configuration using delete (not 'none' which creates CD-ROM)
|
||||
$proxmox->request(
|
||||
'/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/config',
|
||||
'/nodes/' . $this->server->node->name . '/' . $this->server->node->vmType() . '/' . $this->server->vm_id . '/config',
|
||||
'put',
|
||||
[
|
||||
'delete' => $this->movingDriveKey,
|
||||
@@ -967,7 +967,7 @@ class Storage extends Component
|
||||
|
||||
// Attach to the new bus
|
||||
$proxmox->request(
|
||||
'/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/config',
|
||||
'/nodes/' . $this->server->node->name . '/' . $this->server->node->vmType() . '/' . $this->server->vm_id . '/config',
|
||||
'put',
|
||||
[
|
||||
$targetKey => $diskConfig,
|
||||
@@ -977,7 +977,7 @@ class Storage extends Component
|
||||
// Step 4: Clean up the unused entry
|
||||
try {
|
||||
$proxmox->request(
|
||||
'/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/config',
|
||||
'/nodes/' . $this->server->node->name . '/' . $this->server->node->vmType() . '/' . $this->server->vm_id . '/config',
|
||||
'put',
|
||||
[
|
||||
'delete' => 'unused' . $unusedIndex,
|
||||
@@ -1044,7 +1044,7 @@ class Storage extends Component
|
||||
|
||||
// First detach the disk, then delete the volume
|
||||
$proxmox->request(
|
||||
'/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/config',
|
||||
'/nodes/' . $this->server->node->name . '/' . $this->server->node->vmType() . '/' . $this->server->vm_id . '/config',
|
||||
'put',
|
||||
[
|
||||
'delete' => $driveKey,
|
||||
@@ -1054,14 +1054,14 @@ class Storage extends Component
|
||||
// Now find and delete the unused disk
|
||||
// Reload config to get the unused disk reference
|
||||
$config = $proxmox->request(
|
||||
'/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/config'
|
||||
'/nodes/' . $this->server->node->name . '/' . $this->server->node->vmType() . '/' . $this->server->vm_id . '/config'
|
||||
)->json()['data'] ?? [];
|
||||
|
||||
// Find unused disks and delete the one we just detached
|
||||
foreach ($config as $key => $value) {
|
||||
if (str_starts_with($key, 'unused') && trim($value) === $this->drives[$driveKey]['volume']) {
|
||||
$proxmox->request(
|
||||
'/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/config',
|
||||
'/nodes/' . $this->server->node->name . '/' . $this->server->node->vmType() . '/' . $this->server->vm_id . '/config',
|
||||
'put',
|
||||
[
|
||||
'delete' => $key,
|
||||
@@ -1140,7 +1140,7 @@ class Storage extends Component
|
||||
|
||||
// First, get the current config to check actual slot availability and retrieve the exact unused disk value
|
||||
$config = $proxmox->request(
|
||||
'/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/config'
|
||||
'/nodes/' . $this->server->node->name . '/' . $this->server->node->vmType() . '/' . $this->server->vm_id . '/config'
|
||||
);
|
||||
$configData = $config->json()['data'] ?? [];
|
||||
|
||||
@@ -1190,7 +1190,7 @@ class Storage extends Component
|
||||
|
||||
// First, set the disk on the new bus (this attaches the volume)
|
||||
$proxmox->request(
|
||||
'/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/config',
|
||||
'/nodes/' . $this->server->node->name . '/' . $this->server->node->vmType() . '/' . $this->server->vm_id . '/config',
|
||||
'put',
|
||||
[
|
||||
$targetKey => $diskConfig,
|
||||
@@ -1201,7 +1201,7 @@ class Storage extends Component
|
||||
// This is safe because the volume is now attached to the new bus
|
||||
try {
|
||||
$proxmox->request(
|
||||
'/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/config',
|
||||
'/nodes/' . $this->server->node->name . '/' . $this->server->node->vmType() . '/' . $this->server->vm_id . '/config',
|
||||
'put',
|
||||
[
|
||||
'delete' => $this->reattachingDriveKey,
|
||||
@@ -1238,7 +1238,7 @@ class Storage extends Component
|
||||
try {
|
||||
$proxmox = new Proxmox;
|
||||
$proxmox->request(
|
||||
'/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/config',
|
||||
'/nodes/' . $this->server->node->name . '/' . $this->server->node->vmType() . '/' . $this->server->vm_id . '/config',
|
||||
'put',
|
||||
[
|
||||
'delete' => $unusedKey,
|
||||
@@ -1278,7 +1278,7 @@ class Storage extends Component
|
||||
try {
|
||||
$proxmox = new Proxmox;
|
||||
$proxmox->request(
|
||||
'/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/config',
|
||||
'/nodes/' . $this->server->node->name . '/' . $this->server->node->vmType() . '/' . $this->server->vm_id . '/config',
|
||||
'put',
|
||||
[
|
||||
'scsihw' => $this->scsiControllerType,
|
||||
|
||||
Reference in New Issue
Block a user