summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2025-03-11 14:22:57 +0100
committerSimon Rettberg2025-03-11 14:22:57 +0100
commit7c146604159ee51902f4cf40ae46d158a286ec98 (patch)
tree9782378b41c3fba9e7273a74f11ec7f1c8d4b739
parent[libvirt] Update rng files (v11.0.0) (diff)
downloadmaster-sync-shared-7c14660.tar.gz
master-sync-shared-7c14660.tar.xz
master-sync-shared-7c14660.zip
[libvirt] Video: Add methods to adjust video memory
-rw-r--r--src/main/java/org/openslx/libvirt/domain/device/Video.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/main/java/org/openslx/libvirt/domain/device/Video.java b/src/main/java/org/openslx/libvirt/domain/device/Video.java
index a674715..3bb607f 100644
--- a/src/main/java/org/openslx/libvirt/domain/device/Video.java
+++ b/src/main/java/org/openslx/libvirt/domain/device/Video.java
@@ -1,6 +1,7 @@
package org.openslx.libvirt.domain.device;
import org.openslx.libvirt.xml.LibvirtXmlNode;
+import org.openslx.util.Util;
/**
* A video (GPU) device node in a Libvirt domain XML document.
@@ -194,4 +195,39 @@ public class Video extends Device
return null;
}
}
+
+ /**
+ * Get size of VGA memory in KB, or 0 if unset/invalid.
+ */
+ public int getVgaMem()
+ {
+ String mem = this.getXmlElementAttributeValue( "model", "vgamem" );
+ return mem == null ? 0 : Util.parseInt( mem, 0 );
+ }
+
+ /**
+ * Set size of VGA memory, in KB
+ */
+ public void setVgaMem( int kb )
+ {
+ this.setXmlElementAttributeValue( "model", "vgamem", Integer.toString( kb ) );
+ }
+
+ /**
+ * Get total RAM of video card in KB, or 0 if unset/invalid.
+ */
+ public int getRam()
+ {
+ String mem = this.getXmlElementAttributeValue( "model", "ram" );
+ return mem == null ? 0 : Util.parseInt( mem, 0 );
+ }
+
+ /**
+ * Set size of video card RAM, in KB.
+ */
+ public void setRam( int kb )
+ {
+ this.setXmlElementAttributeValue( "model", "ram", Integer.toString( kb ) );
+ }
+
}