'Canonicalize the vm mode
:param name: vm mode name to canonicalize
:returns: a canonical vm mode name'

@classmethod
def canonicalize(cls, mode):

    if (mode is None):
        return None
    mode = mode.lower()
    if (mode == 'pv'):
        mode = cls.XEN
    if (mode == 'hv'):
        mode = cls.HVM
    if (mode == 'baremetal'):
        mode = cls.HVM
    if (not cls.is_valid(mode)):
        raise exception.InvalidVirtualMachineMode(vmmode=mode)
    return mode
