-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix issue when restoring backup after migration of volume #12549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 4.20
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -215,7 +215,7 @@ private BackupVO createBackupObject(VirtualMachine vm, String backupPath) { | |
| public boolean restoreVMFromBackup(VirtualMachine vm, Backup backup) { | ||
| List<Backup.VolumeInfo> backedVolumes = backup.getBackedUpVolumes(); | ||
| List<VolumeVO> volumes = backedVolumes.stream() | ||
| .map(volume -> volumeDao.findByUuid(volume.getUuid())) | ||
| .map(volume -> volumeDao.findByUuid(volume.getPath())) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. volumeDao.findByUuid() should take volume.getUuid() as an argument not path. Volume paths are actually set in restoreCommand.setVolumePaths(getVolumePaths(volumes)); The bug is obvious in Restore single volume code restoreCommand.setVolumePaths(Collections.singletonList(String.format("%s/%s", dataStore.getLocalPath(), volumeUUID)));
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. my bad - I did the test / changes and 4.22 but made the wrong change on 4.20 - I meant to change this: to getPath from getUUID() - https://github.com/apache/cloudstack/blob/4.22/plugins/backup/nas/src/main/java/org/apache/cloudstack/backup/NASBackupProvider.java#L295 |
||
| .sorted((v1, v2) -> Long.compare(v1.getDeviceId(), v2.getDeviceId())) | ||
| .collect(Collectors.toList()); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the new uuid or path after migration needs to be updated in the backed-up volumes metadata if any backups existing for them? any case path might also change?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new UUID / path for the backed up volume doesn't need to be updated as the uuid - points to the volume UUID - which is always the same on subsequent backups, and the path points to the backup path - which shouldn't vary even if volume is migrated. I don't see the path of the backup changing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's better change to backedVolumeInfo to avoid confusion.
@Pearl1594 Correct, path of the backup doesn't change. I mean, the volume path after migration might change as the volume is checked by its backed up path (which is before migration). cc @abh1sar