Eli Mesika has uploaded a new change for review.

Change subject: Default DC & Cluster has fixed UUIDs
......................................................................

Default DC & Cluster has fixed UUIDs

This patch modifies the uuid_generate_v1 function to have some
randomization in its least significant part so different engines will have
different UUID values from the generated default DC UUID and default
Cluster.

In addition This patch fixes a static data inserted as Cluster UUID for
the blank template.

I had tested generation of million UUIDs to verify its uniqueness just
for the case although the generation of the 29 most significant numbers
are still done by the sequence and supposed to be unique.

Change-Id: Ic5650fe1586fae320484f8cd36698491554efa57
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1026885
Signed-off-by: Eli Mesika <emes...@redhat.com>
---
M packaging/dbscripts/create_functions.sql
M packaging/dbscripts/insert_data.sql
2 files changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/87/24087/1

diff --git a/packaging/dbscripts/create_functions.sql 
b/packaging/dbscripts/create_functions.sql
index a808589..14fac46 100644
--- a/packaging/dbscripts/create_functions.sql
+++ b/packaging/dbscripts/create_functions.sql
@@ -752,11 +752,13 @@
 begin
     -- The only part we should use modulo is the 4 digit part, all the
     -- rest are really big numbers (i.e 16^8 - 1 and 16^12 - 1)
+    -- The use of round(random() * 1000 is for getting a different id
+    -- for DC/Cluster in different installations
     v_4_part_max = 65535; -- this is 16^4 -1
     v_val := nextval('uuid_sequence');
     v_4_part := lpad(to_hex(v_val % v_4_part_max), 4, '0');
     v_8_part := lpad(to_hex(v_val), 8, '0');
-    v_12_part := lpad(to_hex(v_val), 12, '0');
+    v_12_part := lpad(to_hex((v_val + (round(random() * 1000))::bigint)), 12, 
'0');
     return v_8_part || v_4_part || v_4_part || v_4_part || v_12_part;
 end; $procedure$
 language plpgsql;
diff --git a/packaging/dbscripts/insert_data.sql 
b/packaging/dbscripts/insert_data.sql
index 96887a9..a068bdf 100644
--- a/packaging/dbscripts/insert_data.sql
+++ b/packaging/dbscripts/insert_data.sql
@@ -41,7 +41,7 @@
 INSERT INTO network (id,name,description,storage_pool_id) SELECT v_id_0009, 
'ovirtmgmt', 'Management Network', v_storage_pool_id;
 INSERT INTO network_cluster (network_id, cluster_id, status) SELECT 
v_id_0009,v_cluster_id,1;
 
-INSERT INTO vm_static (vm_guid, vm_name, mem_size_mb, vmt_guid, os, 
description, vds_group_id, domain, creation_date, num_of_monitors, 
is_initialized, is_auto_suspend, num_of_sockets, cpu_per_socket, usb_policy, 
time_zone, is_stateless, fail_back, _create_date, _update_date, 
dedicated_vm_for_vds, auto_startup, vm_type, nice_level, default_boot_sequence, 
default_display_type, priority, iso_path, origin, initrd_url, kernel_url, 
kernel_params, migration_support, userdefined_properties, 
predefined_properties, min_allocated_mem, entity_type, child_count, 
template_status, quota_id, allow_console_reconnect, cpu_pinning, 
is_smartcard_enabled) VALUES ('00000000-0000-0000-0000-000000000000', 'Blank', 
1024, '00000000-0000-0000-0000-000000000000', 0, 'Blank template', 
'00000001-0001-0001-0001-000000000001', '', '2008-04-01 00:00:00+03', 1, NULL, 
false, 1, 1, 1, NULL, NULL, false, '2013-12-25 15:31:54.367179+02', '2013-12-25 
15:31:53.239308+02', NULL, NULL, 0, 0, 0, 0, 0, '', 0, NULL, N!
 ULL, NULL, 0, NULL, NULL, 0, 'TEMPLATE', 0, 0, NULL, false, NULL, false);
+INSERT INTO vm_static (vm_guid, vm_name, mem_size_mb, vmt_guid, os, 
description, vds_group_id, domain, creation_date, num_of_monitors, 
is_initialized, is_auto_suspend, num_of_sockets, cpu_per_socket, usb_policy, 
time_zone, is_stateless, fail_back, _create_date, _update_date, 
dedicated_vm_for_vds, auto_startup, vm_type, nice_level, default_boot_sequence, 
default_display_type, priority, iso_path, origin, initrd_url, kernel_url, 
kernel_params, migration_support, userdefined_properties, 
predefined_properties, min_allocated_mem, entity_type, child_count, 
template_status, quota_id, allow_console_reconnect, cpu_pinning, 
is_smartcard_enabled) VALUES ('00000000-0000-0000-0000-000000000000', 'Blank', 
1024, '00000000-0000-0000-0000-000000000000', 0, 'Blank template', v_cluster_id 
, '', '2008-04-01 00:00:00+03', 1, NULL, false, 1, 1, 1, NULL, NULL, false, 
'2013-12-25 15:31:54.367179+02', '2013-12-25 15:31:53.239308+02', NULL, NULL, 
0, 0, 0, 0, 0, '', 0, NULL, NULL, NULL, 0, NULL, NULL,!
  0, 'TEMPLATE', 0, 0, NULL, false, NULL, false);
 
 
 INSERT INTO event_map(event_up_name, event_down_name) values('VDC_STOP', 
'VDC_START');


-- 
To view, visit http://gerrit.ovirt.org/24087
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic5650fe1586fae320484f8cd36698491554efa57
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.4
Gerrit-Owner: Eli Mesika <emes...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to