Alex Lourie has uploaded a new change for review.

Change subject: packaging: Removed obsolete 
add_fn_db_get_async_tasks_function.sql
......................................................................

packaging: Removed obsolete add_fn_db_get_async_tasks_function.sql

This patch removes an obsolete code loading into the DB during
upgrade flows.

Change-Id: Ic0ca20ff2da1bdf8f6037e877b3697b7af8443c2
Bug-Url: https://bugzilla.redhat.com/951092
Signed-off-by: Alex Lourie <[email protected]>
---
M Makefile
M ovirt-engine.spec.in
D packaging/fedora/setup/add_fn_db_get_async_tasks_function.sql
M packaging/fedora/setup/basedefs.py
M packaging/fedora/setup/engine-upgrade.py
5 files changed, 0 insertions(+), 82 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/98/14898/1

diff --git a/Makefile b/Makefile
index 1d592eb..0a34e09 100644
--- a/Makefile
+++ b/Makefile
@@ -323,7 +323,6 @@
        install -m 644 packaging/fedora/setup/miniyum.py 
$(DESTDIR)$(DATA_DIR)/scripts
        install -m 644 packaging/fedora/setup/output_messages.py 
$(DESTDIR)$(DATA_DIR)/scripts
        install -m 644 packaging/fedora/setup/post_upgrade.py 
$(DESTDIR)$(DATA_DIR)/scripts
-       install -m 644 
packaging/fedora/setup/add_fn_db_get_async_tasks_function.sql 
$(DESTDIR)$(DATA_DIR)/scripts
 
        # Install man pages
        install -m 644 packaging/man/engine-setup.8 $(DESTDIR)$(MAN_DIR)/man8/
diff --git a/ovirt-engine.spec.in b/ovirt-engine.spec.in
index 85631c6..fe7d6c3 100644
--- a/ovirt-engine.spec.in
+++ b/ovirt-engine.spec.in
@@ -678,7 +678,6 @@
 %{engine_data}/scripts/engine-cleanup.py*
 %{engine_data}/scripts/engine-upgrade.py*
 %{engine_data}/scripts/post_upgrade.py*
-%{engine_data}/scripts/add_fn_db_get_async_tasks_function.sql
 
 # DB-related tools
 %{engine_data}/scripts/dbutils
