> For the complete documentation index, see [llms.txt](https://teamsmiley.gitbook.io/devops/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://teamsmiley.gitbook.io/devops/kvm/kvm-cpu-model.md).

# kvm cpu model

KVM에는 cpu model이 있습니다. 다음과 같은 모델이 있습니다.

* host-passthrough
* host-model
* named-model

## 사용법

사용법은 xml에 다음처럼 추가하면 됩니다.

### Host passthrough

```xml
<cpu mode='host-passthrough'/>
```

Host passthrough with feature customization:

```xml
<cpu mode='host-passthrough'>
    <feature name="vmx" policy="disable"/>
    ...
</cpu>
```

### Host model:

```xml
<cpu mode='host-model'/>
```

Host model with feature customization:

```xml
<cpu mode='host-model'>
    <feature name="vmx" policy="disable"/>
    ...
</cpu>
```

### Named model:

```xml
<cpu mode='custom'>
    <model name="Westmere"/>
</cpu>
```

Named model with feature customization:

```xml
<cpu mode='custom'>
    <model name="Westmere"/>
    <feature name="pcid" policy="require"/>
    ...
</cpu>
```

아무것도 설정을 안하면 기본 버전으로 적용되는거 같습니다.

kvm버전에 따라서 기본 버전이 달라지는걸로 보입니다.

vm에서 다음처럼 확인해보시면

```
cat /proc/cpuinfo
```

![](https://3379277180-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MaoWGMVdC3ztoOAzHPq%2Fuploads%2Fgit-blob-8db4d897bf560491b10b443279cb168ea2781bfb%2F2022-10-15-17-49-40.png?alt=media)

기본 버전으로 나오네요

host-passthrough 를 적용해보면 다음과 같이 나옵니다.

![](https://3379277180-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MaoWGMVdC3ztoOAzHPq%2Fuploads%2Fgit-blob-30b463800c534c558165d6593653718899a99c69%2F2022-10-15-17-50-55.png?alt=media)

실제 물리서버의 cpu 정보가 보입니다.

## todo

`host-passthrough` vs `host-model` 두개의 차이점은 알아보기

## openenbula에서 설정하기

다음 처럼 설정할수 있습니다. ![](https://3379277180-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MaoWGMVdC3ztoOAzHPq%2Fuploads%2Fgit-blob-e8673d5fde4b09548465e4c7ee9c94b0bc40f170%2F2022-10-15-17-48-06.png?alt=media)
