cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

Inserts timer in check detach volume

Open RodrigoDLopez opened this issue 3 years ago • 1 comments

Description

When detaching a volume, if the volume is in use inside the VM, the hypervisor waits until it is possible to execute the task. This waiting period causes ACS to interpret that the disk could not be removed and presents an error message to the user. This behavior can generate inconsistencies, because the volume detach is performed, but the ACS does not identify this information. If the user requests the volume detach again, a new error message is presented, saying that the volume in question is not contained in the target instance.

To work around the situation, the wait.detach.device property was created in the agent.properties file. It determines, in milliseconds, the time ACS will wait before considering the detach command to have failed. The default value of this property is 10000 (10 seconds).

Also, changes have been made so that an exception is not thrown when the user tries to remove a volume that is no longer contained in the VM. That way, if the detach command fails to extrapolate the time configured by the wait.detach.device property, but the volume is still removed from the instance by the hypervisor, the user can later remove it via the UI, without having to stop the VM to perform this procedure.

Types of changes

  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] Enhancement (improves an existing feature and functionality)
  • [ ] Cleanup (Code refactoring and cleanup, that may add test cases)

Feature/Enhancement Scale

  • [ ] Major
  • [x] Minor

How Has This Been Tested?

RodrigoDLopez avatar Jun 27 '22 11:06 RodrigoDLopez

Hi @RodrigoDLopez Can this detach wait time passed through detach cmd (DettachCommand) and handle the timeout in resource layer, later this might be useful to extend to other hypervisors if needed.

sureshanaparti avatar Jun 28 '22 04:06 sureshanaparti

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

github-actions[bot] avatar Sep 27 '22 07:09 github-actions[bot]

@RodrigoDLopez can you look at the comment and the conflicts?

DaanHoogland avatar Sep 27 '22 12:09 DaanHoogland

Found UI changes, kicking a new UI QA build @blueorangutan ui

acs-robot avatar Sep 29 '22 17:09 acs-robot

@acs-robot a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

blueorangutan avatar Sep 29 '22 17:09 blueorangutan

@RodrigoDLopez can you look at the comment and the conflicts?

Sorry for the delay @daan. Now the wait.detach.device value is configurable via global settings as suggested by @sureshanaparti. And changed the signature of the methods to void. Thus, it is not necessary to return null.

RodrigoDLopez avatar Sep 29 '22 17:09 RodrigoDLopez

UI build: :heavy_check_mark: Live QA URL: http://qa.cloudstack.cloud:8080/client/pr/6508 (SL-JID-2439)

blueorangutan avatar Sep 29 '22 17:09 blueorangutan

Codecov Report

Merging #6508 (648f8e2) into main (48ffa5d) will increase coverage by 0.03%. The diff coverage is 3.33%.

@@             Coverage Diff              @@
##               main    #6508      +/-   ##
============================================
+ Coverage     10.84%   10.87%   +0.03%     
- Complexity     7097     7117      +20     
============================================
  Files          2485     2485              
  Lines        245366   245531     +165     
  Branches      38318    38336      +18     
============================================
+ Hits          26606    26701      +95     
- Misses       215491   215560      +69     
- Partials       3269     3270       +1     
Impacted Files Coverage Δ
...om/cloud/storage/dao/GuestOSHypervisorDaoImpl.java 32.25% <0.00%> (-0.36%) :arrow_down:
...storage/image/deployasis/DeployAsIsHelperImpl.java 13.26% <0.00%> (-0.21%) :arrow_down:
...ain/java/com/cloud/network/vpc/VpcManagerImpl.java 4.12% <0.00%> (-0.01%) :arrow_down:
...ud/hypervisor/kvm/storage/KVMStorageProcessor.java 4.99% <2.08%> (-0.01%) :arrow_down:
...n/java/com/cloud/storage/VolumeApiServiceImpl.java 12.90% <33.33%> (+0.03%) :arrow_up:
.../org/apache/cloudstack/quota/QuotaManagerImpl.java 44.92% <0.00%> (-1.08%) :arrow_down:
...n/java/com/cloud/vm/VirtualMachineProfileImpl.java 36.44% <0.00%> (-0.70%) :arrow_down:
...torage/allocator/AbstractStoragePoolAllocator.java 8.88% <0.00%> (-0.16%) :arrow_down:
...ava/com/cloud/api/query/dao/VolumeJoinDaoImpl.java 5.78% <0.00%> (-0.07%) :arrow_down:
...dstack/storage/datastore/PrimaryDataStoreImpl.java 2.23% <0.00%> (-0.02%) :arrow_down:
... and 13 more

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov[bot] avatar Sep 29 '22 18:09 codecov[bot]

@blueorangutan package

DaanHoogland avatar Oct 11 '22 08:10 DaanHoogland

@DaanHoogland 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.

blueorangutan avatar Oct 11 '22 08:10 blueorangutan

Packaging result: :heavy_check_mark: el7 :heavy_check_mark: el8 :heavy_check_mark: debian :heavy_check_mark: suse15. SL-JID 4419

blueorangutan avatar Oct 11 '22 09:10 blueorangutan

@blueorangutan test

DaanHoogland avatar Oct 12 '22 06:10 DaanHoogland

@DaanHoogland a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

blueorangutan avatar Oct 12 '22 06:10 blueorangutan

Trillian Build Failed (tid-5104)

blueorangutan avatar Oct 12 '22 07:10 blueorangutan

Trillian Build Failed (tid-5104)

blueorangutan avatar Oct 12 '22 19:10 blueorangutan

Packaging result: :heavy_multiplication_x: el7 :heavy_check_mark: el8 :heavy_multiplication_x: debian :heavy_multiplication_x: suse15. SL-JID 4450

blueorangutan avatar Oct 13 '22 09:10 blueorangutan

Found UI changes, kicking a new UI QA build @blueorangutan ui

acs-robot avatar Oct 13 '22 16:10 acs-robot

@acs-robot a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

blueorangutan avatar Oct 13 '22 16:10 blueorangutan

UI build: :heavy_check_mark: Live QA URL: http://qa.cloudstack.cloud:8080/client/pr/6508 (SL-JID-2496)

blueorangutan avatar Oct 13 '22 16:10 blueorangutan

@blueorangutan package

DaanHoogland avatar Oct 14 '22 09:10 DaanHoogland

@DaanHoogland 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.

blueorangutan avatar Oct 14 '22 09:10 blueorangutan

Packaging result: :heavy_check_mark: el7 :heavy_check_mark: el8 :heavy_check_mark: debian :heavy_check_mark: suse15. SL-JID 4465

blueorangutan avatar Oct 14 '22 10:10 blueorangutan

@blueorangutan test

DaanHoogland avatar Oct 19 '22 07:10 DaanHoogland

@DaanHoogland a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

blueorangutan avatar Oct 19 '22 07:10 blueorangutan

Trillian Build Failed (tid-5166)

blueorangutan avatar Oct 19 '22 07:10 blueorangutan

Trillian Build Failed (tid-5168)

blueorangutan avatar Oct 19 '22 08:10 blueorangutan

Trillian Build Failed (tid-5172)

blueorangutan avatar Oct 19 '22 12:10 blueorangutan

@RodrigoDLopez can you rebase this one on latest main. I see software version discrepancies in the systemvms

DaanHoogland avatar Oct 19 '22 13:10 DaanHoogland

@blueorangutan package

DaanHoogland avatar Oct 25 '22 06:10 DaanHoogland

@DaanHoogland 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.

blueorangutan avatar Oct 25 '22 07:10 blueorangutan