Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Incorrect RelationType used for calls to Gateway.edit_rate_limits() and Gateway.disable_rate_limits() #804

Open
mattbsage opened this issue Jan 30, 2023 · 0 comments
Labels

Comments

@mattbsage
Copy link

mattbsage commented Jan 30, 2023

Describe the bug

The edit_rate_limits and disable_rate_limits methods of the pyvcloud.vcd.gateway.Gateway() class call the put_linked_resource method of the vcd.Client class.

The calls look like this:

        return self.client.put_linked_resource(
            self.resource, RelationType.EDIT, EntityType.EDGE_GATEWAY.value,
            gateway)

The RelationType.EDIT is incorrect, the proper RelationType is RelationType.GATEWAY_UPDATE_PROPERTIES.

Currently any request to edit or remove rate limits on the Edge Gateway, is accepted with a 202 (queued) but then fails as the request is invalid.

Reproduction steps

  1. Instantiate a Gateway object.
  2. Attempt to disable or edit a rate limit on one of the external networks.
  3. Log that the task was queued (Return code: 202).
  4. Wait.
  5. Notice that the updates you requested were not made.
  6. Log in to the UI to see that the task failed almost instantly.
  7. Compare the API call to that of the same request from the UI.
  8. Notice that the RelationType is incorrect.
  9. Subclass a Gateway object and override the rate_limits methods to use RelationType.GATEWAY_UPDATE_PROPERTIES.
  10. Use the Subclassed Gateway object to confirm that the changes to rate limits are now working.
  11. Cry inconsolably because a simple integration test would have caught this bug. ;-)
  12. Cheer up because the folks a VMWare are gonna fix this quickly, right?

Expected behavior

The calls to Client.put_linked_resource() should use RelationType.GATEWAY_UPDATE_PROPERTIES.

Additional context

It's probable that a broader review needs to be done on all the methods of the Gateway class.

RelationType.GATEWAY_UPDATE_PROPERTIES is only used twice in the class definition and I suspect that it ought to be used for most of the modification tasks. Unfortunately, I don't have a suitable lab environment nor the time to check every method in this class. :-(

@mattbsage mattbsage added the bug label Jan 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant