summaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorSimon Rettberg2023-06-30 14:16:16 +0200
committerSimon Rettberg2023-06-30 14:16:16 +0200
commit4bc2fb5d03094aeab1670886331d9f43640c3960 (patch)
tree2dca10b2cf3d2828b55280f5b216a9b7ae86edb5 /src/main/java
parent[libvirt] Fix build (diff)
downloadmaster-sync-shared-4bc2fb5d03094aeab1670886331d9f43640c3960.tar.gz
master-sync-shared-4bc2fb5d03094aeab1670886331d9f43640c3960.tar.xz
master-sync-shared-4bc2fb5d03094aeab1670886331d9f43640c3960.zip
Implement disabling USB in VMs
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/openslx/virtualization/configuration/VirtualizationConfiguration.java2
-rw-r--r--src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationDocker.java6
-rw-r--r--src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationQemu.java6
-rw-r--r--src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualBox.java6
-rw-r--r--src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVmware.java6
-rw-r--r--src/main/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModServerToStatelessClient.java3
6 files changed, 27 insertions, 2 deletions
diff --git a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfiguration.java b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfiguration.java
index c1895bf..d4b3058 100644
--- a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfiguration.java
+++ b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfiguration.java
@@ -293,6 +293,8 @@ public abstract class VirtualizationConfiguration
public abstract boolean addCpuCoreCount( int nrOfCores );
+ public abstract void disableUsb();
+
public abstract void setVirtualizerVersion( Version type );
public abstract Version getVirtualizerVersion();
diff --git a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationDocker.java b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationDocker.java
index 8a06b80..3163ed2 100644
--- a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationDocker.java
+++ b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationDocker.java
@@ -165,4 +165,10 @@ public class VirtualizationConfigurationDocker extends VirtualizationConfigurati
{
}
+ @Override
+ public void disableUsb()
+ {
+ // Not applicable, maybe some day via USBguard?
+ }
+
}
diff --git a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationQemu.java b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationQemu.java
index 45b4f1f..6c62a96 100644
--- a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationQemu.java
+++ b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationQemu.java
@@ -894,4 +894,10 @@ public class VirtualizationConfigurationQemu extends VirtualizationConfiguration
throw new VirtualizationConfigurationException( e.getLocalizedMessage() );
}
}
+
+ @Override
+ public void disableUsb()
+ {
+ new QemuUsbSpeed( ControllerUsb.Model.NONE, Usb.NONE ).apply();
+ }
}
diff --git a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualBox.java b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualBox.java
index ebfd918..153fffa 100644
--- a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualBox.java
+++ b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualBox.java
@@ -592,4 +592,10 @@ public class VirtualizationConfigurationVirtualBox extends VirtualizationConfigu
{
this.config.validate();
}
+
+ @Override
+ public void disableUsb()
+ {
+ new VBoxUsbSpeed( null, Usb.NONE ).apply();
+ }
}
diff --git a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVmware.java b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVmware.java
index d9ad129..a237674 100644
--- a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVmware.java
+++ b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVmware.java
@@ -727,4 +727,10 @@ public class VirtualizationConfigurationVmware extends VirtualizationConfigurati
public void validate() throws VirtualizationConfigurationException
{
}
+
+ @Override
+ public void disableUsb()
+ {
+ new VmWareUsbSpeed( 0, Usb.NONE ).apply();
+ }
}
diff --git a/src/main/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModServerToStatelessClient.java b/src/main/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModServerToStatelessClient.java
index 5dec3d9..2d3e861 100644
--- a/src/main/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModServerToStatelessClient.java
+++ b/src/main/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModServerToStatelessClient.java
@@ -102,8 +102,7 @@ public class ConfigurationLogicDozModServerToStatelessClient
// disable USB if necessary
if ( !args.hasUsbAccess() ) {
- // XXX TODO find best way to do this without explicit method
- // config.setMaxUsbSpeed( UsbSpeed.NONE );
+ config.disableUsb();
}
}
}