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

core: Quota name in audit log when deleting quota #481

Merged
merged 2 commits into from Jun 28, 2022

Conversation

smelamud
Copy link
Member

Added missing method for ${QuotaName} substitution in the audit log
message for RemoveQuotaCommand.

Change-Id: I9826e1965b7faf8dc46afa80d1218ae49fc4a34b
Bug-Url: https://bugzilla.redhat.com/2018412
Signed-off-by: Shmuel Melamud smelamud@redhat.com

Added missing method for ${QuotaName} substitution in the audit log
message for RemoveQuotaCommand.

Change-Id: I9826e1965b7faf8dc46afa80d1218ae49fc4a34b
Bug-Url: https://bugzilla.redhat.com/2018412
Signed-off-by: Shmuel Melamud <smelamud@redhat.com>
Copy link
Member

@liranr23 liranr23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes seems fine and simple.
But, should AuditLog take it from the quota itself? getQuota.getName()? without this additional getQuotaName()?

@smelamud
Copy link
Member Author

@liranr23 That's how these substitutions work. There is no way to use expressions there.

Copy link
Member

@ahadas ahadas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it is simple but wouldn't it make more sense to change RemoveQuotaCommand to extend QuotaCRUDCommand?

@smelamud
Copy link
Member Author

yes, it is simple but wouldn't it make more sense to change RemoveQuotaCommand to extend QuotaCRUDCommand?

I don't see much sense in it. Besides get/setQuota() and getQuotaName() all other code is useless in this command.

@ahadas
Copy link
Member

ahadas commented Jun 22, 2022

yes, it is simple but wouldn't it make more sense to change RemoveQuotaCommand to extend QuotaCRUDCommand?

I don't see much sense in it. Besides get/setQuota() and getQuotaName() all other code is useless in this command.

Not for reusability but to represent kind-of relationship, after all CRUD includes "delete".. :)

@smelamud
Copy link
Member Author

smelamud commented Jun 22, 2022

Not for reusability but to represent kind-of relationship, after all CRUD includes "delete".. :)

Yeah, but there is another problem: QuotaCRUDCommand uses QuotaCRUDParameters that contain a lot of things, but RemoveQuotaCommand uses id only. Since the code of QuotaCRUDCommand relies heavily on the parameters, we will need to add another level of hierarchy between QuotaCRUDCommand and Add/UpdateQuotaCommand and move all this code there. This looks as an overkill for such a bug, honestly.

As an alternative, we can just rename QuotaCRUDCommand to something more correct ;)

@ahadas
Copy link
Member

ahadas commented Jun 23, 2022

practically, that missing variable is probably the only gap we'll have but conceptually it's not different from RemoveAffinityGroupCommand that extends AffinityGroupCRUDCommand - the parameters of the latter contain more data than the former needs (as you wrote, "remove" only needs the ID)

so isn't it just about removing the NotNull for quota in QuotaCRUDParameters?

@smelamud
Copy link
Member Author

@ahadas Won't removing @NotNull break some validation?

OK, let me try with QuotaCRUDCommand, will see how it works.

@ahadas
Copy link
Member

ahadas commented Jun 27, 2022

@ahadas Won't removing @NotNull break some validation?

probably, I meant to do that and add a null-check where appropriate

OK, let me try with QuotaCRUDCommand, will see how it works.

ack

Change-Id: I4af00ee5ce7c170d9ce07d9f63312166a1ed9fab
Signed-off-by: Shmuel Melamud <smelamud@redhat.com>
@smelamud
Copy link
Member Author

smelamud commented Jun 27, 2022

OK, let me try with QuotaCRUDCommand, will see how it works.

ack

Done.

@ahadas
Copy link
Member

ahadas commented Jun 28, 2022

/ost

@ahadas ahadas merged commit b65bf43 into oVirt:master Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants