Re: [PATCH] vz: fix build for virNetDev* changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/27/2016 02:23 PM, Olga Krishtal wrote:
Patch fixes vz build after changes in IP-related netdev functions(cf0568b0, fbc1843d).

Sorry about that. I *thought* I had searched in the drivers I couldn't build. (BTW, I tried downloading and installing the parallels-sdk on my Fedora system, but configure still says it's not there. Are there more verbose instructions somewhere so that I can just always build with --with-vz in the future?)

(BTW, although some of the patches I mistakenly pushed yesterday have been reverted, the patches that cause this build failure for the vz driver haven't.)


Signed-off-by: Olga Krishtal <okrishtal@xxxxxxxxxxxxx>
---
  src/vz/vz_sdk.c | 49 +++++++++++++++++++++++++------------------------
  1 file changed, 25 insertions(+), 24 deletions(-)

diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 1203ed6..7e75e44 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -773,13 +773,13 @@ prlsdkAddDomainOpticalDisksInfo(vzDriverPtr driver, PRL_HANDLE sdkdom, virDomain
      return -1;
  }
-static virDomainNetIpDefPtr
+static virNetDevIPAddrPtr
  prlsdkParseNetAddress(char *addr)
  {
      char *maskstr = NULL;
      int nbits;
      virSocketAddr mask;
-    virDomainNetIpDefPtr ip = NULL, ret = NULL;
+    virNetDevIPAddrPtr ip = NULL, ret = NULL;
if (!(maskstr = strchr(addr, '/')))
          goto cleanup;
@@ -829,7 +829,7 @@ prlsdkGetNetAddresses(PRL_HANDLE sdknet, virDomainNetDefPtr net)
      prlsdkCheckRetGoto(pret, cleanup);
for (i = 0; i < num; ++i) {
-        virDomainNetIpDefPtr ip = NULL;
+       virNetDevIPAddrPtr ip = NULL;

Indentation was off. I fixed it.

          PRL_UINT32 buflen = 0;
          char *addr;
@@ -845,7 +845,7 @@ prlsdkGetNetAddresses(PRL_HANDLE sdknet, virDomainNetDefPtr net)
          if (!(ip = prlsdkParseNetAddress(addr)))
              continue;
- if (VIR_APPEND_ELEMENT(net->ips, net->nips, ip) < 0) {
+        if (VIR_APPEND_ELEMENT(net->guestIP.ips, net->guestIP.nips, ip) < 0) {
              VIR_FREE(ip);
              goto cleanup;
          }
@@ -864,7 +864,7 @@ prlsdkGetRoutes(PRL_HANDLE sdknet, virDomainNetDefPtr net)
      int ret = -1;
      char *gw = NULL;
      char *gw6 = NULL;
-    virNetworkRouteDefPtr route = NULL;
+    virNetDevIPRoutePtr route = NULL;
if (!(gw = prlsdkGetStringParamVar(PrlVmDevNet_GetDefaultGateway, sdknet)))
          goto cleanup;
@@ -873,29 +873,30 @@ prlsdkGetRoutes(PRL_HANDLE sdknet, virDomainNetDefPtr net)
          goto cleanup;
if (*gw != '\0') {
-        if (!(route = virNetworkRouteDefCreate(_("Domain interface"),
+
+        if (!(route = virNetDevIPRouteCreate(_("Domain interface"),
                                                 "ipv4", VIR_SOCKET_ADDR_IPV4_ALL,
                                                 NULL, gw, 0, true, 0, false)))

Indentation of the lines following the change was off.

              goto cleanup;
- if (VIR_APPEND_ELEMENT(net->routes, net->nroutes, route) < 0)
+        if (VIR_APPEND_ELEMENT(net->guestIP.routes, net->guestIP.nroutes, route) < 0)
              goto cleanup;
      }
if (*gw6 != '\0') {
-        if (!(route = virNetworkRouteDefCreate(_("Domain interface"),
+        if (!(route = virNetDevIPRouteCreate(_("Domain interface"),
                                                 "ipv6", VIR_SOCKET_ADDR_IPV6_ALL,
                                                 NULL, gw6, 0, true, 0, false)))

Again with indentation.

              goto cleanup;
- if (VIR_APPEND_ELEMENT(net->routes, net->nroutes, route) < 0)
+        if (VIR_APPEND_ELEMENT(net->guestIP.routes, net->guestIP.nroutes, route) < 0)
              goto cleanup;
      }
ret = 0; cleanup:
-    VIR_FREE(route);
+    virNetDevIPRouteFree(route);

This actually fixes a memory leak - even before the changes a route had a char* allocated for family, so you needed to call virNetworkRouteDefFree().

I'm unable to build with --with-vz, but assume that you've done this (since that was the entire reason for the patch :-), so ACK. I've pushed the patch so that the next RC of 2.0 will build properly.

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]