restapi: Add watchdog support to update VM API - #1021
Conversation
Fixes an issue where the VM watchdog API bypass validation for running VMs, such as verifying the presence of a next-run configuration for running VMs, which can lead to inconsistent or incorrect watchdog settings. Watchdog updates are now handled via the update VM API to ensure proper checks. Signed-off-by: Liakh Artemii <aliakh@orionsoft.ru>
26a43a6 to
c39d194
Compare
dupondje
left a comment
There was a problem hiding this comment.
Thanks for the PR.
So the current implementation doesn't do any validation, but you add some additional implementation without a lot of validation? And you don't touch the existing flow?
This seems like a bad idea ...
I think it should be handled in for example backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmWatchdogResource.java. And if there some validation is missing it should be fixed there.
@dupondje This implementation follows the existing approach used for RngDevice, where the logic also relies on UpdateVmCommand for validation. Since UpdateVmCommand already contains the necessary state checks, I reused this mechanism to avoid duplicating validation logic and to stay consistent with similar features. Adding validation directly in BackendVmWatchdogResource would significantly increase complexity, as all necessary checks are already implemented within UpdateVmCommand. Integrating UpdateVmCommand into BackendVmWatchdogResource would be non-trivial due to the current classes structure. By reusing UpdateVmCommand, we ensure consistency with the existing VM update flow and avoid duplicating validation logic in multiple layers. |
Updating the watchdog via the VM Watchdog API bypass validation checks, such as verifying the presence of a next-run configuration for running VMs. This can lead to inconsistent or incorrect watchdog settings.
Changes introduced with this PR
Are you the owner of the code you are sending in, or do you have permission of the owner?
Yes