Skip to content

Commit

Permalink
core: skip snapshot creation for Export VM to SD
Browse files Browse the repository at this point in the history
When Export VM with "Collapse snapshots" unchecked is triggered,
a snapshot is created on source VM in order to allow for the clone VM
operation to be performed on a snapshot rather than on an active
volume - this allows the source VM to keep running during the clone
operation. Then, all the snapshots are copied to the destination VM,
and then the snapshot created for the operation on source VM is
removed.

The bug was opened for the copy of this snapshot that was
not removed from the destination VM. Since this happens only for
Export VM to Storage Domain No Collapse Snapshots action,
and running VM during this procedure is not allowed anyway - there
is no need to create this snapshot in the first place.

Change-Id: Idf59fe34977fd1e3c96ea807d97007864664286c
Bug-Url: https://bugzilla.redhat.com/1959141
Signed-off-by: Mark Kemel <mkemel@redhat.com>
  • Loading branch information
mkemel committed Aug 25, 2021
1 parent a309569 commit 67579a9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ private void cloneVm() {
protected void createDestSnapshots() {
}

private void removeVmSnapshot() {
protected void removeVmSnapshot() {
unlockEntities();

ActionReturnValue returnValue = runInternalAction(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ protected boolean validate() {
return super.validate();
}

@Override
protected void executeVmCommand() {
getParameters().setStage(CloneVmParameters.CloneVmStage.CREATE_VM_SNAPSHOT);
setSucceeded(true);
}

@Override
protected void addVmImages() {
getParameters()
Expand Down Expand Up @@ -236,6 +242,12 @@ private List<DiskImage> prepareImageChainMap(DiskImage diskImage, Guid destImage
return newChain;
}

@Override
protected void removeVmSnapshot() {
log.info("Skipping Auto-Generated snapshot removal, since it was not generated for " +
"exporting VM '{}' without collapsing snapshots", getSourceVmId());
}

@Override
protected void unlockEntities() {
TransactionSupport.executeInNewTransaction(() -> {
Expand Down

0 comments on commit 67579a9

Please sign in to comment.