Skip to content

Conversation

@yaroslavborbat
Copy link
Member

@yaroslavborbat yaroslavborbat commented Mar 20, 2025

Description

Add firmware handler

Add 2 new metric

  • d8_virtualization_virtualmachine_info
  • d8_virtualization_virtualmachine_firmware_up_to_date

Why do we need it, and what problem does it solve?

What is the expected result?

Checklist

  • The code is covered by unit tests.
  • e2e tests passed.
  • Documentation updated according to the changes.
  • Changes were tested in the Kubernetes cluster manually.

Changelog entries

section: vm
type: feature
summary: Add firmware version in virtual machine status

@yaroslavborbat yaroslavborbat added this to the v0.17.0 milestone Mar 20, 2025
@yaroslavborbat yaroslavborbat force-pushed the feat/vm/firmware-handler branch 2 times, most recently from ef812f6 to f4ad3ff Compare March 24, 2025 15:08
@yaroslavborbat yaroslavborbat marked this pull request as ready for review March 24, 2025 17:35
@yaroslavborbat yaroslavborbat force-pushed the feat/vm/firmware-handler branch from 13bb65f to 52c2ae2 Compare March 24, 2025 22:49
Signed-off-by: Yaroslav Borbat <[email protected]>
Signed-off-by: Yaroslav Borbat <[email protected]>
@yaroslavborbat yaroslavborbat force-pushed the feat/vm/firmware-handler branch from 30f5abc to f5b8c4b Compare March 24, 2025 23:05
Signed-off-by: Yaroslav Borbat <[email protected]>
Signed-off-by: Yaroslav Borbat <[email protected]>
z9r5
z9r5 previously approved these changes Mar 25, 2025
Signed-off-by: Yaroslav Borbat <[email protected]>
TypeFilesystemFrozen Type = "FilesystemFrozen"
TypeSizingPolicyMatched Type = "SizingPolicyMatched"
TypeSnapshotting Type = "Snapshotting"
TypeFirmwareNeedUpdate Type = "FirmwareNeedUpdate"
Copy link
Contributor

Choose a reason for hiding this comment

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

The reason violates the rules of the English language.

Copy link
Member Author

Choose a reason for hiding this comment

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

I replaced it with FirmwareUpdateRequired. Is that okay?
I don’t like how FirmwareUpdateNeeded sounds.

ReasonPodConditionMissing Reason = "PodConditionMissing"
ReasonGuestNotRunning Reason = "GuestNotRunning"

ReasonFirmwareNeedUpdate Reason = "FirmwareNeedUpdate"
Copy link
Contributor

Choose a reason for hiding this comment

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

Cover with doc comments

Copy link
Member Author

Choose a reason for hiding this comment

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

FirmwareUpdateRequired


if kvvmi == nil || kvvmi.Status.LauncherContainerImageVersion == f.firmwareImage {
// If kvvmi does not exist, update the firmware version,
// as any newly created kvvmi will use the currently available firmware version.
Copy link
Contributor

Choose a reason for hiding this comment

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

"Can we guarantee this? What if the virt-controller has been updated, but the virt-operator hasn't yet? In that case, the virtual machine will start with the old firmware, but the version will already be the new one.

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right. Currently, we cannot guarantee that our controller and KubeVirt are using the same configuration. A possible solution could be to introduce a special wait for the readiness of KubeVirt components during startup.

return edition
import "golang.org/x/mod/semver"

const MainVersion = "main"
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not clear why we need this const. Is it for debugging? Maybe it should be taken from firmware.yaml as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

main is valid version for firmware. This const used in IsValid and IsMain methods in Version struct

@@ -0,0 +1,3 @@
# Don't touch! Generating in CI
Copy link
Contributor

Choose a reason for hiding this comment

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

There are two firmware.yaml files in the repo. Do we need both of them? If yes, add comments why

Copy link
Member Author

Choose a reason for hiding this comment

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

There are two version_map.yml files in the repo, and both are needed:
The first one is should be generated in CI and copied during the build.
The second one is required for local builds and to prevent Go from complaining about a missing embedded file.

Copy link
Contributor

@Isteb4k Isteb4k left a comment

Choose a reason for hiding this comment

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

It's necessary to sync the PR with ADR.

Signed-off-by: Yaroslav Borbat <[email protected]>
Signed-off-by: Yaroslav Borbat <[email protected]>
@yaroslavborbat yaroslavborbat force-pushed the feat/vm/firmware-handler branch from 54fd922 to dbe540a Compare March 25, 2025 18:22
Signed-off-by: Yaroslav Borbat <[email protected]>
@yaroslavborbat
Copy link
Member Author

design changed

@yaroslavborbat yaroslavborbat marked this pull request as draft March 26, 2025 12:16
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.

4 participants