On 09/06/2012 07:43 AM, Daniel P. Berrange wrote: >> =========== >> OPTION 3) Again, a single API, but with an added "nodespec" arg which would >> be used to describe the parent node you of the node you want added/updated to: >> >> 3) Can you think of a situation where this wouldn't work? > > In a libvirt API where you don't use XML directly. > > > The thing I like about option 3 is that you are just passing in little > snippets of XML to either add/remove/modify. But we need to figure out > a better way todo this, without using XPath markers IMHO. Option 4 Instead of an arbitrary XPath marker, can we come up with an enum of possible change sites? That would mean the user doesn't have quite as much flexibility (passing an int instead of string), but we are still extensible as new changeable sites make sense (add another enum constant). There's still some disambiguation needed, but I suppose you could obtain that by passing (a subset of) the original XML sufficient to provide the context necessary. For example, /* full text of <host> element to add to <dhcp>, embedded in * enough partial context from the original xml as to find the * right <dhcp> to add it to */ virNetworkUpdate(VIR_NETWORK_UPDATE_DHCP, "<network>" " <ip address='10.24.75.1'>" " <dhcp>" " <host mac='00:16:3e:77:e2:ed' " " name='X.example.com' ip='10.24.75.10'/>" " </dhcp>" " </ip>" "</network>", VIR_NETWORK_UPDATE_ADD | VIR_NETWORK_UPDATE_LIVE | VIR_NETWORK_UPDATE_CONFIG); Not sure I like it any better, but at least it's more targetted than option 1 (you can't change arbitrary code, just the section highlighted by the enum value and the choice of add, remove, or replace), so the diff'ing is a bit easier. -- Eric Blake eblake@xxxxxxxxxx +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list