From 4499d189155d07d37147acb30cfd3e2d73ec284b Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Sun, 16 May 2010 18:54:46 +0000 Subject: [PATCH] -Reminder to implement UUID v1 subtype of RFC UUID for enchanced uniqueness guarantee git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6139 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Utils.pm | 4 ++++ xCAT-server/lib/xcat/plugins/kvm.pm | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index af8772e7d..8cc161bca 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -65,6 +65,10 @@ sub genUUID #Though a UUID of this form is not guaranteed to be unique absolutely, #the chances of a cluster the size of the entire internet generating #two identical UUIDs is 4 in 10 octillion. + my %args = @_; + if ($args{mac}) { #if a mac address was supplied, generate a uuidv1 instead + #TODO: UUIDv1 + } srand(); #Many note this as bad practice, however, forks are going on.. my $uuid; $uuid = diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index 08eef0733..eae310c6f 100644 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -213,7 +213,15 @@ sub build_diskstruct { } sub getNodeUUID { my $node = shift; - return xCAT::Utils::genUUID(); + if ($confdata->{mac}->{$node}->[0]) { #a uuidv1 is possible, generate that for absolute uniqueness guarantee + my $mac = ($confdata->{mac}->{$node}->[0]; + $mac =~ s/\|.*//; + $mac =~ s/!.*//; + return xCAT::Utils::genUUID(mac=>$mac); + } else { + return xCAT::Utils::genUUID(); + } + } sub build_nicstruct { my $rethash;