[libvirt-users] xl extra parameters equivalent for libvirt

Jim Fehlig jfehlig at suse.com
Wed May 20 14:46:22 UTC 2015


Eric Blake wrote:
> On 05/18/2015 01:02 PM, Jim Fehlig wrote:
>   
>> On 05/18/2015 11:35 AM, Emma Anderson wrote:
>>     
>>> hi,
>>>
>>> I use xl toolstack to manage vms on a Xen machine, and also pass some
>>> custom parameters when creating a vm, for example:
>>>
>>> xl create vm.cfg ' param="xyz" '
>>>       
>> Documentation on create subcommand in the xl man page describes the
>> 'key=value' options as
>>
>> key=value
>> It is possible to pass key=value pairs on the command line to provide
>> options as if
>> they were written in the configuration file; these override whatever is
>> in the
>> configfile.
>>
>>     
>>> I am moving to libvirt for vm management. How I can pass those extra
>>> parameters using libvirt?
>>>       
>> I'm not aware of similar functionality in libvirt.  You would need to
>> customize the domXML before feeding it to 'virsh create'.
>>     
>
> Qemu domains have that ability, via an XML namespace that adds
> <qemu:commandline>:
> http://libvirt.org/drvqemu.html#qemucommand
>
> but no one has yet implemented that for Xen domains.  If you want to add
> it, the src/qemu code would be the obvious starting point to copy from.
>   

IIUC, Emma is asking about adding/replacing entries in a config template
when creating the domain.  E.g. a 'template.xl' config file might contain

memory=1024
maxmem=1024
vcpus=4
on_poweroff="destroy"
on_reboot="restart"
on_crash="destroy"
localtime=0
builder="linux"
extra='ignore_loglevel'
vfb=['type=vnc,vncunused=1']

The template can be "customized" when creating the domain by adding new
entries or overriding existing ones, using 'xl create's key=value
syntax.  E.g.

xl create template.xl extra='ignore_loglevel 3 splash=silent'
name='sales-webserver' uuid='blabla'

'key' must be one of the supported config items in xl.cfg(5).  The
libvirt equivalent would be something like

virsh create template.xml --cmdline 'ignore_loglevel 3 splash=silent'
--name sales-webserver --uuid blabla

but I don't think that is supported :-).

Regards,
Jim





More information about the libvirt-users mailing list