diff --git a/packaging/fedora/setup/add_fn_db_get_async_tasks_function.sql 
b/packaging/fedora/setup/add_fn_db_get_async_tasks_function.sql
deleted file mode 100644
index 7780d3e..0000000
--- a/packaging/fedora/setup/add_fn_db_get_async_tasks_function.sql
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Displays DC id , DC name, SPM Host id , SPM Host name and number of async 
tasks awaiting.
-
-1) create a record type with DC name, DC id, SPM host id, SPM host name, count
-
-2) get all distinct DC ids from the parameters Json representation
-
-3) Run a cursor for each result in 2)
-
-   a) get DC name
-   b) get SPM Host id & name if available
-   c) get count of tasks
-
-   return current record
-
-4) return set of generated records
-*/
-
-DROP TYPE IF EXISTS async_tasks_info_rs CASCADE;
-CREATE TYPE async_tasks_info_rs AS (
-    dc_id UUID, dc_name CHARACTER VARYING, spm_host_id UUID, spm_host_name 
CHARACTER VARYING, task_count integer);
-
-
-create or replace FUNCTION fn_db_get_async_tasks()
-returns SETOF async_tasks_info_rs
-AS $procedure$
-DECLARE
-    v_record async_tasks_info_rs;
-
-    -- selects all UUID values after the storage_pool_id and uuid found in 
serialized parameters
-    v_tasks_cursor cursor for select distinct
-         substring(
-                   substring(
-                             substring (action_parameters from 
'storage_pool_id.*')--storage_pool_id
-                   ,'uuid.*')--uuid
-         ,'........-....-....-....-............') from async_tasks;--uuid value
-begin
-
-    OPEN v_tasks_cursor;
-    FETCH v_tasks_cursor into v_record.dc_id;
-    WHILE FOUND LOOP
-        -- get dc_name and SPM Host id
-        v_record.dc_name := name from storage_pool where id = v_record.dc_id;
-        v_record.spm_host_id :=
-            spm_vds_id from storage_pool where id = v_record.dc_id;
-        -- get Host name if we have non NULL SPM Host
-        if (v_record.spm_host_id IS NOT NULL) then
-            v_record.spm_host_name :=
-                vds_name from vds_static where vds_id = v_record.spm_host_id;
-        else
-            v_record.spm_host_name:='';
-        end if;
-        -- get tasks count for this DC
-        v_record.task_count := count(*) from async_tasks
-            where position (cast(v_record.dc_id as varchar) in 
action_parameters) > 0;
-        -- return the record
-        RETURN NEXT v_record;
-        FETCH v_tasks_cursor into v_record.dc_id;
-    END LOOP;
-    CLOSE v_tasks_cursor;
-    -- return full set of generated records
-    RETURN;
-END; $procedure$
-LANGUAGE plpgsql;
-
diff --git a/packaging/fedora/setup/basedefs.py 
b/packaging/fedora/setup/basedefs.py
index 504a01c..375aad4 100644
--- a/packaging/fedora/setup/basedefs.py
+++ b/packaging/fedora/setup/basedefs.py
@@ -83,7 +83,6 @@
 FILE_JBOSSAS_CONF="/etc/%s/%s.conf" % (ENGINE_SERVICE_NAME, 
ENGINE_SERVICE_NAME)
 FILE_DB_INSTALL_SCRIPT="engine-db-install.sh"
 FILE_DB_UPGRADE_SCRIPT="upgrade.sh"
-FILE_DB_ASYNC_TASKS="%s/scripts/add_fn_db_get_async_tasks_function.sql" % 
DIR_ENGINE
 FILE_ENGINE_CONFIG_BIN="/usr/bin/engine-config"
 FILE_ENGINE_CONFIG_PROPS="engine-config-install.properties"
 FILE_ENGINE_EXTENDED_CONF = os.path.join(DIR_CONFIG, FILE_ENGINE_CONFIG_PROPS)
diff --git a/packaging/fedora/setup/engine-upgrade.py 
b/packaging/fedora/setup/engine-upgrade.py
index 6192fd5..e72b6fd 100755
--- a/packaging/fedora/setup/engine-upgrade.py
+++ b/packaging/fedora/setup/engine-upgrade.py
@@ -880,20 +880,6 @@
         raise Exception(MSG_ERROR_CLEAR_ZOMBIES)
 
 
-def deployDbAsyncTasks(dbName=basedefs.DB_NAME):
-    # Deploy DB functionality first
-    cmd = [
-        basedefs.EXEC_PSQL,
-        "-U", SERVER_ADMIN,
-        "-h", SERVER_NAME,
-        "-p", SERVER_PORT,
-        "-f", basedefs.FILE_DB_ASYNC_TASKS,
-        "-w",
-        "-d", dbName,
-    ]
-
-    out, rc = utils.execCmd(cmdList=cmd, failOnError=True, msg="Error updating 
DB for getting async_tasks", envDict=utils.getPgEnv())
-
 def getRunningTasks(dbName=basedefs.DB_NAME):
     # Get async tasks:
     runningTasks, rc = utils.parseRemoteSqlCommand(
@@ -950,7 +936,6 @@
     """
     # Find running tasks first
     logging.debug(MSG_RUNNING_TASKS)
-    deployDbAsyncTasks(dbName)
     runningTasks = getRunningTasks(dbName)
     compensations = getCompensations(dbName)
     engineConfigBinary = basedefs.FILE_ENGINE_CONFIG_BIN


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

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

Reply via email to