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;