From a641e5dcadd474d1dc6404b17adc8bd3ed66067c Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Tue, 3 Sep 2013 16:57:17 +0300 Subject: [PATCH] Add uuid to facts For physical HW that would be unique chassis id (from BIOS settings). For kvm guests that would be virsh domain uuid. Used with fence_virsh agent. For other hypervizors - not tested. Implements: blueprint facter-uuid Change-Id: Idd92a3e0dc41040c76243f92fa84e14b9da03b6d Signed-off-by: Bogdan Dobrelya Signed-off-by: Bogdan Dobrelya --- bin/agent | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bin/agent b/bin/agent index 41025e8825..a43abddd8f 100755 --- a/bin/agent +++ b/bin/agent @@ -314,10 +314,20 @@ class NodeAgent @os[:dmi][:system][:serial_number].strip rescue nil end + # Returns unique identifier of machine + # * for kvm virtual node will contain virsh UUID + # * for physical HW that would be unique chassis id (from BIOS settings) + # * for other hypervizors - not tested + def uuid + node_uuid = @os.fetch(:dmi, {}).fetch(:system, {}).fetch(:uuid, nil) + node_uuid && node_uuid.strip + end + def _system_info { :manufacturer => _manufacturer, :serial => _serial, + :uuid => uuid, :product => _product_name, :family => (@os[:dmi][:system][:family].strip rescue nil), :version => (@os[:dmi][:system][:version].strip rescue nil),