server: machine init is inconsistent about the names it puts in its DeviceMap
Closed this issue · 0 comments
Observed while reading this code for other purposes.
struct MachineInitializer
has a DeviceMap
field into which it inserts the devices that will receive instance lifecycle notifications. These names are important in part because they are used as keys to associate components with each other during live migration. This means that the source and target must always agree on what gets put in the instance_name
field of each migrate::Device
that gets generated when a source serializes its device state.
Some MachineInitializer
functions (e.g. initialize_uart
) use the component names in the instance's spec as keys in the DeviceMap
, but most of them (e.g. storage/network devices) generate a name from other properties of the component (e.g. its PCI BDF). The chosen names are derived from component properties like PCI BDFs that are kept stable across migrations, but it's still possible for the source and target to disagree on how these names should be derived, which breaks migration.
In a world where components an instance spec have strong unique identifiers (see #772) and where migration targets might get their device configurations from their sources, it seems like it would also be good to standardize on these IDs: the ID a component has in the spec is also the ID it uses when pairing payloads to components during a migration (with logging affordances to easily match IDs to logical devices if we're debugging a migration issue).