Liron Aravot has posted comments on this change.

Change subject: core: introducing OvfAutoUpdate
......................................................................


Patch Set 14: (56 inline comments)

....................................................
File backend/manager/dbscripts/storages_sp.sql
Line 98
Line 99
Line 100
Line 101
Line 102
Done


....................................................
File backend/manager/dbscripts/upgrade/03_01_1530_add_vm_generation_columns.sql
Line 1: select fn_db_add_column('vm_static', 'db_generation', 'BIGINT default 
1');
will change at last rebase, as scripts keep being added.
Line 2: 
Line 3: -- not added as foreign key so that when vm is removed, its record in 
vm_ovf_generations record will stay
Line 4: CREATE TABLE vm_ovf_generations
Line 5: (


Line 3: -- not added as foreign key so that when vm is removed, its record in 
vm_ovf_generations record will stay
Line 4: CREATE TABLE vm_ovf_generations
Line 5: (
Line 6:    vm_guid UUID PRIMARY KEY,
Line 7:    storage_pool_id UUID references storage_pool(id) ON DELETE CASCADE,
Done
Line 8:    ovf_generation BIGINT default 1
Line 9: );
Line 10: 
Line 11: INSERT into vm_ovf_generations (select vm.vm_guid, sp.id  from 
vm_static vm ,storage_pool sp, vds_groups vg where vg.storage_pool_id = sp.id 
AND vm.vds_group_id = vg.vds_group_id);


Line 4: CREATE TABLE vm_ovf_generations
Line 5: (
Line 6:    vm_guid UUID PRIMARY KEY,
Line 7:    storage_pool_id UUID references storage_pool(id) ON DELETE CASCADE,
Line 8:    ovf_generation BIGINT default 1
Done
Line 9: );
Line 10: 
Line 11: INSERT into vm_ovf_generations (select vm.vm_guid, sp.id  from 
vm_static vm ,storage_pool sp, vds_groups vg where vg.storage_pool_id = sp.id 
AND vm.vds_group_id = vg.vds_group_id);
Line 12: 


Line 7:    storage_pool_id UUID references storage_pool(id) ON DELETE CASCADE,
Line 8:    ovf_generation BIGINT default 1
Line 9: );
Line 10: 
Line 11: INSERT into vm_ovf_generations (select vm.vm_guid, sp.id  from 
vm_static vm ,storage_pool sp, vds_groups vg where vg.storage_pool_id = sp.id 
AND vm.vds_group_id = vg.vds_group_id);
Done
Line 12: 
Line 13: -- Only pre-existing vms should have ovf_generation set to 1, so after 
we added
Line 14: -- the pre existing vms, the default should be 0.
Line 15: ALTER TABLE vm_ovf_generations ALTER COLUMN ovf_generation set default 
0;


Line 11: INSERT into vm_ovf_generations (select vm.vm_guid, sp.id  from 
vm_static vm ,storage_pool sp, vds_groups vg where vg.storage_pool_id = sp.id 
AND vm.vds_group_id = vg.vds_group_id);
Line 12: 
Line 13: -- Only pre-existing vms should have ovf_generation set to 1, so after 
we added
Line 14: -- the pre existing vms, the default should be 0.
Line 15: ALTER TABLE vm_ovf_generations ALTER COLUMN ovf_generation set default 
0;
Done
Line 16: 
Line 17: CREATE INDEX IDX_vm_ovf_generations_vm_guid ON 
vm_ovf_generations(vm_guid);


Line 13: -- Only pre-existing vms should have ovf_generation set to 1, so after 
we added
Line 14: -- the pre existing vms, the default should be 0.
Line 15: ALTER TABLE vm_ovf_generations ALTER COLUMN ovf_generation set default 
0;
Line 16: 
Line 17: CREATE INDEX IDX_vm_ovf_generations_vm_guid ON 
vm_ovf_generations(vm_guid);
the convenetion we use is with IDX prefix


Line 14: -- the pre existing vms, the default should be 0.
Line 15: ALTER TABLE vm_ovf_generations ALTER COLUMN ovf_generation set default 
0;
Line 16: 
Line 17: CREATE INDEX IDX_vm_ovf_generations_vm_guid ON 
vm_ovf_generations(vm_guid);
Line 18: CREATE INDEX IDX_vm_ovf_generations_storage_pool_id ON 
vm_ovf_generations(storage_pool_id);
the convenetion we use is with IDX prefix


....................................................
File backend/manager/dbscripts/vms_sp.sql
Line 1: ----------------------------------------------------------------
Line 2: -- [vm_ovf_generations] Table
Line 3: 
Line 4: Create or replace FUNCTION UpdateOvfGenerations(v_vms_ids 
VARCHAR(5000), v_vms_db_generations VARCHAR(5000))
answered.
Line 5:     RETURNS VOID
Line 6:     AS $procedure$
Line 7: DECLARE
Line 8: curs_vmids CURSOR FOR SELECT ID from fnSplitterUuid(v_vms_ids);


Line 35:    AS $procedure$
Line 36: BEGIN
Line 37: RETURN QUERY SELECT ovf.vm_guid as vm_guid
Line 38:    FROM vm_ovf_generations ovf
Line 39:    WHERE NOT EXISTS (SELECT 1 FROM vm_static v WHERE v.vm_guid = 
ovf.vm_guid) AND
Done
Line 40:          ovf.storage_pool_id = v_storage_pool_id;
Line 41: END; $procedure$
Line 42: LANGUAGE plpgsql;
Line 43: 


Line 67:    AS $procedure$
Line 68: BEGIN
Line 69: RETURN QUERY SELECT templates.vmt_guid as vm_guid
Line 70:    FROM vm_templates_view templates, vm_ovf_generations generations
Line 71:    WHERE generations.vm_guid = templates.vmt_guid AND 
templates.db_generation > generations.ovf_generation
Done
Line 72:          AND templates.storage_pool_id = v_storage_pool_id;
Line 73: END; $procedure$
Line 74: LANGUAGE plpgsql;
Line 75: 


Line 424:    AS $procedure$
Line 425: BEGIN
Line 426: INSERT INTO vm_static(description, mem_size_mb, os, vds_group_id, 
vm_guid, VM_NAME, 
vmt_guid,domain,creation_date,num_of_monitors,allow_console_reconnect,is_initialized,is_auto_suspend,num_of_sockets,cpu_per_socket,usb_policy,
 time_zone,auto_startup,is_stateless,dedicated_vm_for_vds, fail_back, 
default_boot_sequence, vm_type, nice_level, default_display_type, 
priority,iso_path,origin,initrd_url,kernel_url,kernel_params,migration_support,predefined_properties,userdefined_properties,min_allocated_mem,
 entity_type, quota_id, cpu_pinning, is_smartcard_enabled)
Line 427:       VALUES(v_description,  v_mem_size_mb, v_os, v_vds_group_id, 
v_vm_guid, v_vm_name, v_vmt_guid, v_domain, v_creation_date, v_num_of_monitors, 
v_allow_console_reconnect, v_is_initialized, v_is_auto_suspend, 
v_num_of_sockets, v_cpu_per_socket, v_usb_policy, v_time_zone, 
v_auto_startup,v_is_stateless,v_dedicated_vm_for_vds,v_fail_back, 
v_default_boot_sequence, v_vm_type, v_nice_level, v_default_display_type, 
v_priority,v_iso_path,v_origin,v_initrd_url,v_kernel_url,v_kernel_params,v_migration_support,v_predefined_properties,v_userdefined_properties,v_min_allocated_mem,
 'VM', v_quota_id, v_cpu_pinning, v_is_smartcard_enabled);
Line 428: INSERT INTO vm_ovf_generations(vm_guid, storage_pool_id) VALUES 
(v_vm_guid, (select storage_pool_id from vds_groups vg where vg.vds_group_id = 
v_vds_group_id)); 
Done
Line 429: END; $procedure$
Line 430: LANGUAGE plpgsql;
Line 431: 
Line 432: 


Line 462: 
Line 463: 
Line 464: 
Line 465: 
Line 466: 
left by mistake, done
Line 467: Create or replace FUNCTION 
IncrementDbGenerationForAllInStoragePool(v_storage_pool_id UUID)
Line 468: RETURNS VOID
Line 469:    AS $procedure$
Line 470: DECLARE


Line 466: 
Line 467: Create or replace FUNCTION 
IncrementDbGenerationForAllInStoragePool(v_storage_pool_id UUID)
Line 468: RETURNS VOID
Line 469:    AS $procedure$
Line 470: DECLARE
in order to perform the updates to the vms by order (vm id)
Line 471:      curs CURSOR FOR SELECT vms.vm_guid FROM 
Line 472:      vm_static vms WHERE vms.vds_group_id IN (SELECT v.vds_group_id 
FROM vds_groups v, storage_pool sp WHERE sp.id=v_storage_pool_id AND 
v.storage_pool_id = sp.id) 
Line 473:      ORDER BY vm_guid;
Line 474:      id UUID;


Line 468: RETURNS VOID
Line 469:    AS $procedure$
Line 470: DECLARE
Line 471:      curs CURSOR FOR SELECT vms.vm_guid FROM 
Line 472:      vm_static vms WHERE vms.vds_group_id IN (SELECT v.vds_group_id 
FROM vds_groups v, storage_pool sp WHERE sp.id=v_storage_pool_id AND 
v.storage_pool_id = sp.id) 
Done
Line 473:      ORDER BY vm_guid;
Line 474:      id UUID;
Line 475: BEGIN
Line 476:         OPEN curs;


Line 475: BEGIN
Line 476:         OPEN curs;
Line 477:         LOOP
Line 478:               FETCH curs INTO id;
Line 479:               IF NOT FOUND THEN
Done
Line 480:            EXIT;
Line 481:          END IF;
Line 482:       UPDATE vm_static SET db_generation  = db_generation + 1 WHERE 
vm_guid = id;
Line 483:         END LOOP;


Line 492: Create or replace FUNCTION 
IncrementDbGenerationForAllInStoragePool(v_storage_pool_id UUID)
Line 493: RETURNS VOID
Line 494:    AS $procedure$
Line 495: BEGIN
Line 496:       UPDATE vm_static 
Done
Line 497:       SET db_generation  = db_generation + 1
Line 498:       WHERE storage_pool_id IN (SELECT v.vds_group_id FROM vds_groups 
v, storage_pool sp where sp.id=v_storage_pool_id);
Line 499: END; $procedure$
Line 500: LANGUAGE plpgsql;


Line 727: 
Line 728: Create or replace FUNCTION GetVmsByIds(v_vms_ids VARCHAR(5000)) 
RETURNS SETOF vms
Line 729:    AS $procedure$
Line 730: BEGIN
Line 731: RETURN QUERY SELECT vm.* 
Done
Line 732: FROM vms vm
Line 733:    WHERE vm.vm_guid in (SELECT ID from fnSplitterUuid(v_vms_ids));
Line 734: END; $procedure$
Line 735: LANGUAGE plpgsql;


Line 729:    AS $procedure$
Line 730: BEGIN
Line 731: RETURN QUERY SELECT vm.* 
Line 732: FROM vms vm
Line 733:    WHERE vm.vm_guid in (SELECT ID from fnSplitterUuid(v_vms_ids));
Done
Line 734: END; $procedure$
Line 735: LANGUAGE plpgsql;
Line 736: 
Line 737: 


Line 877: 
Line 878:       INSERT INTO vm_dynamic(vm_guid, status) VALUES(v_vm_guid, 0);
Line 879: 
Line 880:       INSERT INTO vm_statistics(vm_guid) VALUES(v_vm_guid);
Line 881:       
Done
Line 882:       INSERT INTO vm_ovf_generations(vm_guid, storage_pool_id) VALUES 
(v_vm_guid, (select storage_pool_id from vds_groups vg where vg.vds_group_id = 
v_vds_group_id));
Line 883: 
Line 884:       UPDATE vm_static
Line 885:       SET child_count =(SELECT COUNT(*) FROM vm_static WHERE vmt_guid 
= v_vmt_guid)


....................................................
File backend/manager/dbscripts/vm_templates_sp.sql
Line 246: 
Line 247: 
Line 248: 
Line 249: 
Line 250: Create or replace FUNCTION GetVmTemplatesByIds(v_vms_tremplates_ids 
VARCHAR(5000)) RETURNS SETOF vm_templates_view
i use varchar(5000) as it's the type we use in all of the methods that call the 
splitter method.
Line 251:    AS $procedure$
Line 252: BEGIN
Line 253: RETURN QUERY SELECT vm_templates.*
Line 254:    FROM vm_templates_view vm_templates


Line 252: BEGIN
Line 253: RETURN QUERY SELECT vm_templates.*
Line 254:    FROM vm_templates_view vm_templates
Line 255:    WHERE vm_templates.vmt_guid in (SELECT ID from 
fnSplitterUuid(v_vms_tremplates_ids));
Line 256: END; $procedure$
that's the use in all the calls to this function, how would you prefer it done?
Line 257: LANGUAGE plpgsql;
Line 258: 
Line 259: 
Line 260: 


....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java
Line 248:         return DbFacade.getInstance().getBusinessEntitySnapshotDao();
Line 249:     }
Line 250: 
Line 251: 
Line 252:     protected VmAndTemplatesGenerationsDAO 
getVmAndTemplatesGenerationsDAO() {
it's being accessed from many commands from different hirerchies, putting it in 
other place would result in duplications.
Line 253:         return 
DbFacade.getInstance().getVmAndTemplatesGenerationsDAO();
Line 254:     }
Line 255: 
Line 256:     protected VdsSpmIdMapDAO getVdsSpmIdMapDAO() {


....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OvfDataUpdater.java
Line 1: package org.ovirt.engine.core.bll;
1. Done

2. It will only complicate things around here, though there are some 
similarities between vm and templates handling - we have different method for 
them in ovf manager and different treatment, generalize the methods here will 
only add more complications at the moment - so i prefer to leave it that way.
Line 2: 
Line 3: import java.util.ArrayList;
Line 4: import java.util.HashMap;
Line 5: import java.util.LinkedList;


Line 45: 
Line 46: public final class OvfDataUpdater {
Line 47:     private static final Log log = 
LogFactory.getLog(OvfDataUpdater.class);
Line 48:     private static final OvfDataUpdater INSTANCE = new 
OvfDataUpdater();
Line 49:     private static final int ITEMS_COUNT_PER_UPDATE = Config.<Integer> 
GetValue(ConfigValues.OvfItemsCountPerUpdate);
Done
Line 50:     private static final int MAX_ITEMS_PER_SQL_STATEMENT = 100;
Line 51: 
Line 52:     private List<Guid> proccessedIdsInfo;
Line 53:     private List<Long> proccessedOvfGenerationsInfo;


Line 46: public final class OvfDataUpdater {
Line 47:     private static final Log log = 
LogFactory.getLog(OvfDataUpdater.class);
Line 48:     private static final OvfDataUpdater INSTANCE = new 
OvfDataUpdater();
Line 49:     private static final int ITEMS_COUNT_PER_UPDATE = Config.<Integer> 
GetValue(ConfigValues.OvfItemsCountPerUpdate);
Line 50:     private static final int MAX_ITEMS_PER_SQL_STATEMENT = 100;
this was added per request  in last patchset to avoid too long sql statements 
regardless of the value of ITEMS_COUNT_PER_UPDATE config value, it's hardcoded 
intentionally.
Line 51: 
Line 52:     private List<Guid> proccessedIdsInfo;
Line 53:     private List<Long> proccessedOvfGenerationsInfo;
Line 54: 


Line 49:     private static final int ITEMS_COUNT_PER_UPDATE = Config.<Integer> 
GetValue(ConfigValues.OvfItemsCountPerUpdate);
Line 50:     private static final int MAX_ITEMS_PER_SQL_STATEMENT = 100;
Line 51: 
Line 52:     private List<Guid> proccessedIdsInfo;
Line 53:     private List<Long> proccessedOvfGenerationsInfo;
1. i use them as members because they are populated within the same method and 
are used in some methods here.

2. using a pair won't do here - those two lists are used in call to a db 
procedure, so using it is a pair would require also to implement a method that 
uses String.join method specifically for a pair (each time on a different pair 
'member') or to build two different lists from the pair and call String.join on 
it - I prefer to just use two separate lists.
Line 54: 
Line 55:     OvfManager ovfManager;
Line 56: 
Line 57:     private OvfDataUpdater(){


Line 51: 
Line 52:     private List<Guid> proccessedIdsInfo;
Line 53:     private List<Long> proccessedOvfGenerationsInfo;
Line 54: 
Line 55:     OvfManager ovfManager;
Done
Line 56: 
Line 57:     private OvfDataUpdater(){
Line 58:         ovfManager = new OvfManager();
Line 59:         proccessedIdsInfo = new LinkedList<Guid>();


Line 53:     private List<Long> proccessedOvfGenerationsInfo;
Line 54: 
Line 55:     OvfManager ovfManager;
Line 56: 
Line 57:     private OvfDataUpdater(){
Done
Line 58:         ovfManager = new OvfManager();
Line 59:         proccessedIdsInfo = new LinkedList<Guid>();
Line 60:         proccessedOvfGenerationsInfo = new LinkedList<Long>();
Line 61:     }


Line 78: 
Line 79:     @OnTimerMethodAnnotation("ovfUpdate_timer")
Line 80:     public void ovfUpdate_timer() {
Line 81:         log.info("OvfDataUpdater: Attempting to update VMs/Templates 
Ovf.");
Line 82:         List<storage_pool> storagePools = getStoragePoolDao().getAll();
Done
Line 83:         for (storage_pool pool : storagePools) {
Line 84:             try {
Line 85:                 if (StoragePoolStatus.Up == pool.getstatus()) {
Line 86:                     clearProccessedInfo();


Line 83:         for (storage_pool pool : storagePools) {
Line 84:             try {
Line 85:                 if (StoragePoolStatus.Up == pool.getstatus()) {
Line 86:                     clearProccessedInfo();
Line 87:                     log.infoFormat("OvfDataUpdater: Attempting to 
update vms Ovf in Data Center {0}",
Done
Line 88:                             pool.getname());
Line 89:                     updateOvfForVmsOfStoragePool(pool.getId());
Line 90: 
Line 91:                     clearProccessedInfo();


Line 88:                             pool.getname());
Line 89:                     updateOvfForVmsOfStoragePool(pool.getId());
Line 90: 
Line 91:                     clearProccessedInfo();
Line 92:                     log.infoFormat("OvfDataUpdater: Attempting to 
update templates Ovf in Data Center {0}",
Done
Line 93:                             pool.getname());
Line 94:                     updateOvfForTemplatesOfStoragePool(pool.getId());
Line 95: 
Line 96:                     log.infoFormat("OvfDataUpdater: Attempting to 
remove uneeded Ovfs in Data Center {0}",


Line 95: 
Line 96:                     log.infoFormat("OvfDataUpdater: Attempting to 
remove uneeded Ovfs in Data Center {0}",
Line 97:                             pool.getname());
Line 98:                     // remove deleted vm/templates ovf
Line 99:                     
removeOvfForTemplatesAndVmsOfStoragePool(pool.getId());
there's a log call before on line 96, can you elaborate?
Line 100:                 }
Line 101:             } catch (Exception ex) {
Line 102:                 addAuditLogError(pool.getname());
Line 103:                 log.errorFormat("Exception while trying to update 
VMs/Templates ovf in Data Center {0}, the exception is {1}",


Line 115:      */
Line 116:     protected void updateOvfForVmsOfStoragePool(Guid poolId) {
Line 117:         // get vm ids that need to be updated.
Line 118:         List<Guid> vmsIdsForUpdate = 
getVmAndTemplatesGenerationsDao().getVmsIdsForOvfUpdate(poolId);
Line 119:         int i = 0;
I prefer to use while for that case
Line 120:         while (i < vmsIdsForUpdate.size()) {
Line 121:             int size = Math.min(ITEMS_COUNT_PER_UPDATE, 
vmsIdsForUpdate.size() - i);
Line 122:             List<Guid> idsToProcess = vmsIdsForUpdate.subList(i, 
i+size);
Line 123:             i+= size;


Line 128:             }
Line 129:         }
Line 130:     }
Line 131: 
Line 132:     private void clearProccessedInfo() {
Done
Line 133:         proccessedIdsInfo.clear();
Line 134:         proccessedOvfGenerationsInfo.clear();
Line 135:     }
Line 136: 


Line 133:         proccessedIdsInfo.clear();
Line 134:         proccessedOvfGenerationsInfo.clear();
Line 135:     }
Line 136: 
Line 137:     private void removeOvfForTemplatesAndVmsOfStoragePool(Guid 
poolId) {
was here by mistake, removed.
Line 138:         List<Guid> idsForRemoval = new 
LinkedList<Guid>(getVmAndTemplatesGenerationsDao().getIdsForOvfDeletion(poolId));
Line 139: 
Line 140:         for (Guid id : idsForRemoval){
Line 141:             executeRemoveVmInSpm(poolId, id, Guid.Empty);


Line 145:     }
Line 146: 
Line 147: 
Line 148:     protected void performOvfUpdate(Guid poolId , Map<Guid, 
KeyValuePairCompat<String, List<Guid>>> vmsAndTemplateMetadata) {
Line 149:         // update ovf metadata in vdsm
Done
Line 150:         executeUpdateVmInSpmCommand(poolId, vmsAndTemplateMetadata, 
Guid.Empty);
Line 151:         // update vm/templates ovf generation to the db generation 
that was updated in the storage.
Line 152:         int i = 0;
Line 153:         while (i<proccessedIdsInfo.size()) {


Line 196:      */
Line 197:     protected void updateOvfForTemplatesOfStoragePool(Guid poolId) {
Line 198:         List<Guid> templateIdsForUpdate = 
getVmAndTemplatesGenerationsDao().
Line 199:                 getVmTemplatesIdsForOvfUpdate(poolId);
Line 200:         int i = 0;
I prefer to use while in that case, seems nicer to me than for.
Line 201:         while (i < templateIdsForUpdate.size()) {
Line 202:             int size = Math.min(templateIdsForUpdate.size() - i, 
ITEMS_COUNT_PER_UPDATE);
Line 203:             List<Guid> idsToProcess = templateIdsForUpdate.subList(i, 
i + size);
Line 204:             i += size;


Line 335:         tempVar.setStorageDomainId(storageDomainId);
Line 336:         return 
Backend.getInstance().getResourceManager().RunVdsCommand(VDSCommandType.UpdateVM,
 tempVar)
Line 337:                 .getSucceeded();
Line 338:     }
Line 339: 
My bad, changed UpdateVM command but as this was added later on haven't add the 
change to this command as well. will add.
Line 340:     protected boolean executeRemoveVmInSpm(Guid storagePoolId, Guid 
vmId, Guid storageDomainId) {
Line 341:         return 
Backend.getInstance().getResourceManager().RunVdsCommand(VDSCommandType.RemoveVM,
Line 342:                 new RemoveVMVDSCommandParameters(storagePoolId, vmId, 
storageDomainId)).getSucceeded();
Line 343:     }


....................................................
File 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java
Line 109:     @Column(name = "is_stateless")
Line 110:     private boolean stateless;
Line 111: 
Line 112:     @Column(name = "db_generation")
Line 113:     private Long db_generation;
currently all of this class is using certain convention..i don't think that we 
should mix conventions, it should be replaced for all of this class at once.
Line 114: 
Line 115:     @Column(name = "is_smartcard_enabled")
Line 116:     private boolean smartcardEnabled;
Line 117: 


Line 224:         this.smartcardEnabled = smartcardEnabled;
Line 225:         setQuotaId(quotaId);
Line 226:     }
Line 227: 
Line 228:     public long getDb_generation() {
same answer as previous comment regarding that issue.
Line 229:         return db_generation;
Line 230:     }
Line 231: 
Line 232:     public void setDb_generation(long db_generation) {


Line 228:     public long getDb_generation() {
Line 229:         return db_generation;
Line 230:     }
Line 231: 
Line 232:     public void setDb_generation(long db_generation) {
same answer as previous comment regarding that issue.
Line 233:         this.db_generation = db_generation;
Line 234:     }
Line 235: 
Line 236:     public List<VmNetworkInterface> getInterfaces() {


....................................................
File 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
Line 938:     public void setnice_level(int value) {
Line 939:         this.mVmStatic.setnice_level(value);
Line 940:     }
Line 941: 
Line 942:     public void setDb_Generation(long value) {
currently all of this class is using certain convention..i don't think that we 
should mix conventions, it should be replaced for all of this class at once.
Line 943:         this.mVmStatic.setDb_generation(value);
Line 944:     }
Line 945: 
Line 946:     public void getDb_Generation(long value) {


....................................................
File 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
Line 63:     VdsFenceOptionTypes,
Line 64:     ServerCPUList,
Line 65:     SupportedClusterLevels(ConfigAuthType.User),
Line 66:     OvfUpdateIntervalInMinutes,
Line 67:     OvfItemsCountPerUpdate,
can you elaboratee? it's ConfigAuthType isn't set to ConfigAuthType.User
Line 68:     ProductRPMVersion(ConfigAuthType.User),
Line 69:     RhevhLocalFSPath,
Line 70:     CustomPublicConfig_AppsWebSite(ConfigAuthType.User),
Line 71:     DocsURL(ConfigAuthType.User),


....................................................
File 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmAndTemplatesGenerationsDbFacadeImpl.java
Line 7: import org.apache.commons.lang.StringUtils;
Line 8: import org.ovirt.engine.core.compat.Guid;
Line 9: import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
Line 10: 
Line 11: public class VmAndTemplatesGenerationsDbFacadeImpl extends 
BaseDAODbFacade implements VmAndTemplatesGenerationsDAO {
Thanks, though as this is not 'regular' dao (no specific entity to save, no 
specific entity to load..etc) it won't give us use here.
Line 12:     @Override
Line 13:     public void updateOvfGenerations(List<Guid> ids, List<Long> 
values) {
Line 14:         getCallsHandler().executeModification("UpdateOvfGenerations", 
getCustomMapSqlParameterSource()
Line 15:                 .addValue("vms_ids", StringUtils.join(ids, ','))


Line 18: 
Line 19:     @Override
Line 20:     public Long getOvfGeneration(Guid id) {
Line 21:         return getCallsHandler().executeRead("GetOvfGeneration",
Line 22:                 new ParameterizedRowMapper<Long>() {
Done,
as i commented in a previous patchset - this should be changed, we should keep 
one static instance of each mapper and return it from BaseDAODbFacade. all of 
the 'createMapper()' methods should be changed to return those static instances 
in a further patch, for uniformity i've added this method now and they all 
should change together.
Line 23:                     @Override
Line 24:                     public Long mapRow(ResultSet rs, int rowNum) 
throws SQLException {
Line 25:                         return rs.getLong(1);
Line 26:                     };


....................................................
File 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDAO.java
Line 165:      * @param quotaId
Line 166:      * @param vmCount
Line 167:      * @return
Line 168:      */
Line 169:     public List<VM> getVmsByIds(List<Guid> vmsIds);
Done
Line 170: 
Line 171:     /**
Line 172:      * Retrieves the list of all VMS with optional permission 
filtering.
Line 173:      *


....................................................
File 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmStaticDAODbFacadeImpl.java
Line 159: 
Line 160:     @Override
Line 161:     public Long getDbGeneration(Guid id) {
Line 162:         return getCallsHandler().executeRead("GetDbGeneration",
Line 163:                 new ParameterizedRowMapper<Long>() {
Done, same answer as before.
Line 164:                     @Override
Line 165:                     public Long mapRow(ResultSet rs, int rowNum) 
throws SQLException {
Line 166:                         return rs.getLong(1);
Line 167:                     };


....................................................
File 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmTemplateDAODbFacadeImpl.java
Line 91:         return 
getCallsHandler().executeReadList("GetAllVmTemplatesRelatedToQuotaId",
Line 92:                 VMTemplateRowMapper.instance,
Line 93:                 getCustomMapSqlParameterSource()
Line 94:                         .addValue("quota_id", quotaId));
Line 95: 
Done
Line 96:     }
Line 97: 
Line 98:     @Override
Line 99:     public Map<Boolean, VmTemplate> getAllForImage(Guid imageId) {


Line 191:                 getCustomMapSqlParameterSource()
Line 192:                         .addValue("network_id", id));
Line 193:     }
Line 194: 
Line 195: 
Done
Line 196:     private final static class VMTemplateRowMapper extends 
AbstractVmRowMapper<VmTemplate> {
Line 197:         public static final VMTemplateRowMapper instance = new 
VMTemplateRowMapper();
Line 198: 
Line 199:         @Override


....................................................
File 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmTemplateDAO.java
Line 83:      * @param quotaId
Line 84:      * @param teamplatesCount
Line 85:      * @return
Line 86:      */
Line 87:     public List<VmTemplate> getVmTemplatesByIds(List<Guid> 
templatesIds);
Done
Line 88: 
Line 89:     /**
Line 90:      * Retrieves templates with permissions to perform the given 
action.
Line 91:      *


....................................................
File 
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfWriter.java
Line 235:         }
Line 236: 
Line 237:         _writer.WriteStartElement("Generation");
Line 238:         _writer.WriteRaw(String.valueOf(vmBase.getDb_generation()));
Line 239:         _writer.WriteEndElement();
will be added in the import patch that makes use of it.
Line 240: 
Line 241:         _writer.WriteStartElement("VmType");
Line 242:         
_writer.WriteRaw(String.valueOf(vmBase.getvm_type().getValue()));
Line 243:         _writer.WriteEndElement();


....................................................
Commit Message
Line 4: Commit:     Liron Aravot <lara...@redhat.com>
Line 5: CommitDate: 2012-12-02 13:27:57 +0200
Line 6: 
Line 7: core: introducing OvfAutoUpdate
Line 8: 
Done
Line 9: vm/template configurations (including disks info) are stored on the
Line 10: master storage
Line 11: domain for backup purposes, import/export and also to provide the
Line 12: abillity to run VMs without having a running engine/db. Currently ovf


Line 6: 
Line 7: core: introducing OvfAutoUpdate
Line 8: 
Line 9: vm/template configurations (including disks info) are stored on the
Line 10: master storage
Done
Line 11: domain for backup purposes, import/export and also to provide the
Line 12: abillity to run VMs without having a running engine/db. Currently ovf
Line 13: update is done synchronously when performing various operations on
Line 14: vms/templates - update, save, adding/removing a disk, etc. What's more,


Line 7: core: introducing OvfAutoUpdate
Line 8: 
Line 9: vm/template configurations (including disks info) are stored on the
Line 10: master storage
Line 11: domain for backup purposes, import/export and also to provide the
Done
Line 12: abillity to run VMs without having a running engine/db. Currently ovf
Line 13: update is done synchronously when performing various operations on
Line 14: vms/templates - update, save, adding/removing a disk, etc. What's more,
Line 15: currently updating the ovf (updateVM vdsm call) is usually done within 
a


Line 15: currently updating the ovf (updateVM vdsm call) is usually done within 
a
Line 16: transcation.
Line 17: 
Line 18: The idea behined OvfAutoUpdater is to perform a batch ovf update
Line 19: operations that aggregate all hanging updates per data center. These
Done
Line 20: updates will be done in specifed time intervals which will reduce
Line 21: XML-RPC calls and will enable the removal of this syncronous vdsm call
Line 22: from all over the code.
Line 23: 


--
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: 14
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Liron Aravot <lara...@redhat.com>
Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com>
Gerrit-Reviewer: Arik Hadas <aha...@redhat.com>
Gerrit-Reviewer: Ayal Baron <aba...@redhat.com>
Gerrit-Reviewer: Liron Aravot <lara...@redhat.com>
Gerrit-Reviewer: Maor Lipchuk <mlipc...@redhat.com>
Gerrit-Reviewer: Michael Kublin <mkub...@redhat.com>
Gerrit-Reviewer: Tal Nisan <tni...@redhat.com>
Gerrit-Reviewer: Vered Volansky <vvola...@redhat.com>
Gerrit-Reviewer: Yair Zaslavsky <yzasl...@redhat.com>
Gerrit-Reviewer: liron aravot <liron.ara...@gmail.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to