obmc-phosphor-discovery-service: Include hostname in service names
Currently, we'll export avahi services solely under their service names.
With multiple BMCs on a network, this ends up with multiple
indistinguisable services exposed over avahi:
[jk@pecola ~]$ avahi-browse _obmc_console._tcp
+ br0 IPv6 obmc_console _obmc_console._tcp local
+ br0 IPv4 obmc_console _obmc_console._tcp local
+ br0 IPv4 obmc_console #2 _obmc_console._tcp local
+ br0 IPv6 obmc_console #2 _obmc_console._tcp local
This change uses the hostname as the identifier instead. There's no need
to include the service name, as that's what the service type field is
for.
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Change-Id: I23fcbf23b7f2b41a82f9be32c09117438f44e986
diff --git a/classes/obmc-phosphor-discovery-service.bbclass b/classes/obmc-phosphor-discovery-service.bbclass
index e912bea..fdade60 100644
--- a/classes/obmc-phosphor-discovery-service.bbclass
+++ b/classes/obmc-phosphor-discovery-service.bbclass
@@ -72,7 +72,8 @@
fd.write('<?xml version="1.0" ?>\n')
fd.write('<!DOCTYPE service-group SYSTEM "avahi-service.dtd">\n')
fd.write('<service-group>\n')
- fd.write(' <name>%s</name>\n' % service_name)
+ fd.write(' <name replace-wildcards="yes">%s on %%h</name>\n'
+ % service_name)
fd.write(' <service>\n')
fd.write(' <type>%s</type>\n' % service_type)
fd.write(' <port>%s</port>\n' % service_port)