
On 07/22/2014 11:09 PM, Martin Kletzander wrote:
On Tue, Jul 22, 2014 at 01:11:03PM -0600, Eric Blake wrote:
https://bugzilla.redhat.com/show_bug.cgi?id=1122205
Although the edits were changing in-memory XML, it was not flushed to disk; so unless some other action changes XML, a libvirtd restart would lose the changed information.
And there are more places like that. Take a qemuDomainSetNumaParameters() for example.
That's what I was afraid of - that I'd be stuck with auditing other uses all because I stumbled on this one while testing a similar fix to blockcopy. :/
Would it be possible (as in "not devastatingly hard" to create a syntax-check rule for *_driver.c files (only those that are applicable, mostly stateful) that would check if virCheckFlags is called with VIR_DOMAIN_AFFECT_LIVE and if yes, then that function would have to call virDomainSaveStatus() as well?
Via a .pl script maybe, but even that is hard, because sometimes (as in this patch) the call to virDomainSaveStatus() is delegated to a helper function in another file than where the API call checks flags. It's not just AFFECT_LIVE, but any time where we modify a virDomainDefPtr (whether live or config), then those modifications have to be written back to disk before ending the API.
[...]
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 4b00280..6ed6155 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c [...] @@ -19753,9 +19757,12 @@ virDomainObjSetMetadata(virDomainObjPtr vm, &persistentDef) < 0) return -1;
- if (flags & VIR_DOMAIN_AFFECT_LIVE) + if (flags & VIR_DOMAIN_AFFECT_LIVE) { if (virDomainDefSetMetadata(vm->def, type, metadata, key, uri) < 0) return -1;
One empty line right here would perfectly go with the rest of the function ;)
ACK with or without this change,
Martin
Thanks, will push shortly. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org