Maor Lipchuk has uploaded a new change for review.

Change subject: core: update sp to initialize OVF data
......................................................................

core: update sp to initialize OVF data

update stored procedure at unregistered stored procedure to set the OVF
data from the DB, only if the ovf_data is null.

Change-Id: Ibee357b84da7fd7845792f975eaa72f99f16bd67
Signed-off-by: Maor Lipchuk <[email protected]>
---
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/UnregisteredOVFDataDAODbFacadeImpl.java
M packaging/dbscripts/unregistered_OVF_data_sp.sql
2 files changed, 5 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/47/29247/1

diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/UnregisteredOVFDataDAODbFacadeImpl.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/UnregisteredOVFDataDAODbFacadeImpl.java
index 06b19b3..6598b56 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/UnregisteredOVFDataDAODbFacadeImpl.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/UnregisteredOVFDataDAODbFacadeImpl.java
@@ -53,6 +53,7 @@
                                 ovfEntityData.getLowestCompVersion() != null ? 
ovfEntityData.getLowestCompVersion()
                                         .getValue() : null)
                         .addValue("storage_domain_id", 
ovfEntityData.getStorageDomainId())
+                        .addValue("ovf_data", ovfEntityData.getOvfData())
                         .addValue("ovf_extra_data", 
ovfEntityData.getOvfExtraData()));
     }
 
diff --git a/packaging/dbscripts/unregistered_OVF_data_sp.sql 
b/packaging/dbscripts/unregistered_OVF_data_sp.sql
index 50b0573..024986b 100644
--- a/packaging/dbscripts/unregistered_OVF_data_sp.sql
+++ b/packaging/dbscripts/unregistered_OVF_data_sp.sql
@@ -7,17 +7,18 @@
    v_architecture INTEGER,
    v_lowest_comp_version VARCHAR(40),
    v_storage_domain_id UUID,
+   v_ovf_data TEXT,
    v_ovf_extra_data TEXT)
 RETURNS VOID
    AS $procedure$
 BEGIN
-        INSERT INTO unregistered_ovf_of_entities(entity_guid, entity_name, 
entity_type, architecture, lowest_comp_version, storage_domain_id, 
ovf_extra_data)
-        VALUES (v_entity_guid, v_entity_name, v_entity_type, v_architecture, 
v_lowest_comp_version, v_storage_domain_id, v_ovf_extra_data);
+        INSERT INTO unregistered_ovf_of_entities(entity_guid, entity_name, 
entity_type, architecture, lowest_comp_version, storage_domain_id, 
ovf_extra_data, ovf_data)
+        VALUES (v_entity_guid, v_entity_name, v_entity_type, v_architecture, 
v_lowest_comp_version, v_storage_domain_id, v_ovf_extra_data, v_ovf_data);
 
         UPDATE unregistered_ovf_of_entities u
         SET ovf_data = vog.ovf_data
         FROM vm_ovf_generations vog
-        WHERE vog.vm_guid = u.entity_guid AND u.entity_guid = v_entity_guid;
+        WHERE vog.vm_guid = u.entity_guid AND u.entity_guid = v_entity_guid 
AND v_ovf_data IS null;
 END; $procedure$
 LANGUAGE plpgsql;
 


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

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

Reply via email to