Bug 864564 - RFE: Populate host UUID from /etc/machine-id instead of SMBIOS
Summary: RFE: Populate host UUID from /etc/machine-id instead of SMBIOS
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-10-09 15:16 UTC by Daniel Berrangé
Modified: 2016-05-04 02:29 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-05-03 13:03:33 UTC
Embargoed:


Attachments (Terms of Use)

Description Daniel Berrangé 2012-10-09 15:16:59 UTC
Description of problem:
The UUID in the SMBios data is often found to be bogus, or non-unique. On systemd based hosts, there is a unique UUID located in /etc/machine-id, which we can use as libvirt's host UUID.

So we should try to load that file first, and fallback to SMBIOS if not found

Version-Release number of selected component (if applicable):
0.10.2

Comment 1 Cole Robinson 2016-04-20 18:12:46 UTC
The UUID referenced here is what we report as the <uuid> in 'virsh capabilities' output.

The function that currently handles this is src/util/viruuid.c virSetHostUUIDStr ; if the user doesn't request a hardcoded one from libvirtd.conf, it will get it from smbios/dmi

In virSetHostUUIDStr we should use virFileExists to see if /etc/machine-id is present on the host, and if so, use virFileReadAll to read its contents.

/etc/machine-id is basically a standard UUID string, but without any '-' in it, but I think virUUIDParse will already handle that correctly.

https://www.freedesktop.org/software/systemd/man/machine-id.html

Comment 2 Cole Robinson 2016-04-26 20:06:18 UTC
Patch was posted upstream:

http://www.redhat.com/archives/libvir-list/2016-April/msg01656.html

Comment 3 Cole Robinson 2016-05-03 13:03:33 UTC
Upstream now:

commit 6fe81c3a71e0e8cccb151cb08c62d4d5961170a2
Author: Nikolay Shirokovskiy <nshirokovskiy>
Date:   Tue May 3 12:12:41 2016 +0300

    daemon: add option to read host uuid from /etc/machine-id
    
    Daemon config parameter switch between reading host uuid
    either from smbios or machine-id:
    
    host_uuid_source = "smbios|machine-id"
    
    Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy>


Note You need to log in before you can comment on or make changes to this bug.