
On 05.08.2012 22:10, Matthias Bolte wrote:
Lists available PhysicalNic devices. A PhysicalNic is always active and can neither be defined nor undefined.
A PhysicalNic is used to bridge a HostVirtualSwitch to the physical network. ---
This implementation differs from Ata's. It just lists PhysicalNics instead of listing HostVirtualNics as bridges.
src/esx/esx_interface_driver.c | 239 +++++++++++++++++++++++++++++++++++++++- src/esx/esx_vi.c | 144 ++++++++++++++++++++++++- src/esx/esx_vi.h | 13 ++- src/esx/esx_vi_generator.input | 34 ++++++- src/esx/esx_vi_generator.py | 5 +- 5 files changed, 430 insertions(+), 5 deletions(-)
diff --git a/src/esx/esx_interface_driver.c b/src/esx/esx_interface_driver.c index 501409a..a78a744 100644 --- a/src/esx/esx_interface_driver.c +++ b/src/esx/esx_interface_driver.c @@ -4,7 +4,7 @@ * host interfaces * * Copyright (C) 2010-2011 Red Hat, Inc. - * Copyright (C) 2010 Matthias Bolte <matthias.bolte@googlemail.com> + * Copyright (C) 2010-2012 Matthias Bolte <matthias.bolte@googlemail.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -29,6 +29,8 @@ #include "memory.h" #include "logging.h" #include "uuid.h" +#include "interface_conf.h" +#include "virsocketaddr.h" #include "esx_private.h" #include "esx_interface_driver.h" #include "esx_vi.h" @@ -67,10 +69,245 @@ esxInterfaceClose(virConnectPtr conn)
+static int +esxNumberOfInterfaces(virConnectPtr conn) +{ + esxPrivate *priv = conn->interfacePrivateData; + esxVI_PhysicalNic *physicalNicList = NULL; + esxVI_PhysicalNic *physicalNic = NULL; + int count = 0; + + if (esxVI_EnsureSession(priv->primary) < 0 || + esxVI_LookupPhysicalNicList(priv->primary, &physicalNicList) < 0) { + return -1; + } + + for (physicalNic = physicalNicList; physicalNic != NULL; + physicalNic = physicalNic->_next) { + ++count;
We tend to write postfix notation here; but since this prefix notation is used among whole esx code I guess it's okay to keep it as is.
+ } + + esxVI_PhysicalNic_Free(&physicalNicList); + + return count; +} + + +
ACK Michal