'Set DNS name for interface.
@param: str dns_name (dns name)
@param: str interface (interface name)
@returns: True or CX'

def set_dns_name(self, dns_name, interface):

    dns_name = validate.hostname(dns_name)
    if ((dns_name != '') and (utils.input_boolean(self.collection_mgr._settings.allow_duplicate_hostnames) is False)):
        matched = self.collection_mgr.api.find_items('system', {'dns_name': dns_name})
        for x in matched:
            if (x.name != self.name):
                raise CX(('DNS    name    duplicated:    %s' % dns_name))
    intf = self.__get_interface(interface)
    intf['dns_name'] = dns_name
