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

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).

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

On 02/07/2014 01:42 AM, Michal Privoznik wrote:
<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).
If you can make the change using the virsh command line tool, then you can make the same change using API (since virsh is just a shell wrapper around the API).
For a runtime change, maybe you can use virDomainUpdateDeviceFlags() but I haven't try if it works with <filterref/>.
I see 'virsh nwfilter-edit' as a way to edit a nwfilter definition; but I'm not familiar enough with nwfilter to know if live edits of the hcount filterref will affect a live domain definition. It seems like it should be doable technically, although it may require someone to write a patch. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (3)
-
Eric Blake
-
Michal Privoznik
-
yue