[virt-tools-list] passing custom parameters to kvm?

Cole Robinson crobinso at redhat.com
Fri Sep 3 13:40:35 UTC 2010


On 09/03/2010 07:50 AM, Matthias Bolte wrote:
> 2010/9/2 Tomasz Chmielewski <mangoo at wpkg.org>:
>> On 02.09.2010 22:31, Tomasz Chmielewski wrote:
>>>
>>> How can I pass custom parameters to kvm?
>>>
>>> I'm trying to pass this simple argument: -host cpu
>>
>> Of course I meant: -cpu host
> 
> You can specify custom QEMU commandline arguments since libvirt 0.8.3.
> 
> Try to replace
> 
>    <domain type='kvm'>
>      ...
>    </domain>
> 
> by
> 
>   <domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
>      ...
>     <qemu:commandline>
>       <qemu:arg value='-cpu'/>
>       <qemu:arg value='host'/>
>     </qemu:commandline>
>   </domain>
> 
> in the XML config of the domain using 'virsh edit <domain-name>'.
> 
> But make sure that you don't add a <cpu> element to the XML config
> then, because that would result in two -cpu options in the final
> commandline.
> 

In this case, the domain <cpu> XML can actually get us something
virtually identical to qemu -cpu host

virsh capabilities | grep model  will show you what libvirt detects your
CPU model as. Then stick that in the following block:

  <cpu match='minimum>
    <model>$MYMODEL</model>
  </cpu>

put it under the <domain> element in your VM config. It will look at
your local CPU flags and build a -cpu line with each flag individually.
So it is HIGHLY recommended you use that method rather than QEMU command
line passthrough, since we want to limit people using the passthrough
option only when absolutely necessary.

- Cole




More information about the virt-tools-list mailing list