]> xenbits.xensource.com Git - libvirt.git/commitdiff
Generate JSON with mDNS entries only when built --with-avahi
authorMartin Kletzander <mkletzan@redhat.com>
Mon, 15 Jun 2015 09:28:11 +0000 (11:28 +0200)
committerMartin Kletzander <mkletzan@redhat.com>
Mon, 15 Jun 2015 15:13:00 +0000 (17:13 +0200)
One string was already used only if that condition was true, second one
is added now.  Both are used in a nicer way.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
tests/virnetservertest.c

index 596fabedd38b416930f33432fd49bb4a55a0b2ef..e8e91f867e457237443678544ff589063c8c07ae 100644 (file)
@@ -35,6 +35,13 @@ testCreateServer(const char *host, int family)
     virNetServerClientPtr cln1 = NULL, cln2 = NULL;
     virNetSocketPtr sk1 = NULL, sk2 = NULL;
     int fdclient[2];
+    const char *mdns_entry = NULL;
+    const char *mdns_group = NULL;
+
+# ifdef WITH_AVAHI
+    mdns_entry = "libvirt-ro";
+    mdns_group = "libvirtTest";
+# endif
 
     if (socketpair(PF_UNIX, SOCK_STREAM, 0, fdclient) < 0) {
         virReportSystemError(errno, "%s",
@@ -44,11 +51,7 @@ testCreateServer(const char *host, int family)
 
     if (!(srv = virNetServerNew(10, 50, 5, 100, 10,
                                 120, 5, true,
-# ifdef WITH_AVAHI
-                                "libvirtTest",
-# else
-                                NULL,
-# endif
+                                mdns_group,
                                 NULL,
                                 NULL,
                                 NULL,
@@ -79,9 +82,9 @@ testCreateServer(const char *host, int family)
                                            5)))
         goto error;
 
-    if (virNetServerAddService(srv, svc1, "libvirt-ro") < 0)
+    if (virNetServerAddService(srv, svc1, mdns_entry) < 0)
         goto error;
-    if (virNetServerAddService(srv, svc2, "libvirt-ro") < 0)
+    if (virNetServerAddService(srv, svc2, mdns_entry) < 0)
         goto error;
 
     if (virNetSocketNewConnectSockFD(fdclient[0], &sk1) < 0)