I'm not sure what you mean about mapping 

lets take the pnics as a study case for me

do I need to define a structure similar to this:
http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.host.PhysicalNic.html

and also take care for it's allocation?




From: Matthias Bolte <matthias.bolte@googlemail.com>
To: Shahar Klein <shaharklein@yahoo.com>
Cc: Chris Lalancette <clalance@redhat.com>; libvir-list@redhat.com
Sent: Wednesday, September 9, 2009 1:11:47 PM
Subject: Re: [libvirt] Interface driver and ESX support

2009/9/9 Shahar Klein <shaharklein@yahoo.com>:
> I think I understand the mechanism of the VI API
> and the way esx_vi.c is using it
> the surounding is a bit more complex for me
> so
> can you provide the framework?
> I mean
> can you put in the esx_interface_driver.c and h
> and the registration etc...
> and also putting it all into the auto make mechanism(I should learn this
> sometime...)
> I will put in the content into the functions
> for the time being I am registering the esx_driver as the interface driver
> so I can get a fill of it

Well, if you want to give it a try, here you go.

I attached a patch that adds a basic interface driver with open and
close method. The interface driver doesn't need it's own private
driver struct, it just uses the same context already opened by the
main ESX driver.

Listing the available physical NICs should be easy. You'll need to
obtain the HostSystem object and query for its config.network.pnic
property. This is a list of PhysicalNic objects. You'll need to add a
mapping for the PhysicalNic type to the esx_vi_types.[ch]. There is
plenty of examples in the current ESX driver how to do all these
things.

Matthias