Changeset 1974


Ignore:
Timestamp:
Jan 12, 2009, 8:55:00 PM (15 years ago)
Author:
broder
Message:

DNS lookups first look in the nics table and then the machines table.

This allows VMs with multiple IPs to have DNS names associated with
both IPs.

Location:
trunk/packages/invirt-dns
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/invirt-dns/debian/changelog

    r1631 r1974  
     1invirt-dns (0.0.8) unstable; urgency=low
     2
     3  * Check the nics table first and then the machines table so that you can
     4    do DNS lookups for machines with multiple IPs.
     5
     6 -- Evan Broder <broder@mit.edu>  Mon, 12 Jan 2009 20:51:28 -0500
     7
    18invirt-dns (0.0.7) unstable; urgency=low
    29
  • trunk/packages/invirt-dns/invirt-dns

    r1631 r1974  
    9393                                                ttl, self.soa, auth=True))
    9494            else: # Request for a subdomain.
    95                 value = invirt.database.Machine.query().filter_by(name=host).first()
    96                 if value is None or not value.nics:
    97                     return defer.fail(failure.Failure(dns.AuthoritativeDomainError(name)))
    98                 ip = value.nics[0].ip
    99                 if ip is None:  #Deactivated?
     95                value = invirt.database.NIC.query.filter_by(hostname=host).first()
     96                if value:
     97                    ip = value.ip
     98                else:
     99                    value = invirt.database.Machine.query().filter_by(name=host).first()
     100                    if value:
     101                        ip = value.nics[0].ip
     102                    else:
     103                        return defer.fail(failure.Failure(dns.AuthoritativeDomainError(name)))
     104               
     105                if ip is None:
    100106                    return defer.fail(failure.Failure(dns.AuthoritativeDomainError(name)))
    101107
Note: See TracChangeset for help on using the changeset viewer.