Uh oh!
There was an error while loading. Please reload this page.
Fixes regarding VOLUME_DELETE events resulting from account deletion. - #1491
Fixes regarding VOLUME_DELETE events resulting from account deletion.#1491ProjectMoon wants to merge 1 commit into
Conversation
| s_logger.error("Unable to expunge vm: " + vm.getId()); | ||
| accountCleanupNeeded = true; | ||
| } | ||
| else if (!vm.getState().equals(VirtualMachine.State.Destroyed)) { |
There was a problem hiding this comment.
In what case would the vm's state be destroyed, when the vm was expunged above?
There was a problem hiding this comment.
Also, do you know if the expunge thread propagates the usage event correctly?
There was a problem hiding this comment.
The check on line 777 makes sure that the volume wasn't already destroyed before expunging. In that case, the delete event has already been emitted somewhere else.
The expunge thread does emit other usage events correctly (we tested deleting an account having active VMs, datadisks, allocated IP's, templates, and snapshots, and upon deleting the account, "delete" usage events were emitted for each of them). The emission of the ROOT volume's "delete" event is handled on a more case-by-case basis (In UserVmManager for regular VM destroys, in VolumeOrchestrator for failed vm creation, etc), and the case where the root volume gets deleted as part of account deletion was not being handled.
koushik-das
commented
Apr 14, 2016
@ProjectMoon On latest master during VM deployment no VOLUME.CREATE is getting generated for ROOT volume. Also during destroy there is no VOLUME.DELETE event. On the event table I only see events for VM creation/destroy. Is ROOT volume events broken in general? |
nnesic
commented
Apr 14, 2016
@koushik-das We are mostly working with 4.7 version, where other volume usage events get emitted correctly. We haven't investigated the behavior on master yet. |
cristofolini
commented
Apr 18, 2016
@ProjectMoon May I suggest extracting lines 778-784 in |
| return _volumeDao.customSearchIncludingRemoved(c, null); | ||
| } | ||
| protected boolean cleanupAccount(AccountVO account, long callerUserId, Account caller) { |
There was a problem hiding this comment.
I think it is missing a simple unit tests as a test if the method expungedInstaceRootVolume is called when the cleanupAccount is invoked and there is a vm in destroyed state. That and the guarantee that the method getExpungedInstanceRootVolume works, added to the tests you made would complete it.
swill
commented
May 12, 2016
CI RESULTSSummary of the problem(s): Associated Uploads
Uploads will be available until Comment created by |
swill
commented
May 12, 2016
Can I get some code review on this PR? Thx... |
DaanHoogland
commented
May 12, 2016
so @swill, I may find time to review later. In the meanwhile let's use tag:needsreview makes sense? |
swill
commented
May 12, 2016
yep, sounds good... |
swill
commented
May 26, 2016
This one needs review as well... |
ProjectMoon
commented
May 26, 2016
Rebased against latest 4.7. |
swill
commented
May 26, 2016
@ProjectMoon try to close and reopen this one to try to get it green. thx... |
swill
commented
May 26, 2016
@ProjectMoon and again. :( sorry... |
bvbharatk
commented
Jun 8, 2016
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: |
…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. Added a check in the AccountManager to emit the deletion event for ROOT volumes belonging to instances which weren't destroyed prior to the account deletion.
ProjectMoon
commented
Aug 2, 2016
Closing to reopen against 4.8. |
…-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 <rajani.karuturi@accelerite.com>
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.