'Deserialize a v1 ring file into a dictionary with `devs`, `part_shift`,
and `replica2part2dev_id` keys.
If the optional kwarg `metadata_only` is True, then the
`replica2part2dev_id` is not loaded and that key in the returned
dictionary just has the value `[]`.
:param file gz_file: An opened file-like object which has already
consumed the 6 bytes of magic and version.
:param bool metadata_only: If True, only load `devs` and `part_shift`
:returns: A dict containing `devs`, `part_shift`, and
`replica2part2dev_id`'

@classmethod
def deserialize_v1(cls, gz_file, metadata_only=False):

    (json_len,) = struct.unpack('!I', gz_file.read(4))
    ring_dict = json.loads(gz_file.read(json_len))
    ring_dict['replica2part2dev_id'] = []
    if metadata_only:
        return ring_dict
    byteswap = (ring_dict.get('byteorder', sys.byteorder) != sys.byteorder)
    partition_count = (1 << (32 - ring_dict['part_shift']))
    for x in range(ring_dict['replica_count']):
        part2dev = array.array('H', gz_file.read((2 * partition_count)))
        if byteswap:
            part2dev.byteswap()
        ring_dict['replica2part2dev_id'].append(part2dev)
    return ring_dict
