Updated Branches:
  refs/heads/4.1 c6e5e0e85 -> a139c46a3

CLOUDSTACK-4683: revert 2 commits related to kvm cpu model

commit a761d5ae994fc33f60c1c228efe1861ef22dddac
Author: JijunLiu <[email protected]>
Date:   Mon Aug 12 14:48:08 2013 +0800

    add doc for kvm cpu model

commit 706e23623c3227d92ae498529166ca73d2a2bf4e
Author: JijunLiu <[email protected]>
Date:   Sun Jul 14 11:21:39 2013 +0800

    Add cpu model for kvm guest.Now all the kvm guest's cpu model is 'QEMU 
Virtual CPU version xxx'.
    This will affect the activation of Windows OS and low performance.
    I add three mode for user to indicate the guest cpu model.add libvirt


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

Branch: refs/heads/4.1
Commit: a139c46a3834400e6b9a47233c446f47093610c0
Parents: c6e5e0e
Author: Wei Zhou <[email protected]>
Authored: Mon Sep 16 19:29:42 2013 +0200
Committer: Wei Zhou <[email protected]>
Committed: Mon Sep 16 19:29:42 2013 +0200

----------------------------------------------------------------------
 agent/conf/agent.properties                     | 21 ---------
 docs/en-US/hypervisor-host-install-agent.xml    | 45 --------------------
 .../kvm/resource/LibvirtComputingResource.java  | 29 -------------
 .../hypervisor/kvm/resource/LibvirtVMDef.java   | 27 ------------
 .../kvm/resource/LibvirtVMDefTest.java          | 21 ---------
 5 files changed, 143 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a139c46a/agent/conf/agent.properties
----------------------------------------------------------------------
diff --git a/agent/conf/agent.properties b/agent/conf/agent.properties
index 5b72789..724bd72 100644
--- a/agent/conf/agent.properties
+++ b/agent/conf/agent.properties
@@ -80,24 +80,3 @@ domr.scripts.dir=scripts/network/domr/kvm
 # native = com.cloud.hypervisor.kvm.resource.BridgeVifDriver
 # openvswitch = com.cloud.hypervisor.kvm.resource.OvsVifDriver
 #libvirt.vif.driver=com.cloud.hypervisor.kvm.resource.BridgeVifDriver
-
-# setting to enable the cpu model to kvm guest globally.
-# three option:custom,host-model and host-passthrough.
-# custom - user custom the CPU model which specified by guest.cpu.model.
-# host-model - identify the named CPU model which most closely matches the 
host,
-# and then request additional CPU flags to complete the match. This should give
-# close to maximum functionality/performance, which maintaining good
-# reliability/compatibility if the guest is migrated to another host with 
slightly different host CPUs.
-# host-passthrough - tell KVM to passthrough the host CPU with no 
modifications.
-# The difference to host-model, instead of just matching feature flags,
-# every last detail of the host CPU is matched. This gives absolutely best 
performance,
-# and can be important to some apps which check low level CPU details,
-# but it comes at a cost wrt migration. The guest can only be migrated to
-# an exactly matching host CPU.
-#
-# guest.cpu.mode=custom|host-model|host-passthrough
-# This param is only valid if guest.cpu.mode=custom,
-# for examples:"Conroe" "Penryn", "Nehalem", "Westmere", "pentiumpro" and so
-# on,run virsh capabilities for more details.
-# guest.cpu.model=
-

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a139c46a/docs/en-US/hypervisor-host-install-agent.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/hypervisor-host-install-agent.xml 
b/docs/en-US/hypervisor-host-install-agent.xml
index e339165..41b6719 100644
--- a/docs/en-US/hypervisor-host-install-agent.xml
+++ b/docs/en-US/hypervisor-host-install-agent.xml
@@ -31,49 +31,4 @@
     <para>In Ubuntu:</para>
     <programlisting language="Bash"><command>$ apt-get install 
cloudstack-agent</command></programlisting>
     <para>The host is now ready to be added to a cluster. This is covered in a 
