'We have to use a safe hostname length for 3PAR host names.'

def _safe_hostname(self, hostname):

    try:
        index = hostname.index('.')
    except ValueError:
        index = len(hostname)
    if (index > 31):
        index = 31
    return hostname[:index]
