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 f3a0d25
Date Tue, 27 May 2014 22:16:36 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master a8140ff58 -> f3a0d257b


CLOUDSTACK-6788: Add agent property to optionally disable kvmclock on guests


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

Branch: refs/heads/master
Commit: f3a0d257b8c2323783f7af7d5532f38858436400
Parents: a8140ff
Author: Marcus Sorensen <marcus@betterservers.com>
Authored: Tue May 27 16:14:44 2014 -0600
Committer: Marcus Sorensen <marcus@betterservers.com>
Committed: Tue May 27 16:16:41 2014 -0600

----------------------------------------------------------------------
 agent/conf/agent.properties                     |  4 +++
 .../kvm/resource/LibvirtComputingResource.java  | 10 +++++-
 .../hypervisor/kvm/resource/LibvirtVMDef.java   | 34 +++++++++++++-------
 .../resource/LibvirtComputingResourceTest.java  |  8 +++++
 4 files changed, 43 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f3a0d257/agent/conf/agent.properties
----------------------------------------------------------------------
diff --git a/agent/conf/agent.properties b/agent/conf/agent.properties
index b8b7a7c..c4cabbe 100644
--- a/agent/conf/agent.properties
+++ b/agent/conf/agent.properties
@@ -129,3 +129,7 @@ domr.scripts.dir=scripts/network/domr/kvm
 # 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.
+#
+# kvmclock.disable=false
+# Some newer linux kernels are incapable of reliably migrating vms with kvmclock
+# This is a workaround for the bug, admin can set this to true per-host

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f3a0d257/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 d05e3e6..dba6806 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
@@ -447,7 +447,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements
Serv
     protected boolean _noMemBalloon = false;
     protected String _guestCpuMode;
     protected String _guestCpuModel;
-    private final Map<String, String> _pifs = new HashMap<String, String>();
+    protected boolean _noKvmClock;
+    private final Map <String, String> _pifs = new HashMap<String, String>();
     private final Map<String, VmStats> _vmStats = new ConcurrentHashMap<String,
VmStats>();
 
     protected boolean _disconnected = true;
@@ -800,6 +801,11 @@ public class LibvirtComputingResource extends ServerResourceBase implements
Serv
         value = (String)params.get("host.reserved.mem.mb");
         _dom0MinMem = NumbersUtil.parseInt(value, 0) * 1024 * 1024;
 
+        value = (String) params.get("kvmclock.disable");
+        if (Boolean.parseBoolean(value)) {
+            _noKvmClock = true;
+        }
+
         LibvirtConnection.initialize(_hypervisorURI);
         Connect conn = null;
         try {
@@ -3724,6 +3730,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements
Serv
         if (vmTO.getOs().startsWith("Windows")) {
             clock.setClockOffset(ClockDef.ClockOffset.LOCALTIME);
             clock.setTimer("rtc", "catchup", null);
+        } else if (vmTO.getType() != VirtualMachine.Type.User || isGuestPVEnabled(vmTO.getOs()))
{
+            clock.setTimer("kvmclock", "catchup", null, _noKvmClock);
         }
 
         vm.addComp(clock);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f3a0d257/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 4032305..cf9fec0 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
@@ -242,6 +242,7 @@ public class LibvirtVMDef {
         private String _timerName;
         private String _tickPolicy;
         private String _track;
+        private boolean _noKvmClock = false;
 
         public ClockDef() {
             _offset = ClockOffset.UTC;
@@ -257,6 +258,11 @@ public class LibvirtVMDef {
             _track = track;
         }
 
+        public void setTimer(String timerName, String tickPolicy, String track, boolean noKvmClock)
{
+            _noKvmClock = noKvmClock;
+            setTimer(timerName, tickPolicy, track);
+        }
+
         @Override
         public String toString() {
             StringBuilder clockBuilder = new StringBuilder();
@@ -268,20 +274,24 @@ public class LibvirtVMDef {
                 clockBuilder.append(_timerName);
                 clockBuilder.append("' ");
 
-                if (_tickPolicy != null) {
-                    clockBuilder.append("tickpolicy='");
-                    clockBuilder.append(_tickPolicy);
-                    clockBuilder.append("' ");
-                }
+                if (_timerName.equals("kvmclock") && _noKvmClock) {
+                    clockBuilder.append("present='no' />");
+                } else {
+                    if (_tickPolicy != null) {
+                        clockBuilder.append("tickpolicy='");
+                        clockBuilder.append(_tickPolicy);
+                        clockBuilder.append("' ");
+                    }
 
-                if (_track != null) {
-                    clockBuilder.append("track='");
-                    clockBuilder.append(_track);
-                    clockBuilder.append("' ");
-                }
+                    if (_track != null) {
+                        clockBuilder.append("track='");
+                        clockBuilder.append(_track);
+                        clockBuilder.append("' ");
+                    }
 
-                clockBuilder.append(">\n");
-                clockBuilder.append("</timer>\n");
+                    clockBuilder.append(">\n");
+                    clockBuilder.append("</timer>\n");
+                }
             }
             clockBuilder.append("</clock>\n");
             return clockBuilder.toString();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f3a0d257/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java
b/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java
index bf4546c..faa88f0 100644
--- a/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java
+++ b/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java
@@ -94,6 +94,8 @@ public class LibvirtComputingResourceTest {
         vmStr += "<uuid>b0f0a72d-7efb-3cad-a8ff-70ebf30b3af9</uuid>\n";
         vmStr += "<description>" + os + "</description>\n";
         vmStr += "<clock offset='utc'>\n";
+        vmStr += "<timer name='kvmclock' tickpolicy='catchup' >\n";
+        vmStr += "</timer>\n";
         vmStr += "</clock>\n";
         vmStr += "<features>\n";
         vmStr += "<pae/>\n";
@@ -166,6 +168,8 @@ public class LibvirtComputingResourceTest {
         vmStr += "<uuid>b0f0a72d-7efb-3cad-a8ff-70ebf30b3af9</uuid>\n";
         vmStr += "<description>" + os + "</description>\n";
         vmStr += "<clock offset='utc'>\n";
+        vmStr += "<timer name='kvmclock' tickpolicy='catchup' >\n";
+        vmStr += "</timer>\n";
         vmStr += "</clock>\n";
         vmStr += "<features>\n";
         vmStr += "<pae/>\n";
@@ -236,6 +240,8 @@ public class LibvirtComputingResourceTest {
         vmStr += "<uuid>b0f0a72d-7efb-3cad-a8ff-70ebf30b3af9</uuid>\n";
         vmStr += "<description>" + os + "</description>\n";
         vmStr += "<clock offset='utc'>\n";
+        vmStr += "<timer name='kvmclock' tickpolicy='catchup' >\n";
+        vmStr += "</timer>\n";
         vmStr += "</clock>\n";
         vmStr += "<features>\n";
         vmStr += "<pae/>\n";
@@ -311,6 +317,8 @@ public class LibvirtComputingResourceTest {
         vmStr += "<uuid>b0f0a72d-7efb-3cad-a8ff-70ebf30b3af9</uuid>\n";
         vmStr += "<description>" + os + "</description>\n";
         vmStr += "<clock offset='utc'>\n";
+        vmStr += "<timer name='kvmclock' tickpolicy='catchup' >\n";
+        vmStr += "</timer>\n";
         vmStr += "</clock>\n";
         vmStr += "<features>\n";
         vmStr += "<pae/>\n";


Mime
View raw message