def _normalize_uuid(self, uuid):
     """
     Normalizes the input uuid to lower-case string without any white space or '-'
     """
     uuid = uuid.translate(None, " -\n'")
     uuid = uuid.lower()
     return uuid
 def _normalize_uuid(self, uuid):
     """
     Normalizes the input uuid to lower-case string without any white space or '-'
     """
     uuid = uuid.translate(None, " -\n'")
     uuid = uuid.lower()
     return uuid
示例#3
0
def uuid_to_vmdk_uuid(uuid):
    """Converts a uuid string to the format used for vmdk uuids."""

    # vmdk UUID is expected in the format of:
    # 'hh hh hh hh hh hh hh hh-hh hh hh hh hh hh hh hh'

    uuid = uuid.translate(None, " -")
    if len(uuid) != 32:
        raise ValueError("unexpected format for uuid: %s" % uuid)
    pairs = [uuid[i : i + 2].lower() for i in range(0, len(uuid), 2)]
    return " ".join(pairs[:8]) + "-" + " ".join(pairs[8:])
示例#4
0
def uuid_to_vmdk_uuid(uuid):
    """Converts a uuid string to the format used for vmdk uuids."""

    # vmdk UUID is expected in the format of:
    # 'hh hh hh hh hh hh hh hh-hh hh hh hh hh hh hh hh'

    uuid = uuid.translate(None, " -")
    if len(uuid) != 32:
        raise ValueError("unexpected format for uuid: %s" % uuid)
    pairs = [uuid[i:i + 2].lower() for i in range(0, len(uuid), 2)]
    return " ".join(pairs[:8]) + "-" + " ".join(pairs[8:])
 def _normalize_uuid(self, uuid):
     logger.debug('Normalizing uuid {}'.format(uuid))
     uuid = uuid.translate(None, " -\n'")
     uuid = uuid.lower()
     logger.debug('uuid after normalizing is {}'.format(uuid))
     return uuid