Lior Vernia has uploaded a new change for review.

Change subject: core: Mark management network as display and migration
......................................................................

core: Mark management network as display and migration

Introducing an upgrade script to mark the management network as
display and/or migration, if no other network in the cluster has that
role. This is implicitly the case anyway because when these roles
haven't been assigned they fall back to the management network, this
makes it explicit.

Change-Id: I73bf3c583ae28bf32d7c602ec9f4b0fb5c7f391d
Signed-off-by: Lior Vernia <[email protected]>
---
A 
packaging/dbscripts/upgrade/03_04_0240_set_display_migration_cluster_network.sql
1 file changed, 22 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/82/22382/1

diff --git 
a/packaging/dbscripts/upgrade/03_04_0240_set_display_migration_cluster_network.sql
 
b/packaging/dbscripts/upgrade/03_04_0240_set_display_migration_cluster_network.sql
new file mode 100644
index 0000000..97f9764
--- /dev/null
+++ 
b/packaging/dbscripts/upgrade/03_04_0240_set_display_migration_cluster_network.sql
@@ -0,0 +1,22 @@
+CREATE FUNCTION _set_display_migration() RETURNS VOID AS $$
+DECLARE
+    mgmt_name CHARACTER VARYING(15);
+    mgmt_id UUID;
+    id UUID;
+BEGIN
+    SELECT option_value FROM vdc_options WHERE option_name='ManagementNetwork' 
INTO mgmt_name;
+    FOR id IN (SELECT DISTINCT cluster_id FROM network_cluster) LOOP
+        SELECT network_id FROM network_cluster_view WHERE cluster_id=id AND 
network_name=mgmt_name INTO mgmt_id;
+        IF NOT EXISTS (SELECT 1 FROM network_cluster WHERE cluster_id=id AND 
is_display=true) THEN
+           UPDATE network_cluster SET is_display=true WHERE cluster_id=id AND 
network_id=mgmt_id;
+       END IF;
+       IF NOT EXISTS (SELECT network_id FROM network_cluster WHERE 
cluster_id=id AND migration=true) THEN
+          UPDATE network_cluster SET migration=true WHERE cluster_id=id AND 
network_id=mgmt_id;
+       END IF;
+    END LOOP;
+END;
+$$ LANGUAGE plpgsql;
+
+SELECT _set_display_migration();
+
+DROP FUNCTION _set_display_migration();


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I73bf3c583ae28bf32d7c602ec9f4b0fb5c7f391d
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Lior Vernia <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to