later section, see <xref linkend="host-add" />. It is recommended that you 
continue to read the documentation before adding the host!</para>
-    <section id="config-cpu-model">
-        <title>Configure CPU model for KVM guest (Optional) </title>
-    <para>In additional,the &PRODUCT; Agent allows host administrator to 
control the guest CPU model which is exposed to KVM instances. By default, the 
CPU model of KVM instance is likely <emphasis role="italic"> QEMU Virtual CPU 
version x.x.x</emphasis> with least CPU features exposed. There are a couple of 
reasons to specify the CPU model:</para>
-    <itemizedlist>
-        <listitem><para>To maximise performance of instances by exposing new 
host CPU features to the KVM instances;</para>    </listitem>
-        <listitem><para>To ensure a consistent default CPU across all 
machines,removing reliance of variable QEMU defaults;    </para> </listitem>
-    </itemizedlist>
-    <para> For the most part it will be sufficient for the host administrator 
to specify the guest CPU config in the per-host configuration file 
(/etc/cloudstack/agent/agent.properties). This will be achieved by introducing 
two new configuration parameters: </para>
-    <programlisting 
language="Bash">guest.cpu.mode=custom|host-model|host-passthrough
-guest.cpu.model=from /usr/share/libvirt/cpu_map.xml(only valid when 
guest.cpu.mode=custom)
-    </programlisting>
-    <para>There are three choices to fulfill the cpu model changes:</para>
-    <orderedlist>
-        <listitem>
-            <para><emphasis role="bold">custom: </emphasis> you can explicitly 
specify one of the supported named model in 
/usr/share/libvirt/cpu_map.xml</para>
-        </listitem>
-        <listitem>
-            <para><emphasis role="bold">host-model: </emphasis> libvirt will 
identify the CPU model in /usr/share/libvirt/cpu_map.xml which most closely 
matches the host, and then request additional CPU flags to complete the match. 
This should give close to maximum functionality/performance, which maintaining 
good reliability/compatibility if the guest is migrated to another host with 
slightly different host CPUs.  </para>
-        </listitem>
-        <listitem>
-            <para><emphasis role="bold">host-passthrough: </emphasis> libvirt 
will tell KVM to passthrough the host CPU with no modifications. The difference 
to host-model, instead of just matching feature flags, every last detail of the 
host CPU is matched. This gives absolutely best performance, and can be 
important to some apps which check low level CPU details, but it comes at a 
cost with respect to migration: the guest can only be migrated to an exactly 
matching host CPU.  </para>
-        </listitem>
-    </orderedlist>
-    <para>Here are some examples:</para>
-    <itemizedlist>
-        <listitem>
-            <para>custom</para>
-            <programlisting>guest.cpu.mode=custom
-guest.cpu.model=SandyBridge
-            </programlisting>
-        </listitem>
-        <listitem>
-            <para>host-model</para>
-            <programlisting>guest.cpu.mode=host-model </programlisting>
-        </listitem>
-        <listitem>
-            <para>host-passthrough</para>
-            <programlisting>guest.cpu.mode=host-passthrough </programlisting>
-        </listitem>
-    </itemizedlist>
-    <note>
-        <para>host-passthrough may lead to migration failure,if you have this 
problem,you should use host-model or custom </para>
-    </note>
-</section>
-
 </section>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a139c46a/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 91ae75e..4728a25 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
