Example #1
0
        public void SaveProperties(VMProperties props)
        {
            lock(driver)
            {
                if(GetCurrentStatus() == MachineStatus.STARTED) Shutdown ();

                VirtualboxUtils.VBoxManage("modifyvm " + uuid + " " +
                    "--memory " + props.MemorySize + " " +
                    "--vram " + props.VideoMemorySize + " " +
                    "--cpus " + props.CPUCount);
            }
        }
Example #2
0
        public VMProperties LoadProperties()
        {
            lock(driver)
            {
                var props = new VMProperties();
                IEnumerable<string> propLines;
                if(VirtualboxUtils.VBoxManage("showvminfo " + uuid + " --machinereadable", out propLines))
                {

                    var propMap = propLines.Select (s => s.Split ('=')).ToDictionary(parts => parts[0], parts => parts[1]);

                    props.MemorySize = int.Parse (propMap["memory"]);
                    props.VideoMemorySize = int.Parse (propMap["vram"]);
                    props.CPUCount = int.Parse (propMap["cpus"]);
                }

                return props;
            }
        }