def start(self, dns_address='0.0.0.0', dns_port=53, api_address='127.0.0.1', api_port=8000, tcp=True, udplen=0, log_components="request,reply,truncated,error", log_prefix=False): logger = server.DNSLogger(log_components, log_prefix) log.info("Starting OneDNS (%s:%d) [%s]" % (dns_address or "*", dns_port, "UDP/TCP" if tcp else "UDP")) server.DNSHandler.udplen = udplen self._udp_server = server.DNSServer(self, port=dns_port, address=dns_address, logger=logger) self._udp_server.start_thread() if tcp: self._tcp_server = server.DNSServer(self, port=dns_port, address=dns_address, tcp=True, logger=logger) self._tcp_server.start_thread()
def remove_vm(self, vm, zone=None): dns_entries = self._get_vm_dns_entries(vm) log.info("Removing VM {id}: {vm}".format(id=vm.id, vm=vm.name)) for name, ip in dns_entries.items(): self.remove_host(name, ip, zone=zone)
def add_vm(self, vm, zone=None): dns_entries = self._get_vm_dns_entries(vm) log.info("Adding VM {id}: {vm}".format(id=vm.id, vm=vm.name)) for name, ip in dns_entries.items(): if not self._check_for_duplicates(vm.id, name, ip, zone=zone): self.add_host(name.lower(), ip, zone=zone)