Maor Lipchuk has posted comments on this change.

Change subject: core: Add snapshot to the OVF generation
......................................................................


Patch Set 4:

(5 comments)

http://gerrit.ovirt.org/#/c/25947/4/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OvfDataUpdater.java
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/OvfDataUpdater.java:

Line 370:         List<VM> vms = getVmDao().getVmsByIds(idsToProcess);
Line 371:         for (VM vm : vms) {
Line 372:             if (VMStatus.ImageLocked != vm.getStatus()) {
Line 373:                 updateVmDisksFromDb(vm);
Line 374:                 ArrayList<DiskImage> vmDisks = 
updateSnapshotsForVM(vm);
> 1. the name isn't good enough, it's vmImages.
done
Line 375:                 if (verifyDisksNotLocked(vm.getDiskList()) && 
verifySnapshotsStatus(vm.getSnapshots())) {
Line 376:                     loadVmData(vm);
Line 377:                     Long currentDbGeneration = 
getVmStaticDao().getDbGeneration(vm.getId());
Line 378:                     // currentDbGeneration can be null in case that 
the vm was deleted during the run of OvfDataUpdater.


Line 387:         }
Line 388:         return vmsAndTemplateMetadata;
Line 389:     }
Line 390: 
Line 391:     private ArrayList<DiskImage> updateSnapshotsForVM(VM vm) {
> please separate the image loading/snapshot loading into different functions
done
Line 392:         
vm.setSnapshots(getSnapshotDao().getAllWithConfiguration(vm.getId()));
Line 393:         ArrayList<DiskImage> vmDisks = new ArrayList<>();
Line 394:         List<DiskImage> filteredDisks = 
ImagesHandler.filterImageDisks(vm.getDiskList(), false, true, true);
Line 395: 


Line 394:         List<DiskImage> filteredDisks = 
ImagesHandler.filterImageDisks(vm.getDiskList(), false, true, true);
Line 395: 
Line 396:         for (DiskImage diskImage : filteredDisks) {
Line 397:             vmDisks.addAll(getAllImageSnapshots(diskImage));
Line 398:         }
> please export this logic in lines 392-298 to a method and reuse it in lines
done
Line 399:         return vmDisks;
Line 400:     }
Line 401: 
Line 402:     protected void proccessDisksDomains(List<DiskImage> disks) {


Line 419: 
Line 420:     /**
Line 421:      * Returns true if all snapshots have a valid status to use in 
the OVF.
Line 422:      */
Line 423:     protected boolean verifySnapshotsStatus(List<Snapshot> snapshots) 
{
> IMO you should export this check to a new validation in SnapshotValidator -
It is a unique specific case, I don't see the need to export it today
Line 424:         for (Snapshot snapshot : snapshots) {
Line 425:             if (snapshot.getStatus() != SnapshotStatus.OK && 
snapshot.getStatus() != SnapshotStatus.BROKEN) {
Line 426:                 return false;
Line 427:             }


Line 489:     /**
Line 490:      * Adds the given vm metadata to the given map
Line 491:      */
Line 492:     protected String buildMetadataDictionaryForVm(VM vm,
Line 493:             Map<Guid, KeyValuePairCompat<String, List<Guid>>> 
metaDictionary) {
> if this logic is relevant only for export vm, please move this logic there 
done
Line 494:         ArrayList<DiskImage> AllVmImages = new ArrayList<DiskImage>();
Line 495:         List<DiskImage> filteredDisks = 
ImagesHandler.filterImageDisks(vm.getDiskList(), false, true, true);
Line 496: 
Line 497:         for (DiskImage diskImage : filteredDisks) {


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8ba05c2e362fb9b22d6b4fb5a14698ad99d7bd1e
Gerrit-PatchSet: 4
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Maor Lipchuk <[email protected]>
Gerrit-Reviewer: Allon Mureinik <[email protected]>
Gerrit-Reviewer: Liron Ar <[email protected]>
Gerrit-Reviewer: Maor Lipchuk <[email protected]>
Gerrit-Reviewer: [email protected]
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to