Skip to content

filter vmm table for active instances#5845

Merged
internet-diglett merged 4 commits into
mainfrom
bugfix-v2p-mapping-view
May 31, 2024
Merged

filter vmm table for active instances#5845
internet-diglett merged 4 commits into
mainfrom
bugfix-v2p-mapping-view

Conversation

@internet-diglett

@internet-diglett internet-diglett commented May 31, 2024

Copy link
Copy Markdown
Contributor

We needed to add a filter to the view that prevents v2p mappings for inactive instances from showing up in the v2p_mapping view.

@internet-diglett internet-diglett requested a review from smklein May 31, 2024 21:43
Comment thread schema/crdb/dbinit.sql
JOIN omicron.public.sled s ON vmm.sled_id = s.id
WHERE n.time_deleted IS NULL
AND n.kind = 'instance'
AND (vmm.state = 'running' OR vmm.state = 'starting')

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we care that "rebooting" states will not be included here? Or are you okay having V2P rules basically ignore these instances until they start running?

@gjcolombo gjcolombo May 31, 2024

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Relatedly, this requires the instance state machine to be very careful to ensure that during a migration, the target VMM doesn't leave the Migrating state until we're sure that the instance is actually going to move there (and, similarly, when it does move the source needs to have moved out of the Running state). If we don't follow those rules, this query might match multiple VMMs and so return multiple rows. This could lead to, e.g., cutting out connectivity too soon during a migration (if both the source's and target's entries show up and the latter is given precedence).

I think it might be simpler to change the join so that it unambiguously chooses the instance's current active VMM:

SELECT <columns>
FROM network_interface n
JOIN omicron.public.instance instance ON n.parent_id = instance.id
JOIN omicron.public.vmm vmm ON vmm.id = instance.active_propolis_id
JOIN omicron.public.sled s ON vmm.sled_id = s.id
-- gjc: other JOIN conditions elided for brevity

This way no one has to worry about the order in which states are reached during a migration--when migration actually finishes, the active_propolis_id will get updated, and we can trigger a new query to get the instance's new location. WDYT?

(cc @hawkw as well for the lifecycle implications.)

@internet-diglett internet-diglett enabled auto-merge (squash) May 31, 2024 22:15
@internet-diglett internet-diglett merged commit 6dee6ee into main May 31, 2024
@internet-diglett internet-diglett deleted the bugfix-v2p-mapping-view branch May 31, 2024 22:38
hawkw pushed a commit that referenced this pull request May 31, 2024
We needed to add a filter to the view that prevents v2p mappings for
inactive instances from showing up in the v2p_mapping view.
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.

3 participants