On 09/17/2013 10:46 AM, Michal Privoznik wrote:
A while ago I've invented this vshCompleteXMLFromDomain()
function to increase
device-detach intelligence. Basically, it took user's XML and tried to find
matching device in domain's XML. However, it was kind of buggy - finding the
matching device uses string comparison. This works on text values. It doesn't
on integer ones (who would expect that). So prior the lookup process, we need
to normalize the integer values (and whole XML). However, this can't be done on
the client side, since he has no knowledge which values are integer and which
are not. Therefore we need a new API.
Michal Privoznik (8):
domain_conf: Introduce virDomainDeviceDefFormat
Introduce new virDomainNormalizeXML API
remote_driver: Implement virDomainNormalizeXML
virsh: Expose virDomainNormalizeXML
qemu: Implement vimDomainNormalizeXML
domain_conf: Move MAC generation to post parse callback
virDomainDeviceDefParse: Make PostParse callback call optional
virsh: Resurrect vshCompleteXMLFromDomain
Seems overkill IMO. Do we really need to add an API to facilitate the crappy
interface that is virsh detach-device? Will any other application ever want to
use this API?
Why not allow something like
virsh detach-device --device-number disk:2
Which will remove the second disk device? It's friendly-ish, easy to extend,
and simple to implement.
- Cole