@@ -331,81 +331,94 @@ sudoers file:
331331 Defaults:cloudstack !requiretty
332332
333333
334- Configure CPU model for KVM guest (Optional)
334+ Configure CPU model for KVM guests (Optional)
335335^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
336336
337- In additional,the CloudStack Agent allows host administrator to control
338- the guest CPU model which is exposed to KVM Instances. By default, the
339- CPU model of KVM Instance is likely QEMU Virtual CPU version x.x.x with
340- least CPU features exposed. There are a couple of reasons to specify the
341- CPU model:
337+ The CloudStack Agent allows host administrators to control
338+ the CPU model which is exposed to KVM instances. By default, the
339+ default QEMU CPU models (``qemu32 `` or ``qemu64 ``) will be used, which
340+ are designed to be compatible with all hosts and, as a consequence, will
341+ expose the least amount of CPU features possible. Therefore, there are
342+ a couple of reasons to specify the CPU model:
342343
343- - To maximise performance of Instances by exposing new host CPU
344- features to the KVM Instances;
344+ - Maximize performance of instances by exposing new host CPU
345+ features to them; and,
345346
346- - To ensure a consistent default CPU across all machines,removing
347- reliance of variable QEMU defaults;
347+ - Ensure a consistent default CPU across all machines, removing
348+ reliance of variable QEMU defaults.
348349
349- For the most part it will be sufficient for the host administrator to
350- specify the guest CPU config in the per-host configuration file
351- (/etc/cloudstack/agent/agent.properties). This will be achieved by
352- introducing following configuration parameters:
350+ The guest CPU configuration can be configured per host in the
351+ ``/etc/cloudstack/agent/agent.properties `` configuration file
352+ through the following properties: ``guest.cpu.mode ``, ``guest.cpu.model `` and ``guest.cpu.features ``.
353353
354- .. parsed-literal : :
354+ The `` guest.cpu.mode `` property accepts three possible values :
355355
356- guest.cpu.mode=custom|host-model|host-passthrough
357- guest.cpu.model=from /usr/share/libvirt/cpu_map.xml(only valid when guest.cpu.mode=custom)
358- guest.cpu.features=vmx ept aes smx mmx ht (space separated list of cpu flags to apply)
356+ #. **custom: ** Allows the customization of the CPU model, which
357+ should be defined in the ``guest.cpu.model `` setting. For instance:
359358
360- There are three choices to fulfill the cpu model changes :
359+ .. parsed-literal : :
361360
362- #. ** custom: ** you can explicitly specify one of the supported named
363- model in /usr/share/libvirt/ cpu\_ map.xml
361+ guest.cpu.mode=custom
362+ guest. cpu.model=SandyBridge
364363
365- #. **host-model: ** libvirt will identify the CPU model in
366- /usr/share/libvirt/cpu\_ map.xml which most closely matches the host,
364+ The available CPU models for a given architecture can be retrieved by
365+ executing ``virsh cpu-models <architecture> ``. The XML definition of each
366+ available model can be accessed at the ``/usr/share/libvirt/cpu_map/ ``
367+ path of the KVM hosts.
368+
369+ #. **host-model: ** Libvirt will identify the CPU model in
370+ ``/usr/share/libvirt/cpu_map `` which most closely matches the host's CPU,
367371 and then request additional CPU flags to complete the match. This
368- should give close to maximum functionality/performance, which
369- maintaining good reliability/compatibility if the guest is migrated
370- to another host with slightly different host CPUs.
371-
372- #. **host-passthrough: ** libvirt will tell KVM to passthrough the host
373- CPU with no modifications. The difference to host-model, instead of
374- just matching feature flags, every last detail of the host CPU is
375- matched. This gives absolutely best performance, and can be important
376- to some apps which check low level CPU details, but it comes at a
372+ should give close to maximum functionality/performance and
373+ maintains good reliability/compatibility if the guest is migrated
374+ to another host with slightly different CPUs.
375+
376+ #. **host-passthrough: ** Libvirt will tell KVM to passthrough the host
377+ CPU with no modifications. The difference to `` host-model `` is that , instead of
378+ just matching CPU flags, every last detail of the host's CPU is
379+ matched. This gives absolutely best performance and can be important
380+ to some apps that check low level CPU details. However, it comes at a
377381 cost with respect to migration: the guest can only be migrated to an
378- exactly matching host CPU.
382+ exactly matching host's CPU.
383+
384+ Furthermore, there is the ``guest.cpu.features `` setting that can be used
385+ to add or remove individual CPU features. It is important to highlight
386+ that Libvirt complains about specifying a list of flags without a CPU model.
387+ Therefore, to apply CPU flags in KVM, one of the following requirements must be met:
388+
389+ - Define ``guest.cpu.mode=host-model `` and specify the flags;
390+ - Define ``guest.cpu.mode=host-passthrough `` and specify the flags; or,
391+ - Define ``guest.cpu.mode=custom ``, ``guest.cpu.model=<cpu-model> `` and specify the flags.
379392
380393Here are some examples:
381394
382- - custom
395+ - Custom CPU model:
383396
384397 .. parsed-literal ::
385398
386399 guest.cpu.mode=custom
387400 guest.cpu.model=SandyBridge
388401
389- - host- model
402+ - Host model:
390403
391404 .. parsed-literal ::
392405
393406 guest.cpu.mode=host-model
394407
395- - host- passthrough
408+ - Host passthrough, adding the `` vmx `` and `` avx `` CPU flags, and removing the `` mmx `` one:
396409
397410 .. parsed-literal ::
398411
399412 guest.cpu.mode=host-passthrough
400- guest.cpu.features=vmx
413+ guest.cpu.features=vmx avx -mmx
401414
402415 .. note ::
403- host-passthrough may lead to migration failure,if you have this problem,
404- you should use host-model or custom. guest.cpu.features will force cpu features
405- as a required policy so make sure to put only those features that are provided
406- by the host CPU. As your kvm cluster needs to be made up of homogeneous nodes anyway
407- (see System Requirements), it might make most sense to use guest.cpu.mode=host-model
408- or guest.cpu.mode=host-passthrough.
416+ `` host-passthrough `` may lead to migration failure. If you have this problem,
417+ you should use `` host-model `` or a custom CPU model. `` guest.cpu.features `` will force CPU features
418+ as a required policy, so make sure to put only those features that are provided
419+ by the host's CPU. As your KVM cluster needs to be made up of homogeneous nodes
420+ (see System Requirements), it might make most sense to use `` guest.cpu.mode=host-model ``
421+ or `` guest.cpu.mode=host-passthrough `` .
409422
410423Install and Configure libvirt
411424~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0 commit comments