[KVM] Fix for Revert volume snapshot#6527
Conversation
|
Found UI changes, kicking a new UI QA build |
c8b6fd2 to
ae7693f
Compare
|
@acs-robot a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress. |
|
@blueorangutan package |
|
Found UI changes, kicking a new UI QA build |
|
@acs-robot a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress. |
|
@blueorangutan package |
|
@harikrishna-patnala a Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result: ✔️ el7 ✔️ el8 ✔️ debian ✔️ suse15. SL-JID 3706 |
|
@blueorangutan test |
|
@harikrishna-patnala a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
UI build: ✔️ |
|
Found UI changes, kicking a new UI QA build |
|
@acs-robot a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress. |
|
UI build: ✔️ |
|
@blueorangutan package |
|
@harikrishna-patnala a Jenkins job has been kicked to build packages. It will be bundled with SystemVM template(s). I'll keep you posted as I make progress. |
|
SonarCloud Quality Gate failed. |
|
Packaging result: ✔️ el7 ✔️ el8 ✔️ debian ✔️ suse15. SL-JID 3710 |
|
@blueorangutan test |
|
@harikrishna-patnala a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
Trillian test result (tid-4427)
|
|
Trillian test result (tid-4429)
|
| throw new CloudRuntimeException("Cannot find an entry for snapshot " + snapshot.getId() + " on primary storage pools"); | ||
| s_logger.warn("Cannot find an entry for snapshot " + snapshot.getId() + " on primary storage pools, searching with volume's primary storage pool"); | ||
| VolumeInfo volumeInfo = volFactory.getVolume(snapshot.getVolumeId(), DataStoreRole.Primary); | ||
| store = (PrimaryDataStore)volumeInfo.getDataStore(); |
There was a problem hiding this comment.
@harikrishna-patnala should we check for subsequent cases where it's not found again or this is null?
There was a problem hiding this comment.
We are not looking for snapshotOnPrimaryStore again. We are just trying to get the appropriate datastore driver to run the command. We are using volume's info here if snapshot on primary os not found. So need to check again.
| if (Files.exists(Paths.get(snapshotPath))) { | ||
| return new Pair<>(snapshotPath, snapshotOnPrimaryStorage); | ||
| KVMStoragePool kvmStoragePoolPrimary, KVMStoragePool kvmStoragePoolSecondary) { | ||
| String snapshotPath = null; |
There was a problem hiding this comment.
If snapshotOnPrimaryStorage is null, then this is never set?
There was a problem hiding this comment.
No need to set or use it. If the snapshot on primary is not there then we will get it from secondary storage.
| public void revertSnapshot(SnapshotInfo snapshot, SnapshotInfo snapshotOnPrimaryStore, AsyncCompletionCallback<CommandResult> callback) { | ||
| RevertSnapshotCommand cmd = new RevertSnapshotCommand((SnapshotObjectTO)snapshot.getTO(), (SnapshotObjectTO)snapshotOnPrimaryStore.getTO()); | ||
| SnapshotObjectTO dataOnPrimaryStorage = null; | ||
| if (snapshotOnPrimaryStore != null) { |
There was a problem hiding this comment.
same as above if snapshotOnPrimaryStore is null then dataOnPrimaryStorage is never set? (or is it that this will never be null?)
There was a problem hiding this comment.
It can be null. We are handling the same case where snapshotOnPrimary is null.
Following is the complete flow
- Look for snapshotOnPrimary entry if exists
- If exists, use that entry to find the appropriate driver to execute revertSnapshotCommand
- If not found, use volume information to find the appropriate driver to execute revertSnapshotCommand
- While executing the revertSnapshotCommand, if snapshotOnPrimary exists, use it to revert the volume
- If snapshotOnPrimary does not exists, use the snapshot from secondary storage to revert the volume
yadvr
left a comment
There was a problem hiding this comment.
LGTM but left some comments. @harikrishna-patnala can you advise how this was tested, is there an existing smoketest or was it manually tested?
For revert volume to snapshot I did not see any smoke tests, I've tested it manually and added the steps that I've tested in the description.
To write tests to address the revert operation and the issue here, we have to write the exact same flow as above. |
|
@nvazquez @Pearl1594 will you be able to help me test this PR please. |
Pearl1594
left a comment
There was a problem hiding this comment.
Tested fix. LGTM - Was able to revert to snapshot taken before migration of volume.








Description
This PR fixes the issue #6209 where the snapshot revert operation fails after certain volume operations like Migrate VM with volume / migrate volume / reinstall VM.
The root cause of the issue after these volume operations, the primary storage entry is getting deleted for that volume. We have fixed it here to get the primary datastore entry wrt volume and continue the operation.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?