From 026cb101c1d87bdc47297d34dc09eb420698a747 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 16 Jul 2024 11:50:28 +0200 Subject: [qemu] Fix concurrent modification error --- .../java/org/openslx/runvirt/virtualization/LibvirtHypervisor.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/virtualization/LibvirtHypervisor.java b/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/virtualization/LibvirtHypervisor.java index 757fc706..18cf38e8 100644 --- a/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/virtualization/LibvirtHypervisor.java +++ b/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/virtualization/LibvirtHypervisor.java @@ -191,8 +191,9 @@ public abstract class LibvirtHypervisor implements Closeable public void close() { // deregister all VMs defined on the hypervisor - for ( LibvirtVirtualMachine vm : this.machines ) { + for ( LibvirtVirtualMachine vm : new ArrayList<>( this.machines ) ) { try { + // This modifies this.machines, so make a copy above this.deregisterVm( vm ); } catch ( LibvirtHypervisorException | LibvirtVirtualMachineException e ) { e.printStackTrace(); -- cgit v1.2.3-55-g7522