Daniel Erez has posted comments on this change.

Change subject: core: extract PrepareSnapshotConfig method to ImagesHandler
......................................................................


Patch Set 5:

(3 comments)

http://gerrit.ovirt.org/#/c/27610/5/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java:

Line 775: 
Line 776:     public static Snapshot 
prepareSnapshotConfigWithoutImageSingleImage(Guid vmSnapshotId, Guid imageId) {
Line 777:         Snapshot snapshot = 
DbFacade.getInstance().getSnapshotDao().get(vmSnapshotId);
Line 778:         if (snapshot == null) {
Line 779:             log.errorFormat("Can't remove image {0} from snapshot 
{1}", imageId, vmSnapshotId);
> 1) Could be good if you can indicate that the snapshotId {1} is not exists 
removed the method - can handle without it.. :)
Line 780:         }
Line 781:         return prepareSnapshotConfigWithoutImageSingleImage(snapshot, 
imageId);
Line 782:     }
Line 783: 


Line 786:      */
Line 787:     public static Snapshot 
prepareSnapshotConfigWithoutImageSingleImage(Snapshot snapshot, Guid imageId) {
Line 788:         try {
Line 789:             OvfManager ovfManager = new OvfManager();
Line 790:             String snapConfig = snapshot.getVmConfiguration();
> you will get an NPE if you got null snapshot at line 778
shouldn't be null - see previous comment
Line 791: 
Line 792:             if (snapshot.isVmConfigurationAvailable() && snapConfig 
!= null) {
Line 793:                 VM vmSnapshot = new VM();
Line 794:                 ArrayList<DiskImage> snapshotImages = new 
ArrayList<DiskImage>();


Line 797:                         vmSnapshot,
Line 798:                         snapshotImages,
Line 799:                         new ArrayList<VmNetworkInterface>());
Line 800: 
Line 801:                 // Remove the image form the disk list
> /s/form/from
Done
Line 802:                 Iterator<DiskImage> diskIter = 
snapshotImages.iterator();
Line 803:                 while (diskIter.hasNext()) {
Line 804:                     DiskImage imageInList = diskIter.next();
Line 805:                     if (imageInList.getImageId().equals(imageId)) {


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8c5e8d2763df3bcf18fb13a030148de352f57846
Gerrit-PatchSet: 5
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Daniel Erez <[email protected]>
Gerrit-Reviewer: Allon Mureinik <[email protected]>
Gerrit-Reviewer: Daniel Erez <[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