Liron Aravot has posted comments on this change.
Change subject: core: introducing OvfAutoUpdate
......................................................................
Patch Set 19: (8 inline comments)
....................................................
File backend/manager/dbscripts/storages_sp.sql
Line 98: SELECT vm_guid
Line 99: FROM vms
Line 100: WHERE storage_pool_id = v_id);
Line 101: delete FROM vm_static where vm_guid in (select vm_guid from vms
where storage_pool_id = v_id);
Line 102:
Done
Line 103: -- Get (and keep) a shared lock with "right to upgrade to
exclusive"
Line 104: -- in order to force locking parent before children
Line 105: select id INTO v_val FROM storage_pool WHERE id = v_id FOR
UPDATE;
Line 106:
....................................................
File backend/manager/dbscripts/upgrade/03_02_1550_add_vm_generation_columns.sql
Line 9: );
Line 10:
Line 11: INSERT INTo vm_ovf_generations
Line 12: (SELECT vm.vm_guid, sp.id
Line 13: FROM vm_static vm ,storage_pool sp, vds_groups vg
Done
Line 14: WHERE vg.storage_pool_id = sp.id AND vm.vds_group_id =
vg.vds_group_id);
Line 15:
Line 16: -- Only pre-existing vms should have ovf_generation set to 1, so after
we added
Line 17: -- the pre existing vms, the default should be 0.
Line 17: -- the pre existing vms, the default should be 0.
Line 18: SELECT fn_db_change_column_type ('vm_ovf_generations',
'ovf_generation', 'BIGINT DEFAULT 1','BIGINT DEFAULT 0');
Line 19:
Line 20: CREATE INDEX IDX_vm_ovf_generations_vm_guid ON
vm_ovf_generations(vm_guid);
Line 21: CREATE INDEX IDX_vm_ovf_generations_storage_pool_id ON
vm_ovf_generations(storage_pool_id);
It will, mentioned in last patchset.
....................................................
File backend/manager/dbscripts/vm_templates_sp.sql
Line 126: v_is_smartcard_enabled,
Line 127: v_is_delete_protected);
Line 128: INSERT INTO vm_ovf_generations(vm_guid, storage_pool_id)
Line 129: VALUES (v_vmt_guid, (SELECT storage_pool_id
Line 130: FROM vds_groups vg
Done
Line 131: WHERE vg.vds_group_id = v_vds_group_id));
Line 132: END; $procedure$
Line 133: LANGUAGE plpgsql;
Line 134:
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OvfDataUpdater.java
Line 109: proccessedOvfGenerationsInfo = null;
Line 110: }
Line 111:
Line 112: /**
Line 113: * update ovfs for updated/newly vms since last run for the given
storage pool
Done
Line 114: * @param poolId
Line 115: */
Line 116: protected void updateOvfForVmsOfStoragePool(Guid poolId) {
Line 117: List<Guid> vmsIdsForUpdate =
getVmAndTemplatesGenerationsDao().getVmsIdsForOvfUpdate(poolId);
Line 129: }
Line 130:
Line 131: /**
Line 132: * removes from the storage ovf files of vm/templates that were
removed from the db
Line 133: * since the last OvfDataUpdater run.
Done
Line 134: * @param poolId
Line 135: */
Line 136: private void removeOvfForTemplatesAndVmsOfStoragePool(Guid
poolId) {
Line 137: List<Guid> idsForRemoval =
getVmAndTemplatesGenerationsDao().getIdsForOvfDeletion(poolId);
Line 149: * @param poolId
Line 150: * @param vmsAndTemplateMetadata
Line 151: */
Line 152: protected void performOvfUpdate(Guid poolId , Map<Guid,
KeyValuePairCompat<String, List<Guid>>> vmsAndTemplateMetadata) {
Line 153: executeUpdateVmInSpmCommand(poolId, vmsAndTemplateMetadata,
Guid.Empty);
added prints before and after each operation at the moment in ovfUpdate_timer
method, if we would want further logging it can be added.
Line 154: int i=0;
Line 155: while (i<proccessedIdsInfo.size()) {
Line 156: int sizeToUpdate = Math.min(MAX_ITEMS_PER_SQL_STATEMENT,
proccessedIdsInfo.size() -i);
Line 157: List<Guid> guidsForUpdate = proccessedIdsInfo.subList(i,
i + sizeToUpdate);
....................................................
File
backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StoragePoolDAOTest.java
Line 148: @Test
Line 149: public void testGetAllByStatus() {
Line 150: List<storage_pool> result =
dao.getAllByStatus(StoragePoolStatus.Up);
Line 151: assertNotNull("list of returned pool shouldn't be null",
result);
Line 152: assertEquals("wrong number of storage pool returned", 5,
result.size());
Done
Line 153:
Line 154: result = dao.getAllByStatus(StoragePoolStatus.Maintanance);
Line 155: assertNotNull("list of returned pool shouldn't be null",
result);
Line 156: assertEquals("wrong number of storage pool returned", 0,
result.size());
--
To view, visit http://gerrit.ovirt.org/9328
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I9b5132300fb1f1fd94f771cab15efe5246dbeca8
Gerrit-PatchSet: 19
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Liron Aravot <[email protected]>
Gerrit-Reviewer: Allon Mureinik <[email protected]>
Gerrit-Reviewer: Arik Hadas <[email protected]>
Gerrit-Reviewer: Ayal Baron <[email protected]>
Gerrit-Reviewer: Liron Aravot <[email protected]>
Gerrit-Reviewer: Maor Lipchuk <[email protected]>
Gerrit-Reviewer: Michael Kublin <[email protected]>
Gerrit-Reviewer: Tal Nisan <[email protected]>
Gerrit-Reviewer: Vered Volansky <[email protected]>
Gerrit-Reviewer: Yair Zaslavsky <[email protected]>
Gerrit-Reviewer: liron aravot <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches