cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mlsoren...@apache.org
Subject git commit: updated refs/heads/master to 849049a
Date Fri, 18 Jul 2014 22:53:18 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 1bb3ea8b7 -> 849049a2f


KVM: Allow changing VM video card via agent.properties. This change in
LibvirtVMDef can also be leveraged to add the option to service offering
or template hardware selection (as nic and disk types do).


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/849049a2
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/849049a2
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/849049a2

Branch: refs/heads/master
Commit: 849049a2f0eac8f889dbb96bd77ea569e8901a48
Parents: 1bb3ea8
Author: Marcus Sorensen <marcus@betterservers.com>
Authored: Fri Jul 18 16:40:09 2014 -0600
Committer: Marcus Sorensen <marcus@betterservers.com>
Committed: Fri Jul 18 16:52:51 2014 -0600

----------------------------------------------------------------------
 .../kvm/resource/LibvirtComputingResource.java  | 10 +++++++++
 .../hypervisor/kvm/resource/LibvirtVMDef.java   | 22 ++++++++++++++++++++
 2 files changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/849049a2/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index 2ebab78..627c1fd 100755
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -230,6 +230,7 @@ import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef.guestNetType;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.SerialDef;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.TermPolicy;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.VirtioSerialDef;
+import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.VideoDef;
 import com.cloud.hypervisor.kvm.storage.KVMPhysicalDisk;
 import com.cloud.hypervisor.kvm.storage.KVMStoragePool;
 import com.cloud.hypervisor.kvm.storage.KVMStoragePoolManager;
@@ -450,6 +451,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements
Serv
     protected String _guestCpuMode;
     protected String _guestCpuModel;
     protected boolean _noKvmClock;
+    protected String _videoHw;
+    protected int _videoRam;
     private final Map <String, String> _pifs = new HashMap<String, String>();
     private final Map<String, VmStats> _vmStats = new ConcurrentHashMap<String,
VmStats>();
 
@@ -800,6 +803,10 @@ public class LibvirtComputingResource extends ServerResourceBase implements
Serv
             _noMemBalloon = true;
         }
 
+        _videoHw = (String) params.get("vm.video.hardware");
+        value = (String) params.get("vm.video.ram");
+        _videoRam = NumbersUtil.parseInt(value, 0);
+
         value = (String)params.get("host.reserved.mem.mb");
         _dom0MinMem = NumbersUtil.parseInt(value, 0) * 1024 * 1024;
 
@@ -3747,6 +3754,9 @@ public class LibvirtComputingResource extends ServerResourceBase implements
Serv
             devices.addDevice(vserial);
         }
 
+        VideoDef videoCard = new VideoDef(_videoHw, _videoRam);
+        devices.addDevice(videoCard);
+
         ConsoleDef console = new ConsoleDef("pty", null, null, (short)0);
         devices.addDevice(console);
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/849049a2/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
index 8084035..6b29e9c 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
@@ -1060,6 +1060,28 @@ public class LibvirtVMDef {
         }
     }
 
+    public static class VideoDef {
+        private String _videoModel;
+        private int _videoRam;
+
+        public VideoDef(String videoModel, int videoRam) {
+            _videoModel = videoModel;
+            _videoRam = videoRam;
+        }
+
+        @Override
+        public String toString() {
+            StringBuilder videoBuilder = new StringBuilder();
+            if (_videoModel != null && !_videoModel.isEmpty() && _videoRam
!= 0){
+                videoBuilder.append("<video>\n");
+                videoBuilder.append("<model type='" + _videoModel + "' vram='" + _videoRam
+ "'/>\n");
+                videoBuilder.append("</video>\n");
+                return videoBuilder.toString();
+            }
+            return "";
+        }
+    }
+
     public static class VirtioSerialDef {
         private final String _name;
         private String _path;


Mime
View raw message