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/12/04 15:07:46 UTC
[1/2] git commit: updated refs/heads/master to 79b054a
Repository: cloudstack
Updated Branches:
refs/heads/master 58ba44a1c -> 79b054ae2
CLOUDSTACK-9004: Add features to HyperVEnlightenmentFeatureDef
Add function to set vapic, spinlock and retries
Add function to get retry value
Modify toString to output appropriate XML for spinlock value if set
CLOUDSTACK-9004: Add features to HyperVEnlightenmentFeatureDef
Refactored set methods to get rid of code duplication.
Modified unit tests accordingly
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b6c900fd
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b6c900fd
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b6c900fd
Branch: refs/heads/master
Commit: b6c900fdde48507999e3ed91406487fc742a53aa
Parents: 7e902cd
Author: Josh Harshman <jo...@intrinium.com>
Authored: Fri Oct 30 11:14:52 2015 -0700
Committer: Josh Harshman <jo...@intrinium.com>
Committed: Thu Dec 3 16:49:00 2015 -0800
----------------------------------------------------------------------
.../hypervisor/kvm/resource/LibvirtVMDef.java | 51 +++++++++++++++++---
.../kvm/resource/LibvirtVMDefTest.java | 10 +++-
2 files changed, 51 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b6c900fd/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 fb1b134..7310f12 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
@@ -191,22 +191,57 @@ public class LibvirtVMDef {
}
public static class HyperVEnlightenmentFeatureDef {
- private final Map<String, String> features = new HashMap<String,String>();
- public void setRelaxed(boolean on) {
- String state = on ? "On":"Off";
- features.put("relaxed", state);
+ enum Enlight {
+ RELAX("relaxed"),
+ VAPIC("vapic"),
+ SPIN("spinlocks");
+
+ private final String featureName;
+ Enlight(String featureName) { this.featureName = featureName; }
+ String getFeatureName() { return featureName; }
+
+ static boolean isValidFeature(String featureName) {
+ Enlight[] enlights = Enlight.values();
+ for(Enlight e : enlights) {
+ if(e.getFeatureName().equals(featureName))
+ return true;
+ }
+ return false;
+ }
+ }
+
+ private final Map<String, String> features = new HashMap<String, String>();
+ private int retries = 4096; // set to sane default
+
+ public void setFeature(String feature, boolean on) {
+ if(on && Enlight.isValidFeature(feature))
+ setFeature(feature);
+ }
+
+ private void setFeature(String feature) {
+ features.put(feature, "on");
}
+
+ public void setRetries(int retry) {
+ if(retry>=retries)
+ retries=retry;
+ }
+
+ public int getRetries() {
+ return retries;
+ }
+
@Override
public String toString() {
- if (features.isEmpty()) {
- return "";
- }
StringBuilder feaBuilder = new StringBuilder();
feaBuilder.append("<hyperv>\n");
for (Map.Entry<String, String> e : features.entrySet()) {
feaBuilder.append("<");
feaBuilder.append(e.getKey());
- feaBuilder.append(" state='" + e.getValue() + "'");
+
+ if(e.getKey().equals("spinlocks")) feaBuilder.append(" state='" + e.getValue() + "' retries='" + getRetries() + "'");
+ else feaBuilder.append(" state='" + e.getValue() + "'");
+
feaBuilder.append("/>\n");
}
feaBuilder.append("</hyperv>\n");
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b6c900fd/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtVMDefTest.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtVMDefTest.java b/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtVMDefTest.java
index 856a8a5..a926129 100644
--- a/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtVMDefTest.java
+++ b/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtVMDefTest.java
@@ -94,16 +94,22 @@ public class LibvirtVMDefTest extends TestCase {
public void testHypervEnlightDef() {
LibvirtVMDef.FeaturesDef featuresDef = new LibvirtVMDef.FeaturesDef();
LibvirtVMDef.HyperVEnlightenmentFeatureDef hyperVEnlightenmentFeatureDef = new LibvirtVMDef.HyperVEnlightenmentFeatureDef();
- hyperVEnlightenmentFeatureDef.setRelaxed(true);
+ hyperVEnlightenmentFeatureDef.setFeature("relaxed", true);
+ hyperVEnlightenmentFeatureDef.setFeature("vapic", true);
+ hyperVEnlightenmentFeatureDef.setFeature("spinlocks", true);
+ hyperVEnlightenmentFeatureDef.setRetries(8096);
featuresDef.addHyperVFeature(hyperVEnlightenmentFeatureDef);
String defs = featuresDef.toString();
assertTrue(defs.contains("relaxed"));
+ assertTrue(defs.contains("vapic"));
+ assertTrue(defs.contains("spinlocks"));
featuresDef = new LibvirtVMDef.FeaturesDef();
featuresDef.addFeatures("pae");
defs = featuresDef.toString();
assertFalse(defs.contains("relaxed"));
-
+ assertFalse(defs.contains("vapic"));
+ assertFalse(defs.contains("spinlocks"));
assertTrue("Windows Server 2008 R2".contains("Windows Server 2008"));
Pair<Integer,Integer> hostOsVersion = new Pair<Integer,Integer>(6,5);
[2/2] git commit: updated refs/heads/master to 79b054a
Posted by da...@apache.org.
Merge pull request #1013 from jharshman/CLOUDSTACK-9004
[4.7] CLOUDSTACK-9004: Add features to HyperVEnlightenmentFeatureDefAdd function to set vapic, spinlock and retries
Add function to get retry value
Modify toString to output appropriate XML for spinlock value if set
* pr/1013:
CLOUDSTACK-9004: Add features to HyperVEnlightenmentFeatureDef
Signed-off-by: Daan Hoogland <da...@onecht.net>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/79b054ae
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/79b054ae
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/79b054ae
Branch: refs/heads/master
Commit: 79b054ae2207c68ebed5c2a1fd3da8c72e0ae7f4
Parents: 58ba44a b6c900f
Author: Daan Hoogland <da...@onecht.net>
Authored: Fri Dec 4 15:07:16 2015 +0100
Committer: Daan Hoogland <da...@onecht.net>
Committed: Fri Dec 4 15:07:16 2015 +0100
----------------------------------------------------------------------
.../hypervisor/kvm/resource/LibvirtVMDef.java | 51 +++++++++++++++++---
.../kvm/resource/LibvirtVMDefTest.java | 10 +++-
2 files changed, 51 insertions(+), 10 deletions(-)
----------------------------------------------------------------------