VMs with identical UUID get mixed up
Comments
-
Hi,your right it would fix such incorrect provisioning.Question is how often this might happen and if that justifies our effor into that.Actually I do not see any priority hereAnyway thanks for idea!
-
Hi Pavel,
I just analyzed our environment and we have plenty of those system and the effort to change it is really high.
It would be great if you find some time to write a patch. I will also have a look at the code an maybe I can provide some sort of patch.
Thanks
Sascha
-
Hi,we have discussed it internally.From implementation part it is not easy change, it has many consequences in our code.There is also other general consequnce, if someone changed vcenter ID or running vcenter then he will lose all VM history in case this is implemented.We are not going for this change for now.
-
Hi Pavel,
I tried to find a solution to the problem. Interestingly the combination of instanceuuid and uuid is unique. There are collisions for both seperately but not for the combination.
The implementation did not require a lot of changes in the code. Please have a look at the provided patch (uploading files here is not possible, so i just put it below).
Thanks
Sascha
------
--- vmw2rrd.pl.orig5.07_vcenterfix 2018-06-29 14:03:26.433707498 +0200
+++ vmw2rrd.pl 2018-07-27 09:14:32.763121798 +0200
# new lpar will be added to lpar_trans.txt
my $each_vm_uuid = $each_vm->{'summary.config.instanceUuid'};
my $each_vm_uuid_old = $each_vm->{'summary.config.uuid'};
+ ##### Sascha added - combine both IDs as only this is unique in our environment
+ $each_vm_uuid .= "_".$each_vm_uuid_old;
+ $each_vm_uuid_old .= "_".$each_vm_uuid;
+ #####
my $each_vm_name = $each_vm->{'name'};
my $each_vm_url = $each_vm_name;
for ( my $i = 0; $i < scalar @$a_ref; $i++ ) {
my $pos = rindex( @$a_ref[$i], ':' );
next if $pos < 0; # some trash
- next if ( substr( @$a_ref[$i], 0, 36 ) ne "$vm_uuid" );
+ # As the ID now consists of 36+1+36 chars, edited from 36 to 73
+ next if ( substr( @$a_ref[$i], 0, 73 ) ne "$vm_uuid" );
if ( substr( @$a_ref[$i], $pos + 1, 3 ) eq "sta" ) { # keep item
substr( @$a_ref[$i], length( @$a_ref[$i] ) - 1, 5 ) = ":act\n";
$found++;
print "date load : $host:$managedname $date\n" if $DEBUG;
} ## end sub prepare_last_time
-# provides easy uuid check, pays for 1 arg only
+##### Sascha added - combine both IDs as only this is unique in our environment
+# provides easy uuid check, pays for 1 arg only, for double uuids
sub uuid_check {
- return ( $_[0] =~ m{.{8}-.{4}-.{4}-.{4}-.{12}} )
+ return ( $_[0] =~ m{.{8}-.{4}-.{4}-.{4}-.{12}_.{8}-.{4}-.{4}-.{4}-.{12}} )
}
# print "\$numCpu $numCpu\n";
$vm_uuid_active = $entity->summary->config->instanceUuid;
+ ##### Sascha added - combine both IDs as only this is unique in our environment
+ # ignored return if not defined
+ $vm_uuid_active .= "_".$entity->summary->config->uuid;
+ #####
return if not defined $vm_uuid_active; # there can exist poweredOn VM with UNSET instanceUuid
$last_file = "$vm_uuid_active.last";
$cpu_res = $entity->config->cpuAllocation->reservation;
$numCpu = $entity->summary->config->numCpu;
$entity_uuid = $entity->summary->config->instanceUuid;
+ ##### Sascha added - combine both IDs as only this is unique in our environment
+ $entity_uuid .= "_".$entity->summary->config->uuid;
+ #####
# print "2709 vmw2rrd.pl \$vm_moref $vm_moref $numCpu $cpu_res $entity_uuid\n";
my @temp_arr = ();
-
I had same problem and solved editing .vmx for VMs with duplicated UUID and changing line with vc.uuid.
I generated a new random GUID from inside Linux appliance with command:
uuidgen | perl -ne '{ s/-//g; s/(.{2})/\1 /g; substr($_,23,1,"-"); print ; }'
Example:[root@xorux lpar2rrd]# uuidgen | perl -ne '{ s/-//g; s/(.{2})/\1 /g; substr($_,23,1,"-"); print ; }'63 f7 66 c1 a1 ec 41 82-9c 94 0a 40 2e ab b1 2f[root@nsxxxxx:/vmfs/volumes/583583cd-14cfa730-9f12-0cc47ade9a08/VMsample] vi VMsample.vmxvc.uuid = "63 f7 66 c1 a1 ec 41 82-9c 94 0a 40 2e ab b1 2f"Then I purged all data an forced a reload with:cd /home/lpar2rrd/lpar2rrd/data
rm -rf *
rm -f /home/lpar2rrd/lpar2rrd/data/vmware_VMs/*
su lpar2rrd /home/lpar2rrd/lpar2rrd/load.sh
Best regards!
Howdy, Stranger!
Categories
- 1.6K All Categories
- 41 XORMON NG
- 25 XORMON
- 150 LPAR2RRD
- 13 VMware
- 16 IBM i
- 2 oVirt / RHV
- 4 MS Windows and Hyper-V
- Solaris / OracleVM
- XenServer / Citrix
- Nutanix
- 6 Database
- 2 Cloud
- 10 Kubernetes / OpenShift / Docker
- 122 STOR2RRD
- 19 SAN
- 7 LAN
- 17 IBM
- 3 EMC
- 12 Hitachi
- 5 NetApp
- 15 HPE
- Lenovo
- 1 Huawei
- 1 Dell
- Fujitsu
- 2 DataCore
- INFINIDAT
- 3 Pure Storage
- Oracle