Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

virtctl: Allow size to be optional when creating VMs #11144

Merged

Conversation

0xFelix
Copy link
Member

@0xFelix 0xFelix commented Feb 5, 2024

What this PR does

Allow to omit size when creating a VM and using --volume-import to clone a PVC or a VolumeSnapshot.

Before this PR:

Specifying size when creating a VM and using --volume-import to clone a PVC or a VolumeSnapshot was always required.

After this PR:

Specifying size when creating a VM and using --volume-import to clone a PVC or a VolumeSnapshot is optional now.

Fixes #

Why we need it and why it was done in this way

The following tradeoffs were made:

The following alternatives were considered:

Links to places where the discussion took place:

Special notes for your reviewer

Checklist

This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR.
Approvers are expected to review this list.

Release note

virtctl: Specifying size when creating a VM and using --volume-import to clone a PVC or a VolumeSnapshot is optional now

@kubevirt-bot kubevirt-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. size/M labels Feb 5, 2024
@0xFelix 0xFelix force-pushed the virtctl-volume-import-size-optional branch from 92285a4 to f35edd7 Compare February 5, 2024 11:01
@alicefr
Copy link
Member

alicefr commented Feb 5, 2024

@0xFelix a super nit, if you can split the ErrorNotFound type in a separate commit

@alicefr
Copy link
Member

alicefr commented Feb 5, 2024

The code looks good to me! Thanks for the work
/approve

@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alicefr

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 5, 2024
This allows to test whether this error occured.

Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
Allow to omit size when creating a VM and using --volume-import to clone
a PVC or a VolumeSnapshot.

Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
Copy link
Contributor

@fossedihelm fossedihelm left a comment

Choose a reason for hiding this comment

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

Thanks @0xFelix!
One super nit that you can ignore.
Feel free to unhold
/hold

Comment on lines +251 to +254
var volumeImportSizeOptional = map[string]bool{
pvc: true,
snapshot: true,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I'd prefer

Suggested change
var volumeImportSizeOptional = map[string]bool{
pvc: true,
snapshot: true,
}
var volumeImportSizeMandatory = map[string]bool{
pvc: false,
snapshot: false,
}

and save a not operation below.
But maybe it is my brain that starts burning when it see more than one negation :)

@kubevirt-bot kubevirt-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 5, 2024
@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Feb 5, 2024
@kubevirt-commenter-bot
Copy link

Required labels detected, running phase 2 presubmits:
/test pull-kubevirt-e2e-windows2016
/test pull-kubevirt-e2e-kind-1.27-vgpu
/test pull-kubevirt-e2e-kind-sriov
/test pull-kubevirt-e2e-k8s-1.29-ipv6-sig-network
/test pull-kubevirt-e2e-k8s-1.27-sig-network
/test pull-kubevirt-e2e-k8s-1.27-sig-storage
/test pull-kubevirt-e2e-k8s-1.27-sig-compute
/test pull-kubevirt-e2e-k8s-1.27-sig-operator
/test pull-kubevirt-e2e-k8s-1.28-sig-network
/test pull-kubevirt-e2e-k8s-1.28-sig-storage
/test pull-kubevirt-e2e-k8s-1.28-sig-compute
/test pull-kubevirt-e2e-k8s-1.28-sig-operator

@0xFelix
Copy link
Member Author

0xFelix commented Feb 6, 2024

/hold cancel

Discussed this offline, will keep as is.

@0xFelix
Copy link
Member Author

0xFelix commented Feb 6, 2024

/retest

@kubevirt-bot kubevirt-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 6, 2024
@kubevirt-bot kubevirt-bot merged commit ab98584 into kubevirt:main Feb 6, 2024
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants