Skip to content
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. #1372

Closed
wants to merge 1 commit into from
Closed

Fixes regarding VOLUME_DELETE events resulting from account deletion. #1372

wants to merge 1 commit into from

Conversation

ProjectMoon
Copy link

New version of #924, but on the right branch with the commits squashed.

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.

The logic about volume deletion was 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.

This was causing problems when deleting accounts which had running
resources. The resources are stopped and destroyed, but we never get a
usage event indicating so. 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.

This commits adds 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. It also adds the volume status to the
event emitted on the event bus, for distinguishing between pre and
post state transitions.
@ProjectMoon
Copy link
Author

Which file is missing the license? Still don't see that in the Jenkins build.

@rohityadavcloud
Copy link
Member

@ProjectMoon do you want to merge this only on master or since 4.6/4.7? Check the target branch of the PR.

@ProjectMoon
Copy link
Author

Yes.. wrong branch again. GitHub's cross-fork interface tends to be a bit confusing for me due to how it loads when you change repos. Attempt #3 coming up.

@rohityadavcloud
Copy link
Member

@ProjectMoon :) Github need to fix this, really annoying

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants