Repository navigation
server: mark volume snapshots as Destroyed if it does not exist on primary and secondary storage when delete a volume #6057
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
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 |
|---|---|---|
|
|
@@ -122,6 +122,7 @@ | |
| import com.cloud.storage.dao.VMTemplatePoolDao; | ||
| import com.cloud.storage.dao.VolumeDao; | ||
| import com.cloud.storage.dao.VolumeDetailsDao; | ||
| import com.cloud.storage.snapshot.SnapshotApiService; | ||
| import com.cloud.storage.snapshot.SnapshotManager; | ||
| import com.cloud.storage.template.TemplateProp; | ||
| import com.cloud.user.AccountManager; | ||
|
|
@@ -194,6 +195,8 @@ public class VolumeServiceImpl implements VolumeService { | |
| private StorageManager _storageMgr; | ||
| @Inject | ||
| private AnnotationDao annotationDao; | ||
| @Inject | ||
| private SnapshotApiService snapshotApiService; | ||
|
|
||
| private final static String SNAPSHOT_ID = "SNAPSHOT_ID"; | ||
|
|
||
|
|
@@ -448,9 +451,9 @@ public Void deleteVolumeCallback(AsyncCallbackDispatcher<VolumeServiceImpl, Comm | |
| volDao.remove(vo.getId()); | ||
| } | ||
|
|
||
| SnapshotDataStoreVO snapStoreVo = _snapshotStoreDao.findByVolume(vo.getId(), DataStoreRole.Primary); | ||
| List<SnapshotDataStoreVO> snapStoreVOs = _snapshotStoreDao.listAllByVolumeAndDataStore(vo.getId(), DataStoreRole.Primary); | ||
|
|
||
| if (snapStoreVo != null) { | ||
| for (SnapshotDataStoreVO snapStoreVo : snapStoreVOs) { | ||
| long storagePoolId = snapStoreVo.getDataStoreId(); | ||
| StoragePoolVO storagePoolVO = storagePoolDao.findById(storagePoolId); | ||
|
|
||
|
|
@@ -468,6 +471,7 @@ public Void deleteVolumeCallback(AsyncCallbackDispatcher<VolumeServiceImpl, Comm | |
| _snapshotStoreDao.remove(snapStoreVo.getId()); | ||
|
Contributor
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. Hi @weizhouapache, isn't it better to keep the info in the DB for the snapshots and update the State as
Member
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. @slavkap
Member
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. @slavkap
Contributor
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. @weizhouapache, to keep it as history, nothing more
Member
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. |
||
| } | ||
| } | ||
| snapshotApiService.markVolumeSnapshotsAsDestroyed(vo); | ||
| } else { | ||
| vo.processEvent(Event.OperationFailed); | ||
| apiResult.setResult(result.getResult()); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.