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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.