Re: [PATCH 3/3] test_driver: consider DHCP ranges in testDomainInterfaceAddresses

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

 



On Wed, Jun 19, 2019 at 03:47:58PM +0200, Michal Privoznik wrote:
On 6/19/19 1:18 PM, Ilias Stamatis wrote:

[...]

@@ -3413,6 +3426,16 @@ testDomainInterfaceAddresses(virDomainPtr dom,
         if (vm->def->nets[i]->type != VIR_DOMAIN_NET_TYPE_NETWORK)
             continue;

+        virObjectUnref(net);
+        if (!(net = testNetworkLookupByName(dom->conn,
+                                            vm->def->nets[i]->data.network.name)))
+            goto cleanup;
+
+        if (!(net_obj = testNetworkObjFindByName(net->conn->privateData, net->name)))
+            goto cleanup;

This is needless IMO. I mean, @net variable looks redundant to me, why
not look up the network object directly? For instance:

 if (!(net_obj = testNetworkObjFindByName(dom->conn->privateData,

vm->def->nets[i]->data.network.name)))
     goto cleanup;

But looking further at next hunk, I wonder if it makes sense to separate it into a separate function.

Yes, please.

Jano

Otherwise the code looks good. A bit complicated, but that was expected, since dealing with IP addresses is never a few lines of code :-(

Michal

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

Attachment: signature.asc
Description: PGP signature

--
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]

  Powered by Linux