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
something like that:
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 8d1af71..677f778 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -3018,7 +3018,89 @@ esxDomainMigrateFinish(virConnectPtr dconn, const char *dname,
return esxDomainLookupByName(dconn, dname);
}
+struct interface_driver
+{
+ virMutex lock;
+};
+
+static virDrvOpenStatus esxInterfaceOpenInterface(virConnectPtr conn,
+ virConnectAuthPtr auth ATTRIBUTE_UNUSED,
+
int flags ATTRIBUTE_UNUSED)
+{
+ struct interface_driver *driverState;
+
+ if (VIR_ALLOC(driverState) < 0)
+ {
+ virReportOOMError(conn);
+ goto alloc_error;
+ }
+
+ /* initialize non-0 stuff in driverState */
+ if (virMutexInit(&driverState->lock) < 0)
+ {
+ /* what error to report? */
+ goto mutex_error;
+ }
+
+
+ conn->interfacePrivateData = driverState;
+ return 0;
+mutex_error:
+ VIR_FREE(driverState);
+alloc_error:
+ return
-1;
+}
+
+static int esxInterfaceCloseInterface(virConnectPtr conn)
+{
+
+ if (conn->interfacePrivateData != NULL)
+ {
+ struct interface_driver *driver = conn->interfacePrivateData;
+ /* destroy lock */
+ virMutexDestroy(&driver->lock);
+ /* free driver state */
+ VIR_FREE(driver);
+ }
+ conn->interfacePrivateData = NULL;
+ return 0;
+}
+
+static int esxInterfaceNumOfInterfaces(virConnectPtr conn)
+{
+ int count = 7;
+ return count;
+}
+
+static
virInterfaceDriver esxInterfaceDriver = {
+ "EsxInterface",
+ esxInterfaceOpenInterface, /* open */
+ esxInterfaceCloseInterface, /* close */
+ esxInterfaceNumOfInterfaces, /* numOfInterfaces */
+ NULL, /* listInterfaces */
+ NULL, /* numOfInterfaces */
+ NULL, /* listInterfaces */
+ NULL, /* interfaceLookupByName */
+ NULL, /* interfaceLookupByMACSTring */
+ NULL, /* interfaceGetXMLDesc */
+ NULL, /* interfaceDefineXML */
+
NULL, /* interfaceUndefine */
+ NULL, /* interfaceCreate */
+ NULL, /* interfaceDestroy */
+#if 0
+ esxInterfaceListInterfaces, /* listInterfaces */
+ esxInterfaceNumOfDefinedInterfaces, /* numOfInterfaces */
+ esxInterfaceListDefinedInterfaces, /* listInterfaces */
+ esxInterfaceLookupByName, /* interfaceLookupByName */
+ esxInterfaceLookupByMACString, /* interfaceLookupByMACSTring */
+ esxInterfaceGetXMLDesc, /* interfaceGetXMLDesc */
+
esxInterfaceDefineXML, /* interfaceDefineXML */
+ esxInterfaceUndefine, /* interfaceUndefine */
+ esxInterfaceCreate, /* interfaceCreate */
+ esxInterfaceDestroy, /* interfaceDestroy */
+#endif
+};
static virDriver esxDriver = {
VIR_DRV_ESX,
@@ -3096,6 +3178,7 @@ int
esxRegister(void)
{
virRegisterDriver(&esxDriver);
+ virRegisterInterfaceDriver(&esxInterfaceDriver);
return 0;
}
From: Matthias Bolte <matthias.bolte@xxxxxxxxxxxxxx>
To: Shahar Klein <shaharklein@xxxxxxxxx>
Cc: Chris Lalancette <clalance@xxxxxxxxxx>; libvir-list@xxxxxxxxxx
Sent: Wednesday, September 9, 2009 11:37:17 AM
Subject: Re: [libvirt] Interface driver and ESX support
2009/9/9 Shahar Klein <shaharklein@xxxxxxxxx>:
> Let me rephrase my question : )
> In the current libvirt infrastructure I can do a lot of things with libvirt
> and a remote ESX node
> I can list all the guests
> I can suspend a guest
> I can get a lot of node info
> and much more....
> can I (for example)
> 1. add NIC to a guest domain
The attach/detach device driver functions aren't implemented yet, but
that's on my todo list.
> 2. list all the physical interfaces on a node
The VI API contains methods and types to do this. It requires a new
interface driver as Chris already said. This is not implemented yet,
but that's on my todo list.
> If not - what do I need to develop
> should I expand the current driver
> or
> should I need to develop a new interface driver(like netcf)
> or
> maybe I can assign the current esx driver as the interface driver and expand
> it to handle the relvant requests
> 10x again
> Shahar
>
The basic question is: How urgent is this for you? Do you need it now
or can you wait some time until I implemented it?
PS: I just finished the implementation of the driver function for
virDomainDefineXML(). I need to cleanup the patches a bit and will
post them by the end of the week, depends on how fast I can get done
some other urgent, university related work.
-- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list