On 18.03.2015 09:33, Maxim Nestratov wrote:
In order to support 'bridge' network adapters in parallels
driver we need to plug our veth devices into corresponding
linux bridges.
We are going to do this by reusing our abstraction of
Virtual Networks in terms of PCS. On a domain creation, we
create a new Virtual Network naming it with the same name
as a source bridge for each network interface.
Having done this, we plug PCS veth interfaces created with names of
target dev into specified bridges using our standard PCS procedures
Signed-off-by: Maxim Nestratov <mnestratov(a)parallels.com>
---
src/parallels/parallels_sdk.c | 99 +++++++++++++++++++++++++++++++++++-----
1 files changed, 86 insertions(+), 13 deletions(-)
diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c
index d3fb5d4..58c52a8 100644
--- a/src/parallels/parallels_sdk.c
+++ b/src/parallels/parallels_sdk.c
@@ -691,9 +691,6 @@ prlsdkGetNetInfo(PRL_HANDLE netAdapter, virDomainNetDefPtr net, bool
isCt)
/* use device name, shown by prlctl as target device
* for identifying network adapter in virDomainDefineXML */
- pret = PrlVmDev_GetIndex(netAdapter, &netAdapterIndex);
- prlsdkCheckRetGoto(pret, cleanup);
-
pret = PrlVmDevNet_GetHostInterfaceName(netAdapter, NULL, &buflen);
prlsdkCheckRetGoto(pret, cleanup);
@@ -703,6 +700,9 @@ prlsdkGetNetInfo(PRL_HANDLE netAdapter, virDomainNetDefPtr net, bool
isCt)
pret = PrlVmDevNet_GetHostInterfaceName(netAdapter, net->ifname, &buflen);
prlsdkCheckRetGoto(pret, cleanup);
+ pret = PrlVmDev_GetIndex(netAdapter, &netAdapterIndex);
+ prlsdkCheckRetGoto(pret, cleanup);
+
if (isCt && netAdapterIndex == (PRL_UINT32) -1) {
/* venet devices don't have mac address and
* always up */
@@ -740,6 +740,16 @@ prlsdkGetNetInfo(PRL_HANDLE netAdapter, virDomainNetDefPtr net, bool
isCt)
net->data.network.name,
&buflen);
prlsdkCheckRetGoto(pret, cleanup);
+
+ /*
+ * We use VIR_DOMAIN_NET_TYPE_NETWORK for all network adapters
+ * except those whose Virtual Network Id differ from Parallels
+ * predefined ones such as PARALLELS_DOMAIN_BRIDGED_NETWORK_NAME
+ * and PARALLELS_DONAIN_ROUTED_NETWORK_NAME
+ */
+ if (!STREQ(net->data.network.name, PARALLELS_DOMAIN_BRIDGED_NETWORK_NAME))
s/!STREQ/STRNEQ/
I'll fix that when pushing.
Michal