Signed-off-by: Maxim Nestratov <mnestratov(a)parallels.com>
---
src/parallels/parallels_network.c | 6 +++---
src/parallels/parallels_sdk.c | 6 +++---
src/parallels/parallels_utils.h | 8 +++++++-
3 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/parallels/parallels_network.c b/src/parallels/parallels_network.c
index 62ed268..26767c0 100644
--- a/src/parallels/parallels_network.c
+++ b/src/parallels/parallels_network.c
@@ -211,12 +211,12 @@ parallelsLoadNetwork(parallelsConnPtr privconn, virJSONValuePtr
jobj)
goto cleanup;
}
- if (STREQ(tmp, "bridged")) {
+ if (STREQ(tmp, PARALLELS_BRIDGED_NETWORK_TYPE)) {
def->forward.type = VIR_NETWORK_FORWARD_BRIDGE;
if (parallelsGetBridgedNetInfo(def, jobj) < 0)
goto cleanup;
- } else if (STREQ(tmp, "host-only")) {
+ } else if (STREQ(tmp, PARALLELS_HOSTONLY_NETWORK_TYPE)) {
def->forward.type = VIR_NETWORK_FORWARD_NONE;
if (parallelsGetHostOnlyNetInfo(def, def->name) < 0)
@@ -249,7 +249,7 @@ parallelsAddRoutedNetwork(parallelsConnPtr privconn)
def->forward.type = VIR_NETWORK_FORWARD_ROUTE;
- if (VIR_STRDUP(def->name, PARALLELS_ROUTED_NETWORK_NAME) < 0)
+ if (VIR_STRDUP(def->name, PARALLELS_DOMAIN_ROUTED_NETWORK_NAME) < 0)
goto cleanup;
if (virUUIDParse(PARALLELS_ROUTED_NETWORK_UUID, def->uuid) < 0) {
diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c
index fec145d..c31439f 100644
--- a/src/parallels/parallels_sdk.c
+++ b/src/parallels/parallels_sdk.c
@@ -709,7 +709,7 @@ prlsdkGetNetInfo(PRL_HANDLE netAdapter, virDomainNetDefPtr net, bool
isCt)
* always up */
net->linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_UP;
if (VIR_STRDUP(net->data.network.name,
- PARALLELS_ROUTED_NETWORK_NAME) < 0)
+ PARALLELS_DOMAIN_ROUTED_NETWORK_NAME) < 0)
goto cleanup;
return 0;
}
@@ -728,7 +728,7 @@ prlsdkGetNetInfo(PRL_HANDLE netAdapter, virDomainNetDefPtr net, bool
isCt)
if (emulatedType == PNA_ROUTED) {
if (VIR_STRDUP(net->data.network.name,
- PARALLELS_ROUTED_NETWORK_NAME) < 0)
+ PARALLELS_DOMAIN_ROUTED_NETWORK_NAME) < 0)
goto cleanup;
} else {
pret = PrlVmDevNet_GetVirtualNetworkId(netAdapter, NULL, &buflen);
@@ -2644,8 +2644,8 @@ static int prlsdkAddNet(PRL_HANDLE sdkdom, virDomainNetDefPtr net)
pret = PrlVmDevNet_SetMacAddress(sdknet, macstr);
prlsdkCheckRetGoto(pret, cleanup);
- if (STREQ(net->data.network.name, PARALLELS_ROUTED_NETWORK_NAME)) {
pret = PrlVmDev_SetEmulatedType(sdknet, PNA_ROUTED);
+ if (STREQ(net->data.network.name, PARALLELS_DOMAIN_ROUTED_NETWORK_NAME)) {
prlsdkCheckRetGoto(pret, cleanup);
} else {
pret = PrlVmDevNet_SetVirtualNetworkId(sdknet, net->data.network.name);
diff --git a/src/parallels/parallels_utils.h b/src/parallels/parallels_utils.h
index ead5586..a1c7c60 100644
--- a/src/parallels/parallels_utils.h
+++ b/src/parallels/parallels_utils.h
@@ -47,7 +47,13 @@
_("no domain with matching uuid '%s'"),
uuidstr); \
} while (0)
-# define PARALLELS_ROUTED_NETWORK_NAME "Routed"
+# define PARALLELS_DOMAIN_ROUTED_NETWORK_NAME "Routed"
+# define PARALLELS_DOMAIN_BRIDGED_NETWORK_NAME "Bridged"
+
+# define PARALLELS_REQUIRED_HOSTONLY_NETWORK "Host-Only"
+# define PARALLELS_HOSTONLY_NETWORK_TYPE "host-only"
+# define PARALLELS_REQUIRED_BRIDGED_NETWORK "Bridged"
+# define PARALLELS_BRIDGED_NETWORK_TYPE "bridged"
struct _parallelsConn {
virMutex lock;
--
1.7.1