-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat(virtctl): Add boot order support to create vm #9629
feat(virtctl): Add boot order support to create vm #9629
Conversation
By moving the generation of the the default VM name to setDefaults() the usage output of virtctl create vm stays the same between runs. Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
This moves the newVM func to be a method of createVM to be more consistent with the rest of the code. Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
This adds support for *uint fields to params.go. It will be useful in the next commit. Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
/cc @lyarwood |
6e578ce
to
25affe2
Compare
|
||
// getInferFromVolume returns the volume to infer the instancetype or preference from. | ||
// It returns either the disk with the lowest boot order or the first volume in the VM spec. | ||
func (c *createVM) getInferFromVolume(flag string, vm *v1.VirtualMachine) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is cool but out of scope for the commit and PR right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO it is in scope because without #9631 we always want the infer flags to infer from the volume the VM booted from. Without this method this isn't possible.
/retest |
This adds a new param 'bootorder' which allows to specify the boot order of added volumes. The param is added to the following flags: - volume-containerdisk - volume-datasource - volume-clone-pvc - volume-pvc Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
The method getInferFromVolume is added to vm.go to allow inferring instancetypes or preferences from the disk with the lowest boot order or if no boot order was specified the first volume. Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
25affe2
to
6c21c2f
Compare
/lgtm |
/retest |
@0xFelix: The following test failed, say
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
@0xFelix do we specify values like not ordered like '2' and then '4' or values greater than the total number of disks? |
@@ -243,6 +258,9 @@ func (c *createVM) usage() string { | |||
# Create a manifest for a VirtualMachine with a cloned DataSource and inferred instancetype and preference | |||
{{ProgramName}} create vm --volume-datasource=src:my-annotated-ds --infer-instancetype --infer-preference | |||
|
|||
# Create a manifest for a VirtualMachine with multiple volumes and specified boot order | |||
{{ProgramName}} create vm --volume-containerdisk=src:my.registry/my-image:my-tag --volume-datasource=src:my-ds,bootorder:1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we simply use the volume name instead on the need to specify the type of volume? The name should be unique
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The flags are not only setting the boot order of a volume but also add the volume itself. So I don't think this can be simplified any more.
@alicefr As we discovered offline it is not necessary to order the boot orders or make sure the highest boot order does not exceed the count of disks. The only required validations are:
The description here is correct: http://kubevirt.io/api-reference/v0.59.0/definitions.html#_v1_disk |
/approve |
[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 |
/retest-required |
What this PR does / why we need it:
This adds a new param
bootorder
to flags ofvirtctl create vm
,which allows to specify the boot order of added volumes.
Support for fields of type
*uint
is added toparams.go
for this.Also some refactorings are applied to
virtctl create vm
.The param is added to the following flags:
The method getInferFromVolume is added to vm.go to allow inferring
instancetypes or preferences from the disk with the lowest boot order or
if no boot order was specified the first volume.
Release note: