Skip to content

vmm: prepare removal of bdf_device serde workaround - #223

Open
phip1611 wants to merge 1 commit into
cyberus-technology:gardenlinuxfrom
phip1611:grdnlnx-serde
Open

phip1611 wants to merge 1 commit into
cyberus-technology:gardenlinuxfrom
phip1611:grdnlnx-serde

Conversation

@phip1611

@phip1611 phip1611 commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

This is a trivial quick win and aligns with our goal to remove more fork-only quirks soon.

There is no risk and this is the right thing to do.

libvirt companion OR: https://gitlab.cyberus-technology.de/cyberus/cloud/libvirt/-/merge_requests/313

(both PRs are independend tho, as CH in any way supports both names)

Ticket: https://github.com/cobaltcore-dev/cobaltcore/issues/747

Steps to Undraft

  • I tested this in libvirt nixos tests

@phip1611 phip1611 self-assigned this Nov 5, 2026
Comment thread vmm/src/vm_config.rs
pub iommu: IommuType,
#[serde(default)]
pub pci_segment: u16,
#[serde(default, alias = "pci_device_id", rename = "bdf_device")]

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.

hint for reviewers: my old alignment commit was wrong from the very beginning. there was no good reason to keep bdf_device, neither generally nor for libvirt.

We now have a clear old->new migration path.

@phip1611
phip1611 marked this pull request as draft November 5, 2026 17:53
Comment thread vmm/src/vm_config.rs Outdated
Comment on lines +444 to +448
// Alias is technical debt from our fork. Once the previous version
// is fully rolled out, we can remove this for migration. However, there
// might be old snapshots that would not restore without this.
// Remove with caution.
#[serde(default, alias = "bdf_device")]

@Coffeeri Coffeeri Nov 6, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This can be boiled down to a oneliner, e.g. (the release is exemplary, I have not verified since when this is the case):

Suggested change
// Alias is technical debt from our fork. Once the previous version
// is fully rolled out, we can remove this for migration. However, there
// might be old snapshots that would not restore without this.
// Remove with caution.
#[serde(default, alias = "bdf_device")]
// `bdf_device` is the name used by gardenlinux-release-26-06-16 and later.
#[serde(default, alias = "bdf_device")]

@phip1611 phip1611 Nov 6, 2026 •

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.

Thanks! I'd favor a middle ground: Say from when to when the old name is used and keep the warning

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yep, that would be great!

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.

I decided for a different more verbose wording. I want us to be very careful with removing this because of old snapshots. The comment must make this clear.

Comment thread vmm/src/vm_config.rs
@@ -441,7 +441,11 @@ pub struct PciDeviceCommonConfig {
pub iommu: IommuType,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In the commit message:

I made a mistake and made things more complicated than necessary.

Could you please elaborate explicitly on what was unnecessarily complicated? Is this just that we wouldn't have needed rename?

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.

Yes, we could have used pci_device_id right from the beginning and would have just needed the alias.

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.

reworded

cyberus-renovate pushed a commit to cyberus-technology/libvirt that referenced this pull request Nov 6, 2026
This aligns the code with upstream CH. CH accepts both names and
currently still prefers bdf_device but this changes soon [0].

[0] cyberus-technology/cloud-hypervisor#223

On-behalf-of: SAP philipp.schuster@sap.com
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
In "vmm: pci: rename pci_device_id -> bdf_device" [0] I made things more
complicated then necessary: we could have use this change right away.
Next, the actual way forward is to use an alias so that old->new works
but new snapshots use the new name.

Once the whole fleet has this, the commit could be dropped. However, we
might want to keep it for longer (half a year?) as old snapshots need to
be restored as well.

There is no risk here. libvirt/ch works with both variants for the
time being.

[0] 3580b9f

On-behalf-of: SAP philipp.schuster@sap.com
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
@phip1611
phip1611 marked this pull request as ready for review November 9, 2026 15:23
@olivereanderson

olivereanderson commented Nov 9, 2026 •

Copy link
Copy Markdown

Question: If new snapshots use the new name, will that then not cause problems when migrating from a new instance to an old? (Or is that not something our customer needs to do?)

@phip1611

phip1611 commented Nov 9, 2026 •

Copy link
Copy Markdown
Member Author

Question: If new snapshots use the new name, will that then not cause problems when migrating from a new instance to an old? (Or is that not something our customer needs to do?)

Thanks for thinking about corner cases! We are safe, tho

  • We never migrate new to old in production
  • It would work anyway as the deployed (=old) version has the code that I remove here (#[serde(default, alias = "pci_device_id", rename = "bdf_device")])

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