'Get the used memory size(MB) of physical computer.
:returns: the total usage of memory(MB).'

def get_memory_mb_used(self):

    if (sys.platform.upper() not in ['LINUX2', 'LINUX3']):
        return 0
    with open('/proc/meminfo') as fp:
        m = fp.read().split()
    idx1 = m.index('MemFree:')
    idx2 = m.index('Buffers:')
    idx3 = m.index('Cached:')
    if (CONF.libvirt.virt_type == 'xen'):
        used = 0
        for guest in self.list_guests(only_guests=False):
            try:
                dom_mem = int(guest._get_domain_info(self)[2])
            except libvirt.libvirtError as e:
                LOG.warning("couldn't    obtain    the    memory    from    domain:    %(uuid)s,    exception:    %(ex)s", {'uuid': guest.uuid, 'ex': e})
                continue
            if (guest.id != 0):
                used += dom_mem
            else:
                used += (dom_mem - ((int(m[(idx1 + 1)]) + int(m[(idx2 + 1)])) + int(m[(idx3 + 1)])))
        return (used // units.Ki)
    else:
        avail = ((int(m[(idx1 + 1)]) + int(m[(idx2 + 1)])) + int(m[(idx3 + 1)]))
        return (self.get_memory_mb_total() - (avail // units.Ki))
