[libvirt] how to adjust the value passed by xml dynamicly

Michal Privoznik mprivozn at redhat.com
Fri Feb 7 08:42:03 UTC 2014


On 07.02.2014 09:06, yue wrote:
> hi,all
> we can pass value throught xml when start vm.  how to adjust the value
> dynamicly as needed  while vm is running via API calls?
> for example , change from
>   <filterref filter='hcount'>
>          <parameter name='HC' value='6'/>
>          <parameter name='HC' value='10'/>
>        </filterref>
> to
> <filterref filter='hcount'>
> <parameter name='HC' value='16'/>
> <parameter name='HC' value='20'/>
> </filterref>
> i do not want to restart or interrupt  the running state of vms(via api,
> not command line tools).
>

These (or any other values) can be changed byt re-defining the domain again:

char *xml = virDomainGetXMLDesc();
/* change the desired values in @xml */
virDomainDefine(conn, xml);
free(xml);


However, this works only on 'config' level - the changes will be applied 
the next time domain is started.

For a runtime change, maybe you can use virDomainUpdateDeviceFlags() but 
I haven't try if it works with <filterref/>.

Michal




More information about the libvir-list mailing list