DNS lookups first look in the nics table and then the machines table. 0.0.8
authorEvan Broder <broder@mit.edu>
Tue, 13 Jan 2009 01:55:00 +0000 (20:55 -0500)
committerEvan Broder <broder@mit.edu>
Tue, 13 Jan 2009 01:55:00 +0000 (20:55 -0500)
This allows VMs with multiple IPs to have DNS names associated with
both IPs.

svn path=/trunk/packages/invirt-dns/; revision=1974

debian/changelog
invirt-dns

index 9a46bc5..5677ef4 100644 (file)
@@ -1,3 +1,10 @@
+invirt-dns (0.0.8) unstable; urgency=low
+
+  * Check the nics table first and then the machines table so that you can
+    do DNS lookups for machines with multiple IPs.
+
+ -- Evan Broder <broder@mit.edu>  Mon, 12 Jan 2009 20:51:28 -0500
+
 invirt-dns (0.0.7) unstable; urgency=low
 
   [ Yang Zhang ]
index e49c279..4049257 100755 (executable)
@@ -92,11 +92,17 @@ class DatabaseAuthority(common.ResolverBase):
                     results.append(dns.RRHeader(domain, dns.SOA, dns.IN,
                                                 ttl, self.soa, auth=True))
             else: # Request for a subdomain.
-                value = invirt.database.Machine.query().filter_by(name=host).first()
-                if value is None or not value.nics:
-                    return defer.fail(failure.Failure(dns.AuthoritativeDomainError(name)))
-                ip = value.nics[0].ip
-                if ip is None:  #Deactivated?
+                value = invirt.database.NIC.query.filter_by(hostname=host).first()
+                if value:
+                    ip = value.ip
+                else:
+                    value = invirt.database.Machine.query().filter_by(name=host).first()
+                    if value:
+                        ip = value.nics[0].ip
+                    else:
+                        return defer.fail(failure.Failure(dns.AuthoritativeDomainError(name)))
+                
+                if ip is None:
                     return defer.fail(failure.Failure(dns.AuthoritativeDomainError(name)))
 
                 if type in (dns.A, dns.ALL_RECORDS):