On 03/18/2011 10:13 AM, Daniel P. Berrange wrote:
> I am not completely convinced this is what we want. If domain
has
> exactly one NIC, device-detach semantic is clear. Or if we want to
> allow detaching interface by PCI address - MAC shouldn't be
> required, because it is redundant.
You're missing my point here - virsh is what is broken. It should *not*
be trying to guess what the unique attribute the HV driver wants. Each
HV may have different decision about this. Applications using the method
virDomainDetachDevice, are required to pass the full XML description for
the device to be detached as it is currently shown in the guest XML
config.
virsh really needs to call virDomainDumpXML and then extract the
<inteface> element that it wishes to detach, rather than trying
to craft some partial XML description on what it thinks the HV
might want.
If I'm understanding correctly: In other words, we can still do some
smarts where partial info from the user is turned into the right
interface, but the smarts should live in virsh not the drivers. That
is, virsh is the one that should say dumpxml only gave one device so
that's the one to delete, vs. dumpxml gave two devices, so some
additional argument (be it --mac, --address, or something else) better
be present and unambiguously match one of the two devices.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org