-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fixes regarding VOLUME_DELETE events resulting from account deletion #1624
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
Fixes regarding VOLUME_DELETE events resulting from account deletion #1624
Conversation
|
@blueorangutan kick |
|
A Trillian-Jenkins job has been kicked to build packages and start testing. I'll keep you posted as I make progress. |
|
Packaging result: ✔centos6 ✔centos7 ✔debian repo: http://packages.shapeblue.com/cloudstack/pr/1624 |
| f.set(utils, this.getClass().getDeclaredField(usageUtilsFields.get(fieldName)).get(this)); | ||
| } catch (IllegalArgumentException | IllegalAccessException | ||
| | NoSuchFieldException | SecurityException e) { | ||
| // TODO Auto-generated catch block |
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.
Is there a TODO to be resolved? Is there a TODO to be resolved? Seems like the test should fail if one of these exceptions occurs.
|
LGTM. Thanks @ProjectMoon as soon as #1654 is merged, we'll get this merged as well. Do we have any regression tests results, especially around the changed code? |
|
@ProjectMoon please rebase now, PR 1654 has been merged now. DB upgrades should not cause errors. |
|
The pull request has been rebased. |
|
Looks like it's ready for merging now. |
|
@ProjectMoon we need a test LGTM. I inquired yesterday -- do you have someone lined up to test it? |
|
We can have someone test it. Are you looking for results of a manual test, reproduction steps, or something automated? A manual test is probably the best from our side because we don't really have the time to write any unit/integration tests at the moment beyond what already exists in this PR. |
| SearchCriteria<VolumeVO> c = sb.create(); | ||
| c.setParameters("instanceId", instanceId); | ||
| c.setParameters("vType", Volume.Type.ROOT); | ||
| return _volumeDao.customSearchIncludingRemoved(c, null); |
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.
This method does not return expunged volume, but root volume of a VM. Could there be a case where a VM can have more than one root volume? If not, let's rename the method to say getInstanceRootVolume and return just the VolumeVO instead a list.
|
@blueorangutan kick |
|
@ProjectMoon I want to get this PR into 4.8.2.0, 4.9.1.0, and 4.10.0.0 for which we will be cutting RCs on 25 Sept 2016. Tests should be the entire Marvin smoke test suite against VMware, KVM, and XenServer, as well as, the Also, is it possible to automate the test procedure described in the description? Given the amount of change in the project, we want to keep manual testing to an absolute minimum. Finally, is there a JIRA ticket for this bug? |
|
I started BVT run(xenserver, advanced zone) on this PR. @cloudmonger will post the results here in approx. 4 hrs. |
|
This branch has been rebased to latest 4.8. |
|
Iso tests failed as the iso url wasnt accessible from our test environment. All is well here. |
|
No code changes, just updating the commits under it. |
|
@ProjectMoon can you squash your changes, and rebase against latest base branch? |
…stance. Currently the logic about volume deletion seems to be that an event should be emitted when the volume delete is requested, not when the deletion completes. The VolumeStateListener specifically ignores destroy events for ROOT volumes, assuming that the ROOT volume only gets deleted when the instance is destroyed and the UserVmManager should take care of it. When deleting an account, all of its resources get destroyed, but the instance expunging circumvents the UserVmManager, and thus we miss the VOLUME_DESTROY usage event. The account manager now attempts to propperly destroy the vm before expunging it. This way the destroy logic is respected, including the event emission.
|
The commits have been squashed, commit message updated to make sense (I think; let me know if it's not right), and rebased against latest 4.8. |
|
I started another test run on this. If it goes through, I will merge this tonight. |
ACS CI BVT RunSumarry: Link to logs Folder (search by build_no): https://www.dropbox.com/sh/yj3wnzbceo9uef2/AAB6u-Iap-xztdm6jHX9SjPja?dl=0 Failed tests:
Skipped tests: Passed test suits: |
|
@blueorangutan package |
|
@jburwell a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔centos6 ✔centos7 ✔debian. JID-88 |
|
Iso failures are due to URL access issues. All good here. merging this now. |
…-4.8 Fixes regarding VOLUME_DELETE events resulting from account deletionNew version of #1491. **Original Description** New version of #1373, but updated for the 4.7 branch with another fix that allows it to properly find expunged root volumes. This is a bug fix, which is why we target the 4.7 branch. Original pull request: Fixes regarding usage event emission. UsageEventUtils was previously not checking deleted accounts, which meant that if an account was deleted that had some resources running on it, those resources would get destroyed without emitting any events. Furthermore, the VOLUME_DELETE event of ROOT volumes is the responsibility of the UserVmManager, which gets circumvented when expunging resources following the account deletion. Added a check to the AccountManager which catches the ROOT volumes that need to be deleted and emits events for them. To test this: Create a new user. As that user, create and destroy an instance. This should cause the VM_CREATE, VM_START, VM_STOP, VM_DESTROY, VOLUME_CREATE, and VOLUME_DELETE events to be emitted. Create a new instance as the same user. Log in as admin, and delete the user. The same set of events should be emitted, and there should be no duplicate DELETE events for the ROOT volume of the previous instance. * pr/1624: Emit a VOLUME_DELETE usage event when account deletion destroys an instance. Signed-off-by: Rajani Karuturi <[email protected]>
|
This is pushed to 4.8 but not merged fwd. |
|
It is now fwd merged to all the branches. Thanks |
New version of #1491.
Original Description
New version of #1373, but updated for the 4.7 branch with another fix that allows it to properly find expunged root volumes. This is a bug fix, which is why we target the 4.7 branch.
Original pull request:
Fixes regarding usage event emission.
UsageEventUtils was previously not checking deleted accounts, which meant that if an account was deleted that had some resources running on it, those resources would get destroyed without emitting any events.
Furthermore, the VOLUME_DELETE event of ROOT volumes is the responsibility of the UserVmManager, which gets circumvented when expunging resources following the account deletion. Added a check to the AccountManager which catches the ROOT volumes that need to be deleted and emits events for them.
To test this: Create a new user. As that user, create and destroy an instance. This should cause the VM_CREATE, VM_START, VM_STOP, VM_DESTROY, VOLUME_CREATE, and VOLUME_DELETE events to be emitted.
Create a new instance as the same user. Log in as admin, and delete the user. The same set of events should be emitted, and there should be no duplicate DELETE events for the ROOT volume of the previous instance.