diff options
author | Manuel Bentele | 2021-04-15 15:10:38 +0200 |
---|---|---|
committer | Manuel Bentele | 2021-04-15 15:10:38 +0200 |
commit | f4c21ccda4f786fe388ffed1e4bd9a18aabea4bd (patch) | |
tree | f612fcec79b5fa3319e73c312e28cb77aa558f77 /core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/configuration/TransformationGenericMemory.java | |
parent | [qemu] Add API to register the functional interface based config filter method (diff) | |
download | mltk-f4c21ccda4f786fe388ffed1e4bd9a18aabea4bd.tar.gz mltk-f4c21ccda4f786fe388ffed1e4bd9a18aabea4bd.tar.xz mltk-f4c21ccda4f786fe388ffed1e4bd9a18aabea4bd.zip |
[qemu] Move generic filtering/transformation to master-sync-shared
Diffstat (limited to 'core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/configuration/TransformationGenericMemory.java')
-rw-r--r-- | core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/configuration/TransformationGenericMemory.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/configuration/TransformationGenericMemory.java b/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/configuration/TransformationGenericMemory.java new file mode 100644 index 00000000..341a5b7f --- /dev/null +++ b/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/configuration/TransformationGenericMemory.java @@ -0,0 +1,28 @@ +package org.openslx.runvirt.plugin.qemu.configuration; + +import java.math.BigInteger; + +import org.openslx.libvirt.domain.Domain; +import org.openslx.libvirt.domain.DomainUtils; +import org.openslx.runvirt.plugin.qemu.cmdln.CommandLineArgs; +import org.openslx.virtualization.configuration.transformation.TransformationException; +import org.openslx.virtualization.configuration.transformation.TransformationGeneric; + +public class TransformationGenericMemory extends TransformationGeneric<Domain, CommandLineArgs> +{ + private static final String FILTER_NAME = "Memory [normal, current (balloning)]"; + + public TransformationGenericMemory() + { + super( TransformationGenericMemory.FILTER_NAME ); + } + + @Override + public void transform( Domain config, CommandLineArgs args ) throws TransformationException + { + BigInteger memory = DomainUtils.decodeMemory( args.getVmMemory(), "MiB" ); + + config.setMemory( memory ); + config.setCurrentMemory( memory ); + } +} |