crc icon indicating copy to clipboard operation
crc copied to clipboard

Add CIFS/SMB based file sharing for windows

Open anjannath opened this issue 3 years ago • 8 comments
trafficstars

Needs https://github.com/code-ready/machine/pull/66

Solution/Idea

the default CIFS/SMB feature provided from windows can be used to share directories over the network we can use it to share files between host and crc vm

Adds the following config options:

  • enable-shared-dirs (was present on macOS and linux now added to windows)
  • smb-share-password

Testing

  1. use the msi from this PR to install crc
  2. run crc config set enable-shared-dirs true and follow the instructions from the validation msg (it should ask to configure smb-share-password first)
  3. run crc config set preset podman and crc setup
  4. crc start with podman preset and bundle from https://github.com/code-ready/snc/pull/565 should succeed (download from openshift CI artifacts)
  5. container with a volume mount should work, e.g: podman run -v /mnt/home/crc/conf:/etc/http/conf httpd

anjannath avatar Aug 22 '22 10:08 anjannath

still need to test on a clean vm if the msi is able to set everything up, and also verify the assumption that Private network profile has "File and Printer Sharing" enabled by default on window 10

anjannath avatar Aug 22 '22 11:08 anjannath

@gbraad PTAL

anjannath avatar Aug 24 '22 08:08 anjannath

Just based on some of the comments from Christophe I say there is still some open issues; code re-use, IP address for use, etc.

gbraad avatar Aug 30 '22 03:08 gbraad

Unable to build:

$ make cross
GOARCH=arm64 GOOS=darwin go build -tags "containers_image_openpgp" -ldflags="-X github.com/code-ready/crc/pkg/crc/version.crcVersion=2.8.0 -X github.com/code-ready/crc/pkg/crc/version.oc
pVersion=4.11.1 -X github.com/code-ready/crc/pkg/crc/version.okdVersion=4.11.0-0.okd-2022-08-20-022919 -X github.com/code-ready/crc/pkg/crc/version.podmanVersion=4.1.1 -X github.com/code-ready/crc/pkg/crc/version.commitSha=758f4f3bb " -o out/macos-arm64/crc  ./cmd/crc                                                                                                        package github.com/code-ready/crc/cmd/crc
        imports github.com/code-ready/crc/cmd/crc/cmd
        imports github.com/containers/gvisor-tap-vsock/pkg/virtualnetwork
        imports github.com/containers/gvisor-tap-vsock/pkg/services/dhcp
        imports github.com/containers/gvisor-tap-vsock/pkg/tap
        imports gvisor.dev/gvisor/pkg/tcpip
        imports gvisor.dev/gvisor/pkg/atomicbitops
        imports gvisor.dev/gvisor/pkg/state
        imports gvisor.dev/gvisor/pkg/state/wire
        imports gvisor.dev/gvisor/pkg/gohacks: build constraints exclude all Go files in /workspaces/crc/vendor/gvisor.dev/gvisor/pkg/gohacks
make: *** [Makefile:94: out/macos-arm64/crc] Error 1

on go version go1.19.1 linux/amd64 on Ubuntu it seems. Reverting to go version go1.18.3 linux/amd64 on Fedora

gbraad avatar Sep 22 '22 06:09 gbraad

on go version go1.19.1 linux/amd64 on Ubuntu it seems. Reverting to go version go1.18.3 linux/amd64 on Fedora

~yes, i think 1.18 will also have issues, we are still on go 1.17 because of https://github.com/code-ready/crc/pull/3343#issuecomment-1245099348~

~RHEL-8 still have 1.17.12 version of golang in official repo and also as part of go toolset images https://catalog.redhat.com/software/containers/ubi8/go-toolset/5ce8713aac3db925c03774d1 . Internally brew build might fails with those changes.~

This was already fixed in main by https://github.com/code-ready/crc/pull/3341 just needed needed rebase

anjannath avatar Sep 22 '22 07:09 anjannath

temp: replace code-ready/machine with anjannath/machine

why?

we need to modify the SharedDir struct, the PR: https://github.com/code-ready/machine/pull/66 on machine repo needs to be merged and then we can remove this commit

anjannath avatar Sep 23 '22 07:09 anjannath

use the msi from this PR to install crc

can you describe steps needed to test this without the MSI too? This is also suggested for: https://github.com/code-ready/crc/pull/3308#discussion_r980743590

gbraad avatar Sep 27 '22 06:09 gbraad

@cfergeau @gbraad All the review comments are addressed and changes have been made PTALA, thanks!!

anjannath avatar Sep 28 '22 06:09 anjannath

PR rebased on top of #3333

anjannath avatar Sep 29 '22 11:09 anjannath

/retest

anjannath avatar Sep 30 '22 13:09 anjannath

Approved for podman bundle Unable to test for the OpenShift bundle

tested with the new 4.11.7 openshift bundle and working as expected

anjannath avatar Oct 10 '22 08:10 anjannath

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cfergeau, gbraad

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:
  • ~~OWNERS~~ [cfergeau,gbraad]

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

openshift-ci[bot] avatar Oct 10 '22 16:10 openshift-ci[bot]

New changes are detected. LGTM label has been removed.

openshift-ci[bot] avatar Oct 11 '22 05:10 openshift-ci[bot]