Liron Ar has posted comments on this change.
Change subject: core, restapi: Introducing support for attaching disk snapshot
......................................................................
Patch Set 28:
(3 comments)
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmDiskCommand.java
Line 60: private List<VM> vmsDiskOrSnapshotPluggedTo;
Line 61: /* vms that a disk or it's sansphot is attached to. */
Line 62: private List<VM> vmsDiskOrSnapshotAttachedTo;
Line 63: /* vm device for the given vm and disk. */
Line 64: private VmDevice vmDeviceForVm;
I prefer to keep it unless it really bothers you.
Line 65: private Disk oldDisk;
Line 66:
Line 67: public UpdateVmDiskCommand(T parameters) {
Line 68: super(parameters);
Line 549: return vmsDiskSnapshotPluggedTo;
Line 550: }
Line 551:
Line 552: private void loadVmDiskAttachedToInfo() {
Line 553: if (getOldDisk() != null) {
it always can be null, not checking it can cause to NPE (for example: deleted
before we get to execute the command, REST request sent 10 hours after the GET
was issued..etc). therefore there's is also CDA check for that.
Line 554: vmsDiskSnapshotPluggedTo = new LinkedList<>();
Line 555: vmsDiskPluggedTo = new LinkedList<>();
Line 556: vmsDiskOrSnapshotPluggedTo = new LinkedList<>();
Line 557: vmsDiskOrSnapshotAttachedTo = new LinkedList<>();
Line 555: vmsDiskPluggedTo = new LinkedList<>();
Line 556: vmsDiskOrSnapshotPluggedTo = new LinkedList<>();
Line 557: vmsDiskOrSnapshotAttachedTo = new LinkedList<>();
Line 558:
Line 559: List<Pair<VM, VmDevice>> attachedVmsInfo =
getVmDAO().getVmsWithPlugInfo(getOldDisk().getId());
that was mentioned in the previous patchset, quoting the reply:
"this method populates 4 lists, what do you suggest for getter to return? the
only option i see is a map and then an enum to get the needed list by the
caller would be required..the solution i prefer is an init method for commands
that'll run after ctor. i'll push a follow up patch to add that method, as we
have dao calls in the ctor of many commands - i think that for this patch it's
good enough, let me know what's your take on that."
Line 560: for (Pair<VM, VmDevice> pair : attachedVmsInfo) {
Line 561: VM vm = pair.getFirst();
Line 562: vmsDiskOrSnapshotAttachedTo.add(vm);
Line 563: if (pair.getSecond().getIsPlugged() == Boolean.TRUE) {
--
To view, visit http://gerrit.ovirt.org/17679
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I02579bf1a91cd294a5040acf432f1fdb87eb18c1
Gerrit-PatchSet: 28
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Liron Ar <[email protected]>
Gerrit-Reviewer: Alissa Bonas <[email protected]>
Gerrit-Reviewer: Allon Mureinik <[email protected]>
Gerrit-Reviewer: Ayal Baron <[email protected]>
Gerrit-Reviewer: Daniel Erez <[email protected]>
Gerrit-Reviewer: Federico Simoncelli <[email protected]>
Gerrit-Reviewer: Liron Ar <[email protected]>
Gerrit-Reviewer: Maor Lipchuk <[email protected]>
Gerrit-Reviewer: Sergey Gotliv <[email protected]>
Gerrit-Reviewer: Tal Nisan <[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