Use the machine name, not the hostname, field.
[invirt/packages/invirt-dns.git] / dnsserver.py
index c2069df..3cc8dc5 100644 (file)
@@ -30,10 +30,10 @@ class DatabaseAuthority(common.ResolverBase):
         results = []
         if cls == dns.IN and type in (dns.A, dns.ALL_RECORDS):
             host = name[:-len(self.domain)-1]
-            value = sipb_xen_database.NIC.get_by(hostname=host)
-            if value is None:
+            value = sipb_xen_database.Machine.get_by(name=host)
+            if value is None or not value.nics:
                 return defer.fail(failure.Failure(dns.AuthoritativeDomainError(name)))
-            ip = value.ip
+            ip = value.nics[0].ip
             if ip is None:  #Deactivated?
                 return defer.fail(failure.Failure(dns.AuthoritativeDomainError(name)))
             ttl = 900