Maor Lipchuk has posted comments on this change.

Change subject: engine(wip): Add action type for previewed snapshot.
......................................................................


Patch Set 8:

(9 comments)

....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RestoreAllSnapshotsCommand.java
Line 87:                 freeLock();
Line 88:             }
Line 89:         }
Line 90: 
Line 91:         // The snapshot being restored to
Not necessarily, if the snapshot is stateless it will not be loaded
Line 92:         Snapshot targetSnapshot = 
getSnapshotDao().get(getSnapshotId());
Line 93: 
Line 94:         if (targetSnapshot == null) {
Line 95:             throw new VdcBLLException(VdcBllErrors.ENGINE, "Can't find 
target snapshot by id: "


Line 128: 
Line 129:     private Guid getSnapshotId() {
Line 130:         if (snapshotId == null) {
Line 131:             Snapshot snapshot = null;
Line 132:             Guid snapshotId = getParameters().getDstSnapshotId();
Need to change to Guid snapshotId to snapshotId
Line 133:             if (getParameters().getSnapshotPreviewAction() == 
SnapshotPreviewAction.UNDO) {
Line 134:                 snapshot = getSnapshotDao().get(getVmId(), 
SnapshotType.PREVIEW);
Line 135:             } else if (getParameters().getSnapshotPreviewAction() == 
SnapshotPreviewAction.COMMIT) {
Line 136:                 snapshot = getSnapshotDao().get(getVmId(), 
SnapshotType.ACTIVE);


Line 129:     private Guid getSnapshotId() {
Line 130:         if (snapshotId == null) {
Line 131:             Snapshot snapshot = null;
Line 132:             Guid snapshotId = getParameters().getDstSnapshotId();
Line 133:             if (getParameters().getSnapshotPreviewAction() == 
SnapshotPreviewAction.UNDO) {
I don't think it is necessary for two values
Line 134:                 snapshot = getSnapshotDao().get(getVmId(), 
SnapshotType.PREVIEW);
Line 135:             } else if (getParameters().getSnapshotPreviewAction() == 
SnapshotPreviewAction.COMMIT) {
Line 136:                 snapshot = getSnapshotDao().get(getVmId(), 
SnapshotType.ACTIVE);
Line 137:             }


Line 132:             Guid snapshotId = getParameters().getDstSnapshotId();
Line 133:             if (getParameters().getSnapshotPreviewAction() == 
SnapshotPreviewAction.UNDO) {
Line 134:                 snapshot = getSnapshotDao().get(getVmId(), 
SnapshotType.PREVIEW);
Line 135:             } else if (getParameters().getSnapshotPreviewAction() == 
SnapshotPreviewAction.COMMIT) {
Line 136:                 snapshot = getSnapshotDao().get(getVmId(), 
SnapshotType.ACTIVE);
It will work, the stateless process will stay the same, it will get the 
snapshot id from the parameters
Line 137:             }
Line 138: 
Line 139:             if (snapshot != null) {
Line 140:                 snapshotId = snapshot.getId();


Line 136:                 snapshot = getSnapshotDao().get(getVmId(), 
SnapshotType.ACTIVE);
Line 137:             }
Line 138: 
Line 139:             if (snapshot != null) {
Line 140:                 snapshotId = snapshot.getId();
it will simply get the snapshot id from the parameters. After I will change 
line 132 (See comment)
Line 141:             }
Line 142:         }
Line 143:         return snapshotId;
Line 144:     }


Line 328:     protected VdcActionType getChildActionType() {
Line 329:         return VdcActionType.RestoreFromSnapshot;
Line 330:     }
Line 331: 
Line 332:     private List<DiskImage> getImagesList() {
Not relevant after line 132 will be fixed
Line 333:         if (getParameters().getImagesList() == null && 
!getSnapshotId().equals(Guid.Empty)) {
Line 334:             getParameters().setImagesList(
Line 335:                     
getDiskImageDao().getAllSnapshotsForVmSnapshot(getSnapshotId()));
Line 336:         }


Line 368: 
Line 369:         if (!canRunActionOnNonManagedVm()) {
Line 370:             return false;
Line 371:         }
Line 372: 
How it was Guid empty before? How was it changed from before?
Line 373:         if (Guid.Empty.equals(getSnapshotId())) {
Line 374:             return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CORRUPTED_VM_SNAPSHOT_ID);
Line 375:         }
Line 376: 


....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RestoreStatelessVmCommand.java
Line 42:         if (imagesList != null && imagesList.size() > 0) {
Line 43:             /**
Line 44:              * restore all snapshots
Line 45:              */
Line 46:             RestoreAllSnapshotsParameters tempVar = new 
RestoreAllSnapshotsParameters(getVm().getId(), snapshotId, 
SnapshotPreviewAction.COMMIT);
yep, will change
Line 47:             tempVar.setShouldBeLogged(false);
Line 48:             tempVar.setImagesList(imagesList);
Line 49:             VdcReturnValueBase vdcReturn =
Line 50:                     
Backend.getInstance().runInternalAction(VdcActionType.RestoreAllSnapshots,


....................................................
File 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/Snapshot.java
Line 259:         STATELESS,
Line 260:         PREVIEW
Line 261:     }
Line 262: 
Line 263:     public enum SnapshotPreviewAction {
1. will do

2. why not?

3. the patch is wip, I will change all the related issues after we will decide 
on a way to solve the issue
Line 264:         UNDO,
Line 265:         COMMIT,
Line 266:         NONE
Line 267:     }


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

Gerrit-MessageType: comment
Gerrit-Change-Id: If877befc5058c3412ae3d3731d5beacbc09e5c97
Gerrit-PatchSet: 8
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Maor Lipchuk <[email protected]>
Gerrit-Reviewer: Allon Mureinik <[email protected]>
Gerrit-Reviewer: Daniel Erez <[email protected]>
Gerrit-Reviewer: Liron Ar <[email protected]>
Gerrit-Reviewer: Maor Lipchuk <[email protected]>
Gerrit-Reviewer: Michael Pasternak <[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

Reply via email to