Maor Lipchuk has posted comments on this change. Change subject: restapi: Allow override of allocation policy of imported disks ......................................................................
Patch Set 2: (3 comments) http://gerrit.ovirt.org/#/c/36131/2/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainVmResource.java File backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainVmResource.java: Line 80: params.setCopyCollapse(action.getVm().getSnapshots().isCollapseSnapshots()); Line 81: } Line 82: Line 83: // The caller may override the format and allocation policy for each disk of the virtual machine: Line 84: if (action.isSetVm()) { > i suggest to export this whole part to a separate method to ease the read o BTW, we already call action-isSetVm() in line 78, maybe it is better to use this new block of code integrated with the condition in line 78 Line 85: VM modelVm = action.getVm(); Line 86: if (modelVm.isSetDisks()) { Line 87: Map<Guid, org.ovirt.engine.core.common.businessentities.Disk> entityDisks = getDiskMap(); Line 88: for (Disk modelDisk : modelVm.getDisks().getDisks()) { Line 84: if (action.isSetVm()) { Line 85: VM modelVm = action.getVm(); Line 86: if (modelVm.isSetDisks()) { Line 87: Map<Guid, org.ovirt.engine.core.common.businessentities.Disk> entityDisks = getDiskMap(); Line 88: for (Disk modelDisk : modelVm.getDisks().getDisks()) { > but it's getDisks().getDisks(), not getDisks(). yes, but the second time we call getDisks (getDisks().getDisks()) already initialize them This is the code: if (disks == null) { disks = new ArrayList<Disk>(); } return this.disks; Line 89: if (modelDisk.isSetId()) { Line 90: Guid modelDiskId = Guid.createGuidFromString(modelDisk.getId()); Line 91: DiskImage entityDisk = (DiskImage) entityDisks.get(modelDiskId); Line 92: if (entityDisk != null) { Line 85: VM modelVm = action.getVm(); Line 86: if (modelVm.isSetDisks()) { Line 87: Map<Guid, org.ovirt.engine.core.common.businessentities.Disk> entityDisks = getDiskMap(); Line 88: for (Disk modelDisk : modelVm.getDisks().getDisks()) { Line 89: if (modelDisk.isSetId()) { > that info isn't related to the engine, it's part of incomplete request..how I see what you mean, it can be done also as yo suggested, but a CDA message should also validate this in the engine and IINM it should not be silently ignored. Line 90: Guid modelDiskId = Guid.createGuidFromString(modelDisk.getId()); Line 91: DiskImage entityDisk = (DiskImage) entityDisks.get(modelDiskId); Line 92: if (entityDisk != null) { Line 93: if (modelDisk.isSetFormat()) { -- To view, visit http://gerrit.ovirt.org/36131 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Idc9945968b7cd2b8a82d953f659967d72064d583 Gerrit-PatchSet: 2 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Juan Hernandez <juan.hernan...@redhat.com> Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com> Gerrit-Reviewer: Daniel Erez <de...@redhat.com> Gerrit-Reviewer: Liron Aravot <lara...@redhat.com> Gerrit-Reviewer: Maor Lipchuk <mlipc...@redhat.com> Gerrit-Reviewer: Tal Nisan <tni...@redhat.com> Gerrit-Reviewer: automat...@ovirt.org Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches