Bug 864564

Summary: RFE: Populate host UUID from /etc/machine-id instead of SMBIOS
Product: [Community] Virtualization Tools Reporter: Daniel BerrangĂ© <berrange>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED UPSTREAM QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: crobinso, dyuan, fjin, rbalakri
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-03 13:03:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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>