mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
vz: dump route info in domain xml
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
This commit is contained in:
parent
b86396dc54
commit
c34a9d6e56
@ -60,7 +60,7 @@ virNetworkRouteDefFree(virNetworkRouteDefPtr def)
|
|||||||
|
|
||||||
virNetworkRouteDefPtr
|
virNetworkRouteDefPtr
|
||||||
virNetworkRouteDefCreate(const char *errorDetail,
|
virNetworkRouteDefCreate(const char *errorDetail,
|
||||||
char *family,
|
const char *family,
|
||||||
const char *address,
|
const char *address,
|
||||||
const char *netmask,
|
const char *netmask,
|
||||||
const char *gateway,
|
const char *gateway,
|
||||||
|
@ -40,7 +40,7 @@ virNetworkRouteDefFree(virNetworkRouteDefPtr def);
|
|||||||
|
|
||||||
virNetworkRouteDefPtr
|
virNetworkRouteDefPtr
|
||||||
virNetworkRouteDefCreate(const char *networkName,
|
virNetworkRouteDefCreate(const char *networkName,
|
||||||
char *family,
|
const char *family,
|
||||||
const char *address,
|
const char *address,
|
||||||
const char *netmask,
|
const char *netmask,
|
||||||
const char *gateway,
|
const char *gateway,
|
||||||
|
@ -832,6 +832,50 @@ prlsdkGetNetAddresses(PRL_HANDLE sdknet, virDomainNetDefPtr net)
|
|||||||
return ret;
|
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
|
static int
|
||||||
prlsdkGetNetInfo(PRL_HANDLE netAdapter, virDomainNetDefPtr net, bool isCt)
|
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)
|
if (prlsdkGetNetAddresses(netAdapter, net) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
if (prlsdkGetRoutes(netAdapter, net) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
pret = PrlVmDev_GetEmulatedType(netAdapter, &emulatedType);
|
pret = PrlVmDev_GetEmulatedType(netAdapter, &emulatedType);
|
||||||
prlsdkCheckRetGoto(pret, cleanup);
|
prlsdkCheckRetGoto(pret, cleanup);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user