[libvirt] [PATCH v6] npiv: Auto-generate WWN if it's not specified

Eric Blake eblake at redhat.com
Tue Feb 7 13:29:01 UTC 2012

On 02/07/2012 06:38 AM, Osier Yang wrote:
> The auto-generated WWN comply with the new addressing schema of WWN:
> <quote>
> the first nibble is either hex 5 or 6 followed by a 3-byte vendor
> identifier and 36 bits for a vendor-specified serial number.
> </quote>
> We choose hex 5 for the first nibble. And for the 3-bytes vendor ID,
> we uses the OUI according to underlying hypervisor type, (invoking
> virConnectGetType to get the virt type). e.g. If virConnectGetType
> returns "QEMU", we use Qumranet's OUI (00:1A:4A), if returns
> ESX|VMWARE, we use VMWARE's OUI (00:05:69). Currently it only
> supports qemu|xen|libxl|xenapi|hyperv|esx|vmware drivers. The last
> 36 bits are auto-generated.

> +
> +#define QUMRANET_OUI "001a4a"
> +#define VMWARE_OUI "000569"
> +#define MICROSOFT_OUI "0050f2"
> +#define XEN_OUI "00163e"
> +
> +int
> +virRandomGenerateWWN(char **wwn,
> +                     const char *virt_type) {

I don't like this interface - it makes virrandom.c know too much.  A
better interface would be:

virRandomGenerateWWN(char **wwn, const char *oui)

where the caller is responsible for determining the appropriate OUI for
the hypervisor to be passed in.

Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120207/f0f7d29c/attachment-0001.sig>

More information about the libvir-list mailing list