提交 c34a9d6e 编写于 作者: N Nikolay Shirokovskiy 提交者: Maxim Nestratov

vz: dump route info in domain xml

Signed-off-by: NNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
上级 b86396dc
......@@ -60,7 +60,7 @@ virNetworkRouteDefFree(virNetworkRouteDefPtr def)
virNetworkRouteDefPtr
virNetworkRouteDefCreate(const char *errorDetail,
char *family,
const char *family,
const char *address,
const char *netmask,
const char *gateway,
......
......@@ -40,7 +40,7 @@ virNetworkRouteDefFree(virNetworkRouteDefPtr def);
virNetworkRouteDefPtr
virNetworkRouteDefCreate(const char *networkName,
char *family,
const char *family,
const char *address,
const char *netmask,
const char *gateway,
......
......@@ -832,6 +832,50 @@ prlsdkGetNetAddresses(PRL_HANDLE sdknet, virDomainNetDefPtr net)
return ret;
}
static int
prlsdkGetRoutes(PRL_HANDLE sdknet, virDomainNetDefPtr net)
{
int ret = -1;
char *gw = NULL;
char *gw6 = NULL;
virNetworkRouteDefPtr route = NULL;
if (!(gw = prlsdkGetStringParamVar(PrlVmDevNet_GetDefaultGateway, sdknet)))
goto cleanup;
if (!(gw6 = prlsdkGetStringParamVar(PrlVmDevNet_GetDefaultGatewayIPv6, sdknet)))
goto cleanup;
if (*gw != '\0') {
if (!(route = virNetworkRouteDefCreate(_("Domain interface"),
"ipv4", VIR_SOCKET_ADDR_IPV4_ALL,
NULL, gw, 0, true, 0, false)))
goto cleanup;
if (VIR_APPEND_ELEMENT(net->routes, net->nroutes, route) < 0)
goto cleanup;
}
if (*gw6 != '\0') {
if (!(route = virNetworkRouteDefCreate(_("Domain interface"),
"ipv6", VIR_SOCKET_ADDR_IPV6_ALL,
NULL, gw6, 0, true, 0, false)))
goto cleanup;
if (VIR_APPEND_ELEMENT(net->routes, net->nroutes, route) < 0)
goto cleanup;
}
ret = 0;
cleanup:
VIR_FREE(route);
VIR_FREE(gw);
VIR_FREE(gw6);
return ret;
}
static int
prlsdkGetNetInfo(PRL_HANDLE netAdapter, virDomainNetDefPtr net, bool isCt)
{
......@@ -874,6 +918,9 @@ prlsdkGetNetInfo(PRL_HANDLE netAdapter, virDomainNetDefPtr net, bool isCt)
if (prlsdkGetNetAddresses(netAdapter, net) < 0)
goto cleanup;
if (prlsdkGetRoutes(netAdapter, net) < 0)
goto cleanup;
pret = PrlVmDev_GetEmulatedType(netAdapter, &emulatedType);
prlsdkCheckRetGoto(pret, cleanup);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册