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

When we create or delete resources inside update() we don't change the local state #336

Closed
gbregman opened this issue Nov 22, 2023 · 1 comment
Assignees

Comments

@gbregman
Copy link
Contributor

When a gateway creates or delete a resource because of a notification of a change in the OMAP file, we call SPDK to create or delete the resource, but we don't update the local state. The local state update is done in the same place where we update the OMAP state. As we don't update the OMAP state when we're in update(), we don't update the local state either:

            if context:
                # Update gateway state
                try:
                    json_req = json_format.MessageToJson(
                        request, preserving_proto_field_name=True)
                    self.gateway_state.add_bdev(bdev_name, json_req)
                except Exception as ex:
                    self.logger.error(
                        f"Error persisting create_bdev {bdev_name}: {ex}")
                    raise

This is the create_bdev() code. When we create the bdev inside an update() the context parameter is set to None. So, we don't get to the add_bdev() call which updates both the OMAP and local states.

@gbregman gbregman self-assigned this Nov 22, 2023
@gbregman
Copy link
Contributor Author

Looking deeper into the code I see that when the update is over we run:

                # Update local state and version
                self.local.reset(omap_state_dict)
                self.omap.set_local_version(omap_version)
                self.logger.debug("Update complete.")

which sets the local state to be identical to the OMAP one.

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

No branches or pull requests

1 participant