fixed VM.resize()
authorSomeone <someone@somenet.org>
Mon, 3 Jun 2013 11:25:42 +0000 (13:25 +0200)
committerSomeone <someone@somenet.org>
Mon, 3 Jun 2013 11:49:44 +0000 (13:49 +0200)
src/at/ac/tuwien/lsdc/sched/SchedulerB.java
src/at/ac/tuwien/lsdc/types/VirtualMachine.java

index 12d026f823851798bdedfd3d6eb9a917cf972019..4d5f5e68c1e562628059d24e3e7b0c7c4b9d1566 100644 (file)
@@ -64,6 +64,9 @@ public class SchedulerB extends AbstractScheduler {
                        }
                }
 
+               // TODO: migrate apps to get an empty VM and shut it down.
+               // TODO: run all delayed.
+
                for (SchedulerEvent evt : events) {
                        if (evt.getType() == EventType.startApplication) {
                                VirtualMachine vm = null;
index d1c74917fc0ff6cc4332dc58e251fee027f8f66c..abf46372729fef37f230dd9ff4f2a1ab5db332c2 100644 (file)
@@ -54,12 +54,16 @@ public class VirtualMachine {
         * Set the VM size to the given new values.
         * 
         * @param newSize
+        *          the new size of the VM, excluding the initial consumption.
         * @param newRAM
+        *          the new RAM of the VM, excluding the initial consumption.
         * @param newCPU
+        *          the new CPU of the VM, excluding the initial consumption.
         * @return
         */
        public boolean resizeVM(int newSize, int newRAM, int newCPU) {
-               if (type == VMType.Resizable && runningOn.checkVM(newSize, newRAM, newCPU)) {
+               if (type == VMType.Resizable
+                               && runningOn.checkVM(newSize - reservedSize, newRAM - reservedRAM, newCPU - reservedCPU)) {
                        // Resize VM
                        reservedSize = initialSize + newSize;
                        reservedRAM = initialRAM + newRAM;