On 2013年01月08日 01:27, Daniel P. Berrange wrote:
On Tue, Jan 08, 2013 at 01:05:23AM +0800, Osier Yang wrote:
> Since the name (like scsi_host10) is not stable for vHBA, (it can
> be changed either after recreating or system rebooting), current
> API virNodeDeviceFindByName is not nice to use for management app
> in this case. (E.g. one wants to destroy the vHBA whose name has
> been changed after system rebooting, he has to find out current
> name first).
>
> Later patches will support the persistent vHBA via storage pool,
> with which one can identify the vHBA stably by the wwnn&& wwpn
> pair.
>
> So this new API comes.
> ---
> include/libvirt/libvirt.h.in | 5 ++++
> src/driver.h | 6 +++++
> src/libvirt.c | 45 ++++++++++++++++++++++++++++++++++++++++++
> src/libvirt_public.syms | 1 +
> 4 files changed, 57 insertions(+), 0 deletions(-)
>
> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
> index 09c89c5..b4e1ead 100644
> --- a/include/libvirt/libvirt.h.in
> +++ b/include/libvirt/libvirt.h.in
> @@ -3156,6 +3156,11 @@ int virConnectListAllNodeDevices
(virConnectPtr conn,
> virNodeDevicePtr virNodeDeviceLookupByName (virConnectPtr conn,
> const char *name);
>
> +virNodeDevicePtr virNodeDeviceLookupByWWN (virConnectPtr conn,
> + const char *wwnn,
> + const char *wwpn,
> + unsigned int flags);
Since this API doesn't work for all types of node dev, its name
should really reflect that. eg
virNodeDeviceLookupSCSIHostByWWN()
Agreed, and v2 posted.