summaryrefslogtreecommitdiffstats
path: root/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/App.java
diff options
context:
space:
mode:
authorManuel Bentele2021-05-17 14:17:53 +0200
committerManuel Bentele2021-05-17 14:17:53 +0200
commitcac9562dd5f4cb106fb068a26af6e22dd3c6a463 (patch)
treef1b545aa2e6dcfc61ae718623e28113066aa15c2 /core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/App.java
parent[qemu] Add viewer representation to render displays of the virtual machine (diff)
downloadmltk-cac9562dd5f4cb106fb068a26af6e22dd3c6a463.tar.gz
mltk-cac9562dd5f4cb106fb068a26af6e22dd3c6a463.tar.xz
mltk-cac9562dd5f4cb106fb068a26af6e22dd3c6a463.zip
[qemu] Keep track of defined VMs to automatically close them before program exit
Diffstat (limited to 'core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/App.java')
-rw-r--r--core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/App.java11
1 files changed, 1 insertions, 10 deletions
diff --git a/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/App.java b/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/App.java
index ecc97b12..e5bc4780 100644
--- a/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/App.java
+++ b/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/App.java
@@ -178,11 +178,6 @@ public class App
vm.start();
} catch ( LibvirtVirtualMachineException e ) {
LOGGER.error( "Failed to start defined VM: " + e.getLocalizedMessage() );
- try {
- hypervisor.deregisterVm( vm );
- } catch ( LibvirtHypervisorException | LibvirtVirtualMachineException e1 ) {
- LOGGER.error( "Failed to undefine VM in error state after failed start of VM: " + e.getLocalizedMessage() );
- }
hypervisor.close();
System.exit( 7 );
}
@@ -193,11 +188,6 @@ public class App
vmViewer.display();
} catch ( ViewerException e ) {
LOGGER.error( "Failed to display VM: " + e.getLocalizedMessage() );
- try {
- hypervisor.deregisterVm( vm );
- } catch ( LibvirtHypervisorException | LibvirtVirtualMachineException e1 ) {
- LOGGER.error( "Failed to undefine VM in error state after failed display: " + e.getLocalizedMessage() );
- }
hypervisor.close();
System.exit( 8 );
}
@@ -208,6 +198,7 @@ public class App
} catch ( LibvirtHypervisorException | LibvirtVirtualMachineException e ) {
LOGGER.error( "Failed to undefine VM: " + e.getLocalizedMessage() );
hypervisor.close();
+ System.exit( 9 );
}
// close connection to hypervisor