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 utility function for sharing files into UVMs from the host #907

Merged
merged 1 commit into from
Dec 18, 2020

Conversation

katiewasnothere
Copy link
Contributor

This PR refactors out sharing files in the UVM into a new call on the UtilityVM. This allows us to make a more generic call that can be used later on for adding files for both LCOW and WCOW.

This will be used later on in the dynamic resources work.

Signed-off-by: Kathryn Baldauf [email protected]

@katiewasnothere katiewasnothere requested a review from a team as a code owner December 10, 2020 01:59
internal/uvm/share.go Outdated Show resolved Hide resolved
Copy link
Contributor

@dcantah dcantah left a comment

Choose a reason for hiding this comment

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

LGTM

@katiewasnothere
Copy link
Contributor Author

@kevpar PTAL if you can, I'm curious what you're feedback on this change would be.

if _, err := uvm.GetVSMBUvmPath(ctx, reqHostPath, readOnly); err == ErrNotAttached {
// share file has not been added yet, add it now
options := uvm.DefaultVSMBOptions(readOnly)
vsmbShare, err := uvm.AddVSMB(ctx, reqHostPath, options)
Copy link
Member

Choose a reason for hiding this comment

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

We should probably always call AddVSMB, even if the share is already added. If we want to support removing a share in the future, we will want actual calls to AddVSMB each time, so the ref-counting works out.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Wrote this a while ago so I'm not sure why I added that extra check, but removed.

return err
}
defer func() {
if retErr != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Can we use err for the return value or do we need the different name for some reason?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just used retErr so I didn't get confused but it's not needed

Copy link
Member

@kevpar kevpar left a comment

Choose a reason for hiding this comment

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

Couple of comments, otherwise looks fine.

Copy link
Contributor

@dcantah dcantah left a comment

Choose a reason for hiding this comment

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

lgtm... again :)

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.

3 participants