From e5460fcb7ae4882a25f074e23a6dc505fc8664a6 Mon Sep 17 00:00:00 2001 From: "Joseph.Rawlings" Date: Thu, 4 Dec 2025 21:49:55 -0500 Subject: [PATCH] fix: add multiqueue support for network interfaces and update original state handling --- .../Servers/Proxmox/Livewire/Network.php | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/extensions/Servers/Proxmox/Livewire/Network.php b/extensions/Servers/Proxmox/Livewire/Network.php index 9eabe6c3f..bbd587393 100644 --- a/extensions/Servers/Proxmox/Livewire/Network.php +++ b/extensions/Servers/Proxmox/Livewire/Network.php @@ -47,6 +47,9 @@ class Network extends Component $this->interfaceSelections = collect($this->interfaces) ->map(fn ($meta) => $meta['model'] ?? 'virtio') ->toArray(); + $this->interfaceMultiqueues = collect($this->interfaces) + ->map(fn ($meta) => $meta['queues'] ?? 1) + ->toArray(); $this->selectedInterface = array_key_first($this->interfaces) ?? 'net0'; $this->interfaceType = $this->interfaceSelections[$this->selectedInterface] ?? 'virtio'; $this->canRemoveInterfaces = count($this->interfaces) > 1; @@ -55,6 +58,7 @@ class Network extends Component if (empty($this->original)) { $this->original = [ 'interfaceSelections' => json_decode(json_encode($this->interfaceSelections), true), + 'interfaceMultiqueues' => json_decode(json_encode($this->interfaceMultiqueues), true), ]; } } @@ -380,6 +384,25 @@ class Network extends Component } } + // Also check interfaceMultiqueues + $originalInterfaceMultiqueues = isset($this->original['interfaceMultiqueues']) && is_array($this->original['interfaceMultiqueues']) + ? $this->original['interfaceMultiqueues'] + : []; + $currentInterfaceMultiqueues = is_array($this->interfaceMultiqueues) ? $this->interfaceMultiqueues : []; + + ksort($originalInterfaceMultiqueues); + ksort($currentInterfaceMultiqueues); + + if (count($originalInterfaceMultiqueues) !== count($currentInterfaceMultiqueues)) { + return false; + } + + foreach ($originalInterfaceMultiqueues as $key => $value) { + if (!isset($currentInterfaceMultiqueues[$key]) || $currentInterfaceMultiqueues[$key] !== $value) { + return false; + } + } + return true; } @@ -477,6 +500,7 @@ class Network extends Component // Update original values after successful save $this->original = [ 'interfaceSelections' => json_decode(json_encode($this->interfaceSelections), true), + 'interfaceMultiqueues' => json_decode(json_encode($this->interfaceMultiqueues), true), ]; $this->notify(strtoupper($this->selectedInterface) . ' updated to ' . strtoupper($targetType) . '.', 'success'); @@ -538,6 +562,7 @@ class Network extends Component // Update original values after refresh $this->original = [ 'interfaceSelections' => json_decode(json_encode($this->interfaceSelections), true), + 'interfaceMultiqueues' => json_decode(json_encode($this->interfaceMultiqueues), true), ]; $this->notify('Network interfaces refreshed.', 'success'); @@ -607,6 +632,12 @@ class Network extends Component ); $this->interfaces[$name]['queues'] = $queues; + + // Update original state to reflect the saved change + if (isset($this->original['interfaceMultiqueues'])) { + $this->original['interfaceMultiqueues'][$name] = $queues; + } + $this->notify('Multiqueue updated for ' . strtoupper($name) . ' to ' . $queues . ' queues.', 'success'); } catch (\Exception $e) { $this->notify('Failed to update multiqueue: ' . $e->getMessage(), 'error');