summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2019-06-19 18:57:38 +0200
committerSimon Rettberg2019-06-19 18:57:38 +0200
commit6fcaab3759aa9c8cfd20f6e077f165d025a1a658 (patch)
tree728b82828dc03b62853d38e9b99b1a9745c99d55
parentAdd support for configuring USB speed (diff)
downloadmaster-sync-shared-6fcaab3759aa9c8cfd20f6e077f165d025a1a658.tar.gz
master-sync-shared-6fcaab3759aa9c8cfd20f6e077f165d025a1a658.tar.xz
master-sync-shared-6fcaab3759aa9c8cfd20f6e077f165d025a1a658.zip
[vm] Turn disableSuspend into more versatile tweakForNonPersistent
-rw-r--r--src/main/java/org/openslx/util/vm/QemuMetaData.java2
-rw-r--r--src/main/java/org/openslx/util/vm/VboxConfig.java19
-rw-r--r--src/main/java/org/openslx/util/vm/VboxMetaData.java14
-rw-r--r--src/main/java/org/openslx/util/vm/VmMetaData.java2
-rw-r--r--src/main/java/org/openslx/util/vm/VmwareMetaData.java2
5 files changed, 33 insertions, 6 deletions
diff --git a/src/main/java/org/openslx/util/vm/QemuMetaData.java b/src/main/java/org/openslx/util/vm/QemuMetaData.java
index cd18abd..201ffd8 100644
--- a/src/main/java/org/openslx/util/vm/QemuMetaData.java
+++ b/src/main/java/org/openslx/util/vm/QemuMetaData.java
@@ -201,7 +201,7 @@ public class QemuMetaData extends VmMetaData<VBoxSoundCardMeta, VBoxDDAccelMeta,
}
@Override
- public boolean disableSuspend()
+ public boolean tweakForNonPersistent()
{
return false;
}
diff --git a/src/main/java/org/openslx/util/vm/VboxConfig.java b/src/main/java/org/openslx/util/vm/VboxConfig.java
index 5f2a21d..e9870a5 100644
--- a/src/main/java/org/openslx/util/vm/VboxConfig.java
+++ b/src/main/java/org/openslx/util/vm/VboxConfig.java
@@ -533,6 +533,25 @@ public class VboxConfig
}
return (Element)nn;
}
+
+ public void setExtraData( String key, String value )
+ {
+ NodeList nl = findNodes( "/VirtualBox/Machine/ExtraData/ExtraDataItem[@name='" + key + "']" );
+ Element e = null;
+ for ( int i = 0; i < nl.getLength(); ++i ) {
+ Node n = nl.item( i );
+ if ( n.getNodeType() == Node.ELEMENT_NODE ) {
+ e = (Element)n;
+ break;
+ }
+ }
+ if ( e == null ) {
+ Element p = createNodeRecursive( "/VirtualBox/Machine/ExtraData" );
+ e = addNewNode( p, "ExtraDataItem" );
+ e.setAttribute( "name", key );
+ }
+ e.setAttribute( "value", value );
+ }
/**
* Creates a new element to the given parent node.
diff --git a/src/main/java/org/openslx/util/vm/VboxMetaData.java b/src/main/java/org/openslx/util/vm/VboxMetaData.java
index 8fa530b..da5189e 100644
--- a/src/main/java/org/openslx/util/vm/VboxMetaData.java
+++ b/src/main/java/org/openslx/util/vm/VboxMetaData.java
@@ -456,12 +456,20 @@ public class VboxMetaData extends VmMetaData<VBoxSoundCardMeta, VBoxDDAccelMeta,
}
@Override
- public boolean disableSuspend()
+ public boolean tweakForNonPersistent()
{
- // TODO how??
- // short answer is: you can't
+ // Cannot disable suspend
// https://forums.virtualbox.org/viewtopic.php?f=6&t=77169
// https://forums.virtualbox.org/viewtopic.php?f=8&t=80338
+ // But some other stuff that won't make sense in non-persistent mode
+ config.setExtraData( "GUI/LastCloseAction", "PowerOff" );
+ // Could use "Default" instead of "Last" above, but you won't get any confirmation dialog in that case
+ config.setExtraData( "GUI/RestrictedRuntimeHelpMenuActions", "All" );
+ config.setExtraData( "GUI/RestrictedRuntimeMachineMenuActions", "TakeSnapshot,Pause,SaveState" );
+ config.setExtraData( "GUI/RestrictedRuntimeMenus", "Help" );
+ config.setExtraData( "GUI/PreventSnapshotOperations", "true" );
+ config.setExtraData( "GUI/PreventApplicationUpdate", "true" );
+ config.setExtraData( "GUI/RestrictedCloseActions", "SaveState,PowerOffRestoringSnapshot,Detach" );
return true;
}
diff --git a/src/main/java/org/openslx/util/vm/VmMetaData.java b/src/main/java/org/openslx/util/vm/VmMetaData.java
index 9cff9f5..15e2cb5 100644
--- a/src/main/java/org/openslx/util/vm/VmMetaData.java
+++ b/src/main/java/org/openslx/util/vm/VmMetaData.java
@@ -389,7 +389,7 @@ public abstract class VmMetaData<T, U, V, W, X>
public abstract Virtualizer getVirtualizer();
- public abstract boolean disableSuspend();
+ public abstract boolean tweakForNonPersistent();
/**
* Function used to register virtual devices
diff --git a/src/main/java/org/openslx/util/vm/VmwareMetaData.java b/src/main/java/org/openslx/util/vm/VmwareMetaData.java
index 1e87d72..fb5b22a 100644
--- a/src/main/java/org/openslx/util/vm/VmwareMetaData.java
+++ b/src/main/java/org/openslx/util/vm/VmwareMetaData.java
@@ -396,7 +396,7 @@ public class VmwareMetaData extends VmMetaData<VmWareSoundCardMeta, VmWareDDAcce
}
@Override
- public boolean disableSuspend()
+ public boolean tweakForNonPersistent()
{
addFiltered( "suspend.disabled", "TRUE" );
return true;