[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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

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 redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]