Visitar URL original
Rework tracking of original VM properties for migration and stateful snapshots/stop by stgraber · Pull Request #3181 · lxc/incus · GitHub
Skip to content

Rework tracking of original VM properties for migration and stateful snapshots/stop - #3181

Merged
stgraber merged 7 commits into
lxc:mainfrom
stgraber:main
Apr 16, 2026
Merged

stgraber merged 7 commits into
lxc:mainfrom
stgraber:main

Conversation

@stgraber

Copy link
Copy Markdown
Member

No description provided.

@github-actions github-actions Bot added the Documentation Documentation needs updating label Apr 16, 2026
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>

@bensmrs bensmrs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. A few points I don’t fully get.

func (d *qemu) getBootState() (*qemuBootState, error) {
// Prepare a new state struct.
bs := qemuBootState{
Version: -1,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why -1 instead of 0 if the first “new” version is 1?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The thought behind -1 and skipping 0 was that -1 would clearly detect any scenario where we didn't unpack an actual state struct from JSON but instead used the fallback logic.

Avoiding 0 was to avoid accidents as an uninitialized struct would have the field default to 0.


// Record the QEMU machine definition.
if !stateful {
if !stateful && d.CanLiveMigrate() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why the new guard? To avoid computing useless things?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, exactly, the machine type is only ever used during live migration or stateful snapshot restore (unlike some of the other bits of the boot state that we access in other functions during startup), so we can save ourselves a QMP roundtrip on systems where migration isn't useful.

@stgraber
stgraber merged commit 1ad05bc into lxc:main Apr 16, 2026
105 of 108 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation Documentation needs updating

Development

Successfully merging this pull request may close these issues.

2 participants