You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2021/08/25 12:31:39 UTC
[GitHub] [cloudstack] weizhouapache opened a new pull request #5373: server: do not remove volume from DB if fail to expunge it from primary storage or secondary storage
weizhouapache opened a new pull request #5373:
URL: https://github.com/apache/cloudstack/pull/5373
### Description
This PR fixes the issue that volume is removed from cloudstack DB but not removed from primary storage or secondary storage.
steps to reproduce the issue on kvm
(1) create a volume, attach to a vm, detach it
(2) stop all cloudstack-agent
(3) remove the volume.
<!--- Describe your changes in DETAIL - And how has behaviour functionally changed. -->
<!-- For new features, provide link to FS, dev ML discussion etc. -->
<!-- In case of bug fix, the expected and actual behaviours, steps to reproduce. -->
<!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be closed when this PR gets merged -->
<!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" -->
<!-- Fixes: # -->
<!--- ********************************************************************************* -->
<!--- NOTE: AUTOMATATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE DOCUMENTATION. -->
<!--- PLEASE PUT AN 'X' in only **ONE** box -->
<!--- ********************************************************************************* -->
### Types of changes
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] Enhancement (improves an existing feature and functionality)
- [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
### Feature/Enhancement Scale or Bug Severity
#### Feature/Enhancement Scale
- [ ] Major
- [ ] Minor
#### Bug Severity
- [ ] BLOCKER
- [ ] Critical
- [x] Major
- [ ] Minor
- [ ] Trivial
### Screenshots (if appropriate):
### How Has This Been Tested?
<!-- Please describe in detail how you tested your changes. -->
<!-- Include details of your testing environment, and the tests you ran to -->
<!-- see how your change affects other areas of the code, etc. -->
<!-- Please read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md) document -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] weizhouapache commented on a change in pull request #5373: server: do not remove volume from DB if fail to expunge it from primary storage or secondary storage
Posted by GitBox <gi...@apache.org>.
weizhouapache commented on a change in pull request #5373:
URL: https://github.com/apache/cloudstack/pull/5373#discussion_r697317698
##########
File path: server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
##########
@@ -1411,7 +1411,15 @@ protected void expungeVolumesInPrimaryStorageIfNeeded(VolumeVO volume) throws In
if (volOnPrimary != null) {
s_logger.info("Expunging volume " + volume.getId() + " from primary data store");
AsyncCallFuture<VolumeApiResult> future = volService.expungeVolumeAsync(volOnPrimary);
- future.get();
+ VolumeApiResult result = future.get();
+ if (result.isFailed()) {
+ s_logger.warn("Failed to expunge the volume " + volume + " in primary storage");
+ String details = "";
+ if (result.getResult() != null && !result.getResult().isEmpty()) {
+ details = result.getResult();
+ }
+ throw new CloudRuntimeException(details);
+ }
Review comment:
@DaanHoogland sure. I will change it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] rhtyd commented on a change in pull request #5373: server: do not remove volume from DB if fail to expunge it from primary storage or secondary storage
Posted by GitBox <gi...@apache.org>.
rhtyd commented on a change in pull request #5373:
URL: https://github.com/apache/cloudstack/pull/5373#discussion_r699205500
##########
File path: server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
##########
@@ -1407,29 +1407,36 @@ protected void destroyVolumeIfPossible(VolumeVO volume) {
* If the volume is not in the primary storage, we do nothing here.
*/
protected void expungeVolumesInPrimaryStorageIfNeeded(VolumeVO volume) throws InterruptedException, ExecutionException {
- VolumeInfo volOnPrimary = volFactory.getVolume(volume.getId(), DataStoreRole.Primary);
- if (volOnPrimary != null) {
- s_logger.info("Expunging volume " + volume.getId() + " from primary data store");
- AsyncCallFuture<VolumeApiResult> future = volService.expungeVolumeAsync(volOnPrimary);
- future.get();
- }
+ expungeVolumesInPrimaryOrSecondary(volume, DataStoreRole.Primary);
}
/**
* We will check if the given volume is in the secondary storage. If the volume is not in the primary storage, we do nothing here.
* If it is, we will execute an asynchronous call to delete it there. Then, we decrement the {@link ResourceType#secondary_storage} for the account that owns the volume.
*/
protected void expungeVolumesInSecondaryStorageIfNeeded(VolumeVO volume) throws InterruptedException, ExecutionException {
- VolumeInfo volOnSecondary = volFactory.getVolume(volume.getId(), DataStoreRole.Image);
- if (volOnSecondary != null) {
- s_logger.info("Expunging volume " + volume.getId() + " from secondary data store");
- AsyncCallFuture<VolumeApiResult> future2 = volService.expungeVolumeAsync(volOnSecondary);
- future2.get();
+ expungeVolumesInPrimaryOrSecondary(volume, DataStoreRole.Image);
+ }
- _resourceLimitMgr.decrementResourceCount(volOnSecondary.getAccountId(), ResourceType.secondary_storage, volOnSecondary.getSize());
+ private void expungeVolumesInPrimaryOrSecondary(VolumeVO volume, DataStoreRole role) throws InterruptedException, ExecutionException {
+ VolumeInfo volOnStorage = volFactory.getVolume(volume.getId(), role);
+ if (volOnStorage != null) {
+ s_logger.info("Expunging volume " + volume.getId() + " from " + role + " data store");
+ AsyncCallFuture<VolumeApiResult> future = volService.expungeVolumeAsync(volOnStorage);
+ VolumeApiResult result = future.get();
+ if (result.isFailed()) {
+ s_logger.warn("Failed to expunge the volume " + volume + " in " + role + " data store");
+ String details = "";
+ if (result.getResult() != null && !result.getResult().isEmpty()) {
+ details = result.getResult();
+ }
+ throw new CloudRuntimeException(details);
Review comment:
cc @weizhouapache
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] rhtyd commented on a change in pull request #5373: server: do not remove volume from DB if fail to expunge it from primary storage or secondary storage
Posted by GitBox <gi...@apache.org>.
rhtyd commented on a change in pull request #5373:
URL: https://github.com/apache/cloudstack/pull/5373#discussion_r699205500
##########
File path: server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
##########
@@ -1407,29 +1407,36 @@ protected void destroyVolumeIfPossible(VolumeVO volume) {
* If the volume is not in the primary storage, we do nothing here.
*/
protected void expungeVolumesInPrimaryStorageIfNeeded(VolumeVO volume) throws InterruptedException, ExecutionException {
- VolumeInfo volOnPrimary = volFactory.getVolume(volume.getId(), DataStoreRole.Primary);
- if (volOnPrimary != null) {
- s_logger.info("Expunging volume " + volume.getId() + " from primary data store");
- AsyncCallFuture<VolumeApiResult> future = volService.expungeVolumeAsync(volOnPrimary);
- future.get();
- }
+ expungeVolumesInPrimaryOrSecondary(volume, DataStoreRole.Primary);
}
/**
* We will check if the given volume is in the secondary storage. If the volume is not in the primary storage, we do nothing here.
* If it is, we will execute an asynchronous call to delete it there. Then, we decrement the {@link ResourceType#secondary_storage} for the account that owns the volume.
*/
protected void expungeVolumesInSecondaryStorageIfNeeded(VolumeVO volume) throws InterruptedException, ExecutionException {
- VolumeInfo volOnSecondary = volFactory.getVolume(volume.getId(), DataStoreRole.Image);
- if (volOnSecondary != null) {
- s_logger.info("Expunging volume " + volume.getId() + " from secondary data store");
- AsyncCallFuture<VolumeApiResult> future2 = volService.expungeVolumeAsync(volOnSecondary);
- future2.get();
+ expungeVolumesInPrimaryOrSecondary(volume, DataStoreRole.Image);
+ }
- _resourceLimitMgr.decrementResourceCount(volOnSecondary.getAccountId(), ResourceType.secondary_storage, volOnSecondary.getSize());
+ private void expungeVolumesInPrimaryOrSecondary(VolumeVO volume, DataStoreRole role) throws InterruptedException, ExecutionException {
+ VolumeInfo volOnStorage = volFactory.getVolume(volume.getId(), role);
+ if (volOnStorage != null) {
+ s_logger.info("Expunging volume " + volume.getId() + " from " + role + " data store");
+ AsyncCallFuture<VolumeApiResult> future = volService.expungeVolumeAsync(volOnStorage);
+ VolumeApiResult result = future.get();
+ if (result.isFailed()) {
+ s_logger.warn("Failed to expunge the volume " + volume + " in " + role + " data store");
+ String details = "";
+ if (result.getResult() != null && !result.getResult().isEmpty()) {
+ details = result.getResult();
+ }
+ throw new CloudRuntimeException(details);
Review comment:
cc @weizhouapache
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] davidjumani commented on pull request #5373: server: do not remove volume from DB if fail to expunge it from primary storage or secondary storage
Posted by GitBox <gi...@apache.org>.
davidjumani commented on pull request #5373:
URL: https://github.com/apache/cloudstack/pull/5373#issuecomment-906123571
@blueorangutan package
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] blueorangutan commented on pull request #5373: server: do not remove volume from DB if fail to expunge it from primary storage or secondary storage
Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #5373:
URL: https://github.com/apache/cloudstack/pull/5373#issuecomment-907531481
<b>Trillian test result (tid-1809)</b>
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 35977 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr5373-t1809-kvm-centos7.zip
Intermittent failure detected: /marvin/tests/smoke/test_vpc_vpn.py
Smoke tests completed. 86 look OK, 1 have error(s)
Only failed tests results shown below:
Test | Result | Time (s) | Test File
--- | --- | --- | ---
test_01_vpc_site2site_vpn_multiple_options | `Failure` | 224.14 | test_vpc_vpn.py
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] blueorangutan commented on pull request #5373: server: do not remove volume from DB if fail to expunge it from primary storage or secondary storage
Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #5373:
URL: https://github.com/apache/cloudstack/pull/5373#issuecomment-906123907
@davidjumani a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] weizhouapache commented on a change in pull request #5373: server: do not remove volume from DB if fail to expunge it from primary storage or secondary storage
Posted by GitBox <gi...@apache.org>.
weizhouapache commented on a change in pull request #5373:
URL: https://github.com/apache/cloudstack/pull/5373#discussion_r699271425
##########
File path: server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
##########
@@ -1407,29 +1407,36 @@ protected void destroyVolumeIfPossible(VolumeVO volume) {
* If the volume is not in the primary storage, we do nothing here.
*/
protected void expungeVolumesInPrimaryStorageIfNeeded(VolumeVO volume) throws InterruptedException, ExecutionException {
- VolumeInfo volOnPrimary = volFactory.getVolume(volume.getId(), DataStoreRole.Primary);
- if (volOnPrimary != null) {
- s_logger.info("Expunging volume " + volume.getId() + " from primary data store");
- AsyncCallFuture<VolumeApiResult> future = volService.expungeVolumeAsync(volOnPrimary);
- future.get();
- }
+ expungeVolumesInPrimaryOrSecondary(volume, DataStoreRole.Primary);
}
/**
* We will check if the given volume is in the secondary storage. If the volume is not in the primary storage, we do nothing here.
* If it is, we will execute an asynchronous call to delete it there. Then, we decrement the {@link ResourceType#secondary_storage} for the account that owns the volume.
*/
protected void expungeVolumesInSecondaryStorageIfNeeded(VolumeVO volume) throws InterruptedException, ExecutionException {
- VolumeInfo volOnSecondary = volFactory.getVolume(volume.getId(), DataStoreRole.Image);
- if (volOnSecondary != null) {
- s_logger.info("Expunging volume " + volume.getId() + " from secondary data store");
- AsyncCallFuture<VolumeApiResult> future2 = volService.expungeVolumeAsync(volOnSecondary);
- future2.get();
+ expungeVolumesInPrimaryOrSecondary(volume, DataStoreRole.Image);
+ }
- _resourceLimitMgr.decrementResourceCount(volOnSecondary.getAccountId(), ResourceType.secondary_storage, volOnSecondary.getSize());
+ private void expungeVolumesInPrimaryOrSecondary(VolumeVO volume, DataStoreRole role) throws InterruptedException, ExecutionException {
+ VolumeInfo volOnStorage = volFactory.getVolume(volume.getId(), role);
+ if (volOnStorage != null) {
+ s_logger.info("Expunging volume " + volume.getId() + " from " + role + " data store");
+ AsyncCallFuture<VolumeApiResult> future = volService.expungeVolumeAsync(volOnStorage);
+ VolumeApiResult result = future.get();
+ if (result.isFailed()) {
+ s_logger.warn("Failed to expunge the volume " + volume + " in " + role + " data store");
+ String details = "";
+ if (result.getResult() != null && !result.getResult().isEmpty()) {
+ details = result.getResult();
+ }
+ throw new CloudRuntimeException(details);
Review comment:
@nvazquez done, thanks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] weizhouapache commented on pull request #5373: server: do not remove volume from DB if fail to expunge it from primary storage or secondary storage
Posted by GitBox <gi...@apache.org>.
weizhouapache commented on pull request #5373:
URL: https://github.com/apache/cloudstack/pull/5373#issuecomment-906456163
@blueorangutan test
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] weizhouapache closed pull request #5373: server: do not remove volume from DB if fail to expunge it from primary storage or secondary storage
Posted by GitBox <gi...@apache.org>.
weizhouapache closed pull request #5373:
URL: https://github.com/apache/cloudstack/pull/5373
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] blueorangutan commented on pull request #5373: server: do not remove volume from DB if fail to expunge it from primary storage or secondary storage
Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #5373:
URL: https://github.com/apache/cloudstack/pull/5373#issuecomment-907175886
Packaging result: :heavy_check_mark: el7 :heavy_check_mark: el8 :heavy_check_mark: debian. SL-JID 1042
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] weizhouapache closed pull request #5373: server: do not remove volume from DB if fail to expunge it from primary storage or secondary storage
Posted by GitBox <gi...@apache.org>.
weizhouapache closed pull request #5373:
URL: https://github.com/apache/cloudstack/pull/5373
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] blueorangutan commented on pull request #5373: server: do not remove volume from DB if fail to expunge it from primary storage or secondary storage
Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #5373:
URL: https://github.com/apache/cloudstack/pull/5373#issuecomment-907199180
@weizhouapache a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] weizhouapache commented on pull request #5373: server: do not remove volume from DB if fail to expunge it from primary storage or secondary storage
Posted by GitBox <gi...@apache.org>.
weizhouapache commented on pull request #5373:
URL: https://github.com/apache/cloudstack/pull/5373#issuecomment-907156358
@blueorangutan package
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] nvazquez merged pull request #5373: server: do not remove volume from DB if fail to expunge it from primary storage or secondary storage
Posted by GitBox <gi...@apache.org>.
nvazquez merged pull request #5373:
URL: https://github.com/apache/cloudstack/pull/5373
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] blueorangutan commented on pull request #5373: server: do not remove volume from DB if fail to expunge it from primary storage or secondary storage
Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #5373:
URL: https://github.com/apache/cloudstack/pull/5373#issuecomment-907156953
@weizhouapache a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] DaanHoogland commented on a change in pull request #5373: server: do not remove volume from DB if fail to expunge it from primary storage or secondary storage
Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on a change in pull request #5373:
URL: https://github.com/apache/cloudstack/pull/5373#discussion_r697304106
##########
File path: server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
##########
@@ -1411,7 +1411,15 @@ protected void expungeVolumesInPrimaryStorageIfNeeded(VolumeVO volume) throws In
if (volOnPrimary != null) {
s_logger.info("Expunging volume " + volume.getId() + " from primary data store");
AsyncCallFuture<VolumeApiResult> future = volService.expungeVolumeAsync(volOnPrimary);
- future.get();
+ VolumeApiResult result = future.get();
+ if (result.isFailed()) {
+ s_logger.warn("Failed to expunge the volume " + volume + " in primary storage");
+ String details = "";
+ if (result.getResult() != null && !result.getResult().isEmpty()) {
+ details = result.getResult();
+ }
+ throw new CloudRuntimeException(details);
+ }
Review comment:
except for the word "primary" vs "secondary" this block is exactly the same as the one below. can we unify it in a method and call it twice?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] nvazquez merged pull request #5373: server: do not remove volume from DB if fail to expunge it from primary storage or secondary storage
Posted by GitBox <gi...@apache.org>.
nvazquez merged pull request #5373:
URL: https://github.com/apache/cloudstack/pull/5373
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] weizhouapache commented on pull request #5373: server: do not remove volume from DB if fail to expunge it from primary storage or secondary storage
Posted by GitBox <gi...@apache.org>.
weizhouapache commented on pull request #5373:
URL: https://github.com/apache/cloudstack/pull/5373#issuecomment-907198729
@blueorangutan test
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] weizhouapache commented on a change in pull request #5373: server: do not remove volume from DB if fail to expunge it from primary storage or secondary storage
Posted by GitBox <gi...@apache.org>.
weizhouapache commented on a change in pull request #5373:
URL: https://github.com/apache/cloudstack/pull/5373#discussion_r699271425
##########
File path: server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
##########
@@ -1407,29 +1407,36 @@ protected void destroyVolumeIfPossible(VolumeVO volume) {
* If the volume is not in the primary storage, we do nothing here.
*/
protected void expungeVolumesInPrimaryStorageIfNeeded(VolumeVO volume) throws InterruptedException, ExecutionException {
- VolumeInfo volOnPrimary = volFactory.getVolume(volume.getId(), DataStoreRole.Primary);
- if (volOnPrimary != null) {
- s_logger.info("Expunging volume " + volume.getId() + " from primary data store");
- AsyncCallFuture<VolumeApiResult> future = volService.expungeVolumeAsync(volOnPrimary);
- future.get();
- }
+ expungeVolumesInPrimaryOrSecondary(volume, DataStoreRole.Primary);
}
/**
* We will check if the given volume is in the secondary storage. If the volume is not in the primary storage, we do nothing here.
* If it is, we will execute an asynchronous call to delete it there. Then, we decrement the {@link ResourceType#secondary_storage} for the account that owns the volume.
*/
protected void expungeVolumesInSecondaryStorageIfNeeded(VolumeVO volume) throws InterruptedException, ExecutionException {
- VolumeInfo volOnSecondary = volFactory.getVolume(volume.getId(), DataStoreRole.Image);
- if (volOnSecondary != null) {
- s_logger.info("Expunging volume " + volume.getId() + " from secondary data store");
- AsyncCallFuture<VolumeApiResult> future2 = volService.expungeVolumeAsync(volOnSecondary);
- future2.get();
+ expungeVolumesInPrimaryOrSecondary(volume, DataStoreRole.Image);
+ }
- _resourceLimitMgr.decrementResourceCount(volOnSecondary.getAccountId(), ResourceType.secondary_storage, volOnSecondary.getSize());
+ private void expungeVolumesInPrimaryOrSecondary(VolumeVO volume, DataStoreRole role) throws InterruptedException, ExecutionException {
+ VolumeInfo volOnStorage = volFactory.getVolume(volume.getId(), role);
+ if (volOnStorage != null) {
+ s_logger.info("Expunging volume " + volume.getId() + " from " + role + " data store");
+ AsyncCallFuture<VolumeApiResult> future = volService.expungeVolumeAsync(volOnStorage);
+ VolumeApiResult result = future.get();
+ if (result.isFailed()) {
+ s_logger.warn("Failed to expunge the volume " + volume + " in " + role + " data store");
+ String details = "";
+ if (result.getResult() != null && !result.getResult().isEmpty()) {
+ details = result.getResult();
+ }
+ throw new CloudRuntimeException(details);
Review comment:
@nvazquez done, thanks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] weizhouapache commented on a change in pull request #5373: server: do not remove volume from DB if fail to expunge it from primary storage or secondary storage
Posted by GitBox <gi...@apache.org>.
weizhouapache commented on a change in pull request #5373:
URL: https://github.com/apache/cloudstack/pull/5373#discussion_r699271425
##########
File path: server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
##########
@@ -1407,29 +1407,36 @@ protected void destroyVolumeIfPossible(VolumeVO volume) {
* If the volume is not in the primary storage, we do nothing here.
*/
protected void expungeVolumesInPrimaryStorageIfNeeded(VolumeVO volume) throws InterruptedException, ExecutionException {
- VolumeInfo volOnPrimary = volFactory.getVolume(volume.getId(), DataStoreRole.Primary);
- if (volOnPrimary != null) {
- s_logger.info("Expunging volume " + volume.getId() + " from primary data store");
- AsyncCallFuture<VolumeApiResult> future = volService.expungeVolumeAsync(volOnPrimary);
- future.get();
- }
+ expungeVolumesInPrimaryOrSecondary(volume, DataStoreRole.Primary);
}
/**
* We will check if the given volume is in the secondary storage. If the volume is not in the primary storage, we do nothing here.
* If it is, we will execute an asynchronous call to delete it there. Then, we decrement the {@link ResourceType#secondary_storage} for the account that owns the volume.
*/
protected void expungeVolumesInSecondaryStorageIfNeeded(VolumeVO volume) throws InterruptedException, ExecutionException {
- VolumeInfo volOnSecondary = volFactory.getVolume(volume.getId(), DataStoreRole.Image);
- if (volOnSecondary != null) {
- s_logger.info("Expunging volume " + volume.getId() + " from secondary data store");
- AsyncCallFuture<VolumeApiResult> future2 = volService.expungeVolumeAsync(volOnSecondary);
- future2.get();
+ expungeVolumesInPrimaryOrSecondary(volume, DataStoreRole.Image);
+ }
- _resourceLimitMgr.decrementResourceCount(volOnSecondary.getAccountId(), ResourceType.secondary_storage, volOnSecondary.getSize());
+ private void expungeVolumesInPrimaryOrSecondary(VolumeVO volume, DataStoreRole role) throws InterruptedException, ExecutionException {
+ VolumeInfo volOnStorage = volFactory.getVolume(volume.getId(), role);
+ if (volOnStorage != null) {
+ s_logger.info("Expunging volume " + volume.getId() + " from " + role + " data store");
+ AsyncCallFuture<VolumeApiResult> future = volService.expungeVolumeAsync(volOnStorage);
+ VolumeApiResult result = future.get();
+ if (result.isFailed()) {
+ s_logger.warn("Failed to expunge the volume " + volume + " in " + role + " data store");
+ String details = "";
+ if (result.getResult() != null && !result.getResult().isEmpty()) {
+ details = result.getResult();
+ }
+ throw new CloudRuntimeException(details);
Review comment:
@nvazquez done, thanks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] nvazquez commented on a change in pull request #5373: server: do not remove volume from DB if fail to expunge it from primary storage or secondary storage
Posted by GitBox <gi...@apache.org>.
nvazquez commented on a change in pull request #5373:
URL: https://github.com/apache/cloudstack/pull/5373#discussion_r697803570
##########
File path: server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
##########
@@ -1407,29 +1407,36 @@ protected void destroyVolumeIfPossible(VolumeVO volume) {
* If the volume is not in the primary storage, we do nothing here.
*/
protected void expungeVolumesInPrimaryStorageIfNeeded(VolumeVO volume) throws InterruptedException, ExecutionException {
- VolumeInfo volOnPrimary = volFactory.getVolume(volume.getId(), DataStoreRole.Primary);
- if (volOnPrimary != null) {
- s_logger.info("Expunging volume " + volume.getId() + " from primary data store");
- AsyncCallFuture<VolumeApiResult> future = volService.expungeVolumeAsync(volOnPrimary);
- future.get();
- }
+ expungeVolumesInPrimaryOrSecondary(volume, DataStoreRole.Primary);
}
/**
* We will check if the given volume is in the secondary storage. If the volume is not in the primary storage, we do nothing here.
* If it is, we will execute an asynchronous call to delete it there. Then, we decrement the {@link ResourceType#secondary_storage} for the account that owns the volume.
*/
protected void expungeVolumesInSecondaryStorageIfNeeded(VolumeVO volume) throws InterruptedException, ExecutionException {
- VolumeInfo volOnSecondary = volFactory.getVolume(volume.getId(), DataStoreRole.Image);
- if (volOnSecondary != null) {
- s_logger.info("Expunging volume " + volume.getId() + " from secondary data store");
- AsyncCallFuture<VolumeApiResult> future2 = volService.expungeVolumeAsync(volOnSecondary);
- future2.get();
+ expungeVolumesInPrimaryOrSecondary(volume, DataStoreRole.Image);
+ }
- _resourceLimitMgr.decrementResourceCount(volOnSecondary.getAccountId(), ResourceType.secondary_storage, volOnSecondary.getSize());
+ private void expungeVolumesInPrimaryOrSecondary(VolumeVO volume, DataStoreRole role) throws InterruptedException, ExecutionException {
+ VolumeInfo volOnStorage = volFactory.getVolume(volume.getId(), role);
+ if (volOnStorage != null) {
+ s_logger.info("Expunging volume " + volume.getId() + " from " + role + " data store");
+ AsyncCallFuture<VolumeApiResult> future = volService.expungeVolumeAsync(volOnStorage);
+ VolumeApiResult result = future.get();
+ if (result.isFailed()) {
+ s_logger.warn("Failed to expunge the volume " + volume + " in " + role + " data store");
+ String details = "";
+ if (result.getResult() != null && !result.getResult().isEmpty()) {
+ details = result.getResult();
+ }
+ throw new CloudRuntimeException(details);
Review comment:
Minor suggestion: what about prepending `"Failed to expunge the volume " + volume + " in " + role + " data store: "` here?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] blueorangutan commented on pull request #5373: server: do not remove volume from DB if fail to expunge it from primary storage or secondary storage
Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #5373:
URL: https://github.com/apache/cloudstack/pull/5373#issuecomment-906138139
Packaging result: :heavy_check_mark: el7 :heavy_check_mark: el8 :heavy_check_mark: debian. SL-JID 1016
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] rhtyd commented on a change in pull request #5373: server: do not remove volume from DB if fail to expunge it from primary storage or secondary storage
Posted by GitBox <gi...@apache.org>.
rhtyd commented on a change in pull request #5373:
URL: https://github.com/apache/cloudstack/pull/5373#discussion_r699205500
##########
File path: server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
##########
@@ -1407,29 +1407,36 @@ protected void destroyVolumeIfPossible(VolumeVO volume) {
* If the volume is not in the primary storage, we do nothing here.
*/
protected void expungeVolumesInPrimaryStorageIfNeeded(VolumeVO volume) throws InterruptedException, ExecutionException {
- VolumeInfo volOnPrimary = volFactory.getVolume(volume.getId(), DataStoreRole.Primary);
- if (volOnPrimary != null) {
- s_logger.info("Expunging volume " + volume.getId() + " from primary data store");
- AsyncCallFuture<VolumeApiResult> future = volService.expungeVolumeAsync(volOnPrimary);
- future.get();
- }
+ expungeVolumesInPrimaryOrSecondary(volume, DataStoreRole.Primary);
}
/**
* We will check if the given volume is in the secondary storage. If the volume is not in the primary storage, we do nothing here.
* If it is, we will execute an asynchronous call to delete it there. Then, we decrement the {@link ResourceType#secondary_storage} for the account that owns the volume.
*/
protected void expungeVolumesInSecondaryStorageIfNeeded(VolumeVO volume) throws InterruptedException, ExecutionException {
- VolumeInfo volOnSecondary = volFactory.getVolume(volume.getId(), DataStoreRole.Image);
- if (volOnSecondary != null) {
- s_logger.info("Expunging volume " + volume.getId() + " from secondary data store");
- AsyncCallFuture<VolumeApiResult> future2 = volService.expungeVolumeAsync(volOnSecondary);
- future2.get();
+ expungeVolumesInPrimaryOrSecondary(volume, DataStoreRole.Image);
+ }
- _resourceLimitMgr.decrementResourceCount(volOnSecondary.getAccountId(), ResourceType.secondary_storage, volOnSecondary.getSize());
+ private void expungeVolumesInPrimaryOrSecondary(VolumeVO volume, DataStoreRole role) throws InterruptedException, ExecutionException {
+ VolumeInfo volOnStorage = volFactory.getVolume(volume.getId(), role);
+ if (volOnStorage != null) {
+ s_logger.info("Expunging volume " + volume.getId() + " from " + role + " data store");
+ AsyncCallFuture<VolumeApiResult> future = volService.expungeVolumeAsync(volOnStorage);
+ VolumeApiResult result = future.get();
+ if (result.isFailed()) {
+ s_logger.warn("Failed to expunge the volume " + volume + " in " + role + " data store");
+ String details = "";
+ if (result.getResult() != null && !result.getResult().isEmpty()) {
+ details = result.getResult();
+ }
+ throw new CloudRuntimeException(details);
Review comment:
cc @weizhouapache
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org