@@ -174,7 +174,6 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.hypervisor.kvm.resource.KVMHABase.NfsStoragePool;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.ClockDef;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.ConsoleDef;
-import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.CpuModeDef;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.CpuTuneDef;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DevicesDef;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef;
@@ -333,8 +332,6 @@ ServerResource {
     private boolean _can_bridge_firewall;
     protected String _localStoragePath;
     protected String _localStorageUUID;
-    protected String _guestCpuMode;
-    protected String _guestCpuModel;
     private final Map <String, String> _pifs = new HashMap<String, String>();
     private final Map<String, Map<String, String>> hostNetInfo = new 
HashMap<String, Map<String, String>>();
     private final Map<String, vmStats> _vmStats = new 
ConcurrentHashMap<String, vmStats>();
@@ -695,20 +692,6 @@ ServerResource {
 
         }
 
-        _guestCpuMode = (String) params.get("guest.cpu.mode");
-        if (_guestCpuMode != null) {
-            _guestCpuModel = (String) params.get("guest.cpu.model");
-
-            if(_hypervisorLibvirtVersion < (9 * 1000 + 10)) {
-                s_logger.warn("LibVirt version 0.9.10 required for guest cpu 
mode, but version " +
-                        prettyVersion(_hypervisorLibvirtVersion) + " detected, 
so it will be disabled");
-                _guestCpuMode = "";
-                _guestCpuModel = "";
-            }
-            params.put("guest.cpu.mode", _guestCpuMode);
-            params.put("guest.cpu.model", _guestCpuModel);
-        }
-
         String[] info = NetUtils.getNetworkParams(_privateNic);
 
         _monitor = new KVMHAMonitor(null, info[0], _heartBeatPath);
@@ -3060,11 +3043,6 @@ ServerResource {
         grd.setVcpuNum(vmTO.getCpus());
         vm.addComp(grd);
 
-        CpuModeDef cmd = new CpuModeDef();
-        cmd.setMode(_guestCpuMode);
-        cmd.setModel(_guestCpuModel);
-        vm.addComp(cmd);
-
         CpuTuneDef ctd = new CpuTuneDef();
         ctd.setShares(vmTO.getCpus() * vmTO.getSpeed());
         vm.addComp(ctd);
@@ -4693,13 +4671,6 @@ ServerResource {
         return new Answer(cmd, success, "");
     }
 
-    private String prettyVersion(long version) {
-        long major = version / 1000000;
-        long minor = version % 1000000 / 1000;
-        long release = version % 1000000 % 1000;
-        return major + "."  + minor + "." + release;
-    }
-
        @Override
        public void setName(String name) {
                // TODO Auto-generated method stub

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a139c46a/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 0f4567c..7b26cfe 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
@@ -833,33 +833,6 @@ public class LibvirtVMDef {
         }
     }
 
-    public static class CpuModeDef {
-        private String _mode;
-        private String _model;
-
-        public void setMode(String mode) {
-            _mode = mode;
-        }
-
-        public void setModel(String model) {
-            _model = model;
-        }
-
-        @Override
-        public String toString() {
-            StringBuilder modeBuidler = new StringBuilder();
-            if ("custom".equalsIgnoreCase(_mode) && _model != null) {
-                modeBuidler.append("<cpu mode='custom' match='exact'><model 
fallback='allow'>"
-                            + _model + "</model></cpu>");
-            } else if ("host-model".equals(_mode)) {
-                modeBuidler.append("<cpu mode='host-model'><model 
fallback='allow'></model></cpu>");
-            } else if ("host-passthrough".equals(_mode)) {
-                modeBuidler.append("<cpu mode='host-passthrough'></cpu>");
-            }
-            return modeBuidler.toString();
-        }
-    }
-
     public static class SerialDef {
         private final String _type;
         private final String _source;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a139c46a/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 3afe598..b723875 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
@@ -35,25 +35,4 @@ public class LibvirtVMDefTest extends TestCase {
 
         assertEquals(expected, ifDef.toString());
     }
-
-    public void testCpuModeDef(){
-        LibvirtVMDef.CpuModeDef cpuModeDef = new LibvirtVMDef.CpuModeDef();
-        cpuModeDef.setMode("custom");
-        cpuModeDef.setModel("Nehalem");
-
-        String expected1 = "<cpu mode='custom' match='exact'><model 
fallback='allow'>Nehalem</model></cpu>";
-
-        assertEquals(expected1, cpuModeDef.toString());
-
-        cpuModeDef.setMode("host-model");
-        String expected2 = "<cpu mode='host-model'><model 
fallback='allow'></model></cpu>";
-
-        assertEquals(expected2, cpuModeDef.toString());
-
-        cpuModeDef.setMode("host-passthrough");
-        String expected3 = "<cpu mode='host-passthrough'></cpu>";
-        assertEquals(expected3, cpuModeDef.toString());
-
-    }
-
 }

Reply via email to