You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2015/05/07 16:04:54 UTC
[16/50] [abbrv] git commit: updated refs/heads/master to 1c408de
CLOUDSTACK-8424: Add cpu features if guest.cpu.features is set
This improvements checks for "guest.cpu.features" property which is a space
separated list of cpu features that is specific for a host. When added, it
will add <feature policy='require' name='{{feature-you-listed}}'/> in the
<cpu> section of the generated vm spec xml.
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ea7fd377
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ea7fd377
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ea7fd377
Branch: refs/heads/master
Commit: ea7fd37783cbc7ec78de5a5e84395381b1800a3e
Parents: 86943da
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Tue Apr 28 13:16:04 2015 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Tue Apr 28 13:16:04 2015 +0200
----------------------------------------------------------------------
agent/conf/agent.properties | 3 +++
.../kvm/resource/LibvirtComputingResource.java | 12 ++++++++++++
.../cloud/hypervisor/kvm/resource/LibvirtVMDef.java | 13 +++++++++++++
3 files changed, 28 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ea7fd377/agent/conf/agent.properties
----------------------------------------------------------------------
diff --git a/agent/conf/agent.properties b/agent/conf/agent.properties
index 13138f8..fcd8b5c 100644
--- a/agent/conf/agent.properties
+++ b/agent/conf/agent.properties
@@ -126,6 +126,9 @@ hypervisor.type=kvm
# on,run virsh capabilities for more details.
# guest.cpu.model=
#
+# This param will require CPU features on the <cpu> section
+# guest.cpu.features=vmx vme
+#
# vm.memballoon.disable=true
# Disable memory ballooning on vm guests for overcommit, by default overcommit
# feature enables balloon and sets currentMemory to a minimum value.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ea7fd377/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 974e3b2..2f5202b 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
@@ -451,6 +451,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
protected boolean _noMemBalloon = false;
protected String _guestCpuMode;
protected String _guestCpuModel;
+ protected List<String> _cpuFeatures;
protected boolean _noKvmClock;
protected String _videoHw;
protected int _videoRam;
@@ -863,6 +864,16 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
params.put("guest.cpu.model", _guestCpuModel);
}
+ String cpuFeatures = (String)params.get("guest.cpu.features");
+ if (cpuFeatures != null) {
+ _cpuFeatures = new ArrayList<String>();
+ for (String feature: cpuFeatures.split(" ")) {
+ if (feature != null || !feature.isEmpty()) {
+ _cpuFeatures.add(feature);
+ }
+ }
+ }
+
String[] info = NetUtils.getNetworkParams(_privateNic);
_monitor = new KVMHAMonitor(null, info[0], _heartBeatPath);
@@ -3674,6 +3685,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
CpuModeDef cmd = new CpuModeDef();
cmd.setMode(_guestCpuMode);
cmd.setModel(_guestCpuModel);
+ cmd.setFeatures(_cpuFeatures);
// multi cores per socket, for larger core configs
if (vcpus % 6 == 0) {
int sockets = vcpus / 6;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ea7fd377/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 5c8d337..bd6e042 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
@@ -1043,6 +1043,7 @@ public class LibvirtVMDef {
public static class CpuModeDef {
private String _mode;
private String _model;
+ private List<String> _features;
private int _coresPerSocket = -1;
private int _sockets = -1;
@@ -1050,6 +1051,12 @@ public class LibvirtVMDef {
_mode = mode;
}
+ public void setFeatures(List<String> features) {
+ if (features != null) {
+ _features = features;
+ }
+ }
+
public void setModel(String model) {
_model = model;
}
@@ -1074,6 +1081,12 @@ public class LibvirtVMDef {
modeBuilder.append("<cpu>");
}
+ if (_features != null) {
+ for (String feature : _features) {
+ modeBuilder.append("<feature policy='require' name='" + feature + "'/>");
+ }
+ }
+
// add topology
if (_sockets > 0 && _coresPerSocket > 0) {
modeBuilder.append("<topology sockets='" + _sockets + "' cores='" + _coresPerSocket + "' threads='1' />");