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

Add vf.VirtualMachine and vf.VirtualMachineConfiguration types #112

Merged
merged 5 commits into from
Mar 15, 2024

Conversation

cfergeau
Copy link
Collaborator

This PR adds 2 new types, which hopefully will help to make the code clearer.
Some of the benefits are that Code-Hex/vz is now only imported in pkg/vf instead of being used directly in multiple places.
The REST code is also simplified.
This is preparation work for #48: the changes in the current PR will be useful for adding the path to the pty device in the REST API.

There should be no user-visible changes after this PR, just internal improvements.

It's only used in the vf package, so it can be renamed to toVzBootloader

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
All other methods are named toVz() with a lower-case 'z'

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
The rest/vf package introduces a `VzVirtualMachine` type to wrap virtual
machine interactions. This type is a struct with a
`VzVM *vz.VirtualMachine` member.

This commit makes this struct member anonymous instead of naming it
`VzVM`, this allows to remove the VzVirtualMachine state related methods
which were thin wrappers over methods with (almost) the same name
already defined in `*vz.VirtualMachine`.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
This commit renames vzVirtualMachineConfiguration to
VirtualMachineConfig.
vzVirtualMachineConfiguration was a wrapper over the Code-Hex/vz type
vz.VirtualMachineConfiguration.

VirtualMachineConfig improves vzVirtualMachineConfiguration because it
also keeps around the config.VirtualMachine go object which was used to
created the vz.VirtualMachineConfiguration object. This will be useful
in simplifying the code using the pkg/vf package.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Similarly to the vf.VirtualMachineConfiguration type introduced in the previous
commit, the vf.VirtualMachine type wraps both a vz.VirtualMachine
instance, and the vfkit/go data which was used to generate it, which is
the aforementioned VirtualMachineConfiguration type.

This allows to simplify some users of pkg/vf, in particular the rest
code. `code-hex/vz` is now only imported in pkg/vf

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Copy link

openshift-ci bot commented Mar 11, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from cfergeau. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@anjannath
Copy link
Member

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Mar 13, 2024
@praveenkumar praveenkumar merged commit e04ae65 into crc-org:main Mar 15, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants