def get_this_vm_uuid(session):
    if session and session.is_local_connection:
        # UUID is the control domain running on this host
        vms = session.call_xenapi("VM.get_all_records_where",
                                  'field "is_control_domain"="true" and '
                                  'field "resident_on"="%s"' %
                                  session.host_ref)
        return vms[list(vms.keys())[0]]['uuid']
    try:
        return _get_sys_hypervisor_uuid()
    except __HOLE__:
        # Some guest kernels (without 5c13f8067745efc15f6ad0158b58d57c44104c25)
        # cannot read from uuid after a reboot.  Fall back to trying xenstore.
        # See https://bugs.launchpad.net/ubuntu/+source/xen-api/+bug/1081182
        domid, _ = utils.execute('xenstore-read', 'domid', run_as_root=True)
        vm_key, _ = utils.execute('xenstore-read',
                                 '/local/domain/%s/vm' % domid.strip(),
                                 run_as_root=True)
        return vm_key.strip()[4:]
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/virt/xenapi/vm_utils.py/get_this_vm_uuid