vmm: api: Fix image_type in OpenAPI definition by liuw · Pull Request #7734 · cloud-hypervisor/cloud-hypervisor · GitHub
Skip to content

vmm: api: Fix image_type in OpenAPI definition#7734

Merged
rbradford merged 1 commit intocloud-hypervisor:mainfrom
liuw:openapi-image-type
Feb 21, 2026
Merged

vmm: api: Fix image_type in OpenAPI definition#7734
rbradford merged 1 commit intocloud-hypervisor:mainfrom
liuw:openapi-image-type

Conversation

@liuw
Copy link
Copy Markdown
Member

@liuw liuw commented Feb 20, 2026

It is reported OpenAPI tool handles this snippet wrong.

    image_type:
      type: enum ["FixedVhd", "Qcow2", "Raw", "Vhdx"]

The code generator tool doesn’t complain, generates code that uses a hypothetical enum type, but then it doesn’t define that enum:

# github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/cloud-hypervisor/client
../../virtcontainers/pkg/cloud-hypervisor/client/model_disk_config.go:35:21: undefined: EnumFixedVhdQcow2RawVhdx
../../virtcontainers/pkg/cloud-hypervisor/client/model_disk_config.go:600:37: undefined: EnumFixedVhdQcow2RawVhdx
../../virtcontainers/pkg/cloud-hypervisor/client/model_disk_config.go:602:11: undefined: EnumFixedVhdQcow2RawVhdx
../../virtcontainers/pkg/cloud-hypervisor/client/model_disk_config.go:610:41: undefined: EnumFixedVhdQcow2RawVhdx
../../virtcontainers/pkg/cloud-hypervisor/client/model_disk_config.go:627:37: undefined: EnumFixedVhdQcow2RawVhdx

Change the definition to follow how other enums are define. The example we use is the state field under VmInfo.

We should backport this to v50 and v51.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
@liuw liuw requested a review from a team as a code owner February 20, 2026 23:55
@liuw
Copy link
Copy Markdown
Member Author

liuw commented Feb 20, 2026

image_type:
type: enum ["FixedVhd", "Qcow2", "Raw", "Vhdx"]
type: string
enum: [FixedVhd, Qcow2, Raw, Vhdx, Unknown]
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.

We had a discussion on this during the code review from the private fork. Since the openapi validator test passed, we thought it would be valid and a stricter syntax... cc @rbradford

@likebreath
Copy link
Copy Markdown
Member

We should backport this to v50 and v51.

Right. This needs backporting.

@danmihai1
Copy link
Copy Markdown

Waiting for @danmihai1 to confirm if this is the right snippet.

@liuw , @likebreath , Kata is working for me again after this change. When the revised v51 will become available, I will pick it up into Kata.

Thanks!

@rbradford rbradford merged commit 52b2ebb into cloud-hypervisor:main Feb 21, 2026
42 of 43 checks passed
@likebreath likebreath mentioned this pull request Feb 22, 2026
@likebreath
Copy link
Copy Markdown
Member

@liuw liuw deleted the openapi-image-type branch February 24, 2026 22:49
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