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 virtiofs file sharing support to the libvirt machine driver #101

Merged
merged 8 commits into from
Aug 2, 2022

Commits on Jul 27, 2022

  1. Don't set IO/Cache in DomainDiskDriver

    We can let libvirt/QEMU figure out the best value to use.
    Cache has always been set to 'default' anyway, and IO is set to
    'threads', I don't think tweaking it makes a significant difference in
    CRC's usecases (?)
    cfergeau committed Jul 27, 2022
    Configuration menu
    Copy the full SHA
    bbdedfe View commit details
    Browse the repository at this point in the history
  2. gomod: Switch to go 1.17

    cfergeau committed Jul 27, 2022
    Configuration menu
    Copy the full SHA
    0e69eb7 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    60b4151 View commit details
    Browse the repository at this point in the history
  4. Add filesharing support

    This adds the required libvirt XML in order to share the host directories
    listed in SharedDirs.
    This will be made conditional on virtiofs support availability in the
    next commits.
    cfergeau committed Jul 27, 2022
    Configuration menu
    Copy the full SHA
    7c8dd4f View commit details
    Browse the repository at this point in the history
  5. Split connectGetDomainCapabilities

    This adds a getBestGuestFromCaps helper which will be reused in the next
    commits.
    cfergeau committed Jul 27, 2022
    Configuration menu
    Copy the full SHA
    6af86d7 View commit details
    Browse the repository at this point in the history

Commits on Jul 28, 2022

  1. virtiofs: Error out if libvirt/QEMU support is missing

    On older systems (RHEL7), virtiofs is not necessarily present.
    This commit uses virsh domcapabilities to detect if virtiofs is
    supported, and returns an error if not.
    cfergeau committed Jul 28, 2022
    Configuration menu
    Copy the full SHA
    476ab0c View commit details
    Browse the repository at this point in the history

Commits on Aug 1, 2022

  1. update the expected domain xml in unit test

    since IO/Cache is not set in DomainDiskDriver anymore
    those are removed from the expected domain xml
    anjannath committed Aug 1, 2022
    Configuration menu
    Copy the full SHA
    c2f58f4 View commit details
    Browse the repository at this point in the history
  2. fix failing unit test TestTemplating

    the unit test TestTemplating is failing because the virtiofsSupported
    check depends on a having a connection to an actual libvirt daemon
    which is not present while running the unit tests
    
    as a workaround, since we are not testing the virtiofs functionality
    in unit tests, we call virtiofsSupported only when shared directories
    are requested
    
    this fixes the following error in test:
    ```
    --- FAIL: TestTemplating (0.00s)
    panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    	panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x542294]
    
    goroutine 20 [running]:
    testing.tRunner.func1.2({0x65f1a0, 0xa269d0})
    	/usr/lib/golang/src/testing/testing.go:1389 +0x24e
    testing.tRunner.func1()
    	/usr/lib/golang/src/testing/testing.go:1392 +0x39f
    panic({0x65f1a0, 0xa269d0})
    	/usr/lib/golang/src/runtime/panic.go:838 +0x207
    github.com/libvirt/libvirt-go.(*Connect).GetCapabilities.func1(0x7f3a0c5f1fff?)
    	/go/src/github.com/code-ready/machine-driver-libvirt/vendor/github.com/libvirt/libvirt-go/connect.go:493 +0x14
    github.com/libvirt/libvirt-go.(*Connect).GetCapabilities(0x7f3a0a95bb00?)
    	/go/src/github.com/code-ready/machine-driver-libvirt/vendor/github.com/libvirt/libvirt-go/connect.go:493 +0x1d
    github.com/code-ready/machine-driver-libvirt/pkg/libvirt.getBestGuestFromCaps(0x7f3a3c21c758?)
    	/go/src/github.com/code-ready/machine-driver-libvirt/pkg/libvirt/libvirt.go:268 +0x2b
    github.com/code-ready/machine-driver-libvirt/pkg/libvirt.virtiofsSupported(0xc000040ef0?)
    	/go/src/github.com/code-ready/machine-driver-libvirt/pkg/libvirt/domain.go:162 +0x30
    github.com/code-ready/machine-driver-libvirt/pkg/libvirt.domainXML(0xc0000e3ef0, {0x6b1498, 0x3})
    	/go/src/github.com/code-ready/machine-driver-libvirt/pkg/libvirt/domain.go:122 +0x9dc
    github.com/code-ready/machine-driver-libvirt/pkg/libvirt.TestTemplating(0xc000087ba0?)
    	/go/src/github.com/code-ready/machine-driver-libvirt/pkg/libvirt/domain_test.go:12 +0x1b9
    testing.tRunner(0xc000126000, 0x6c8730)
    	/usr/lib/golang/src/testing/testing.go:1439 +0x102
    created by testing.(*T).Run
    	/usr/lib/golang/src/testing/testing.go:1486 +0x35f
    FAIL	github.com/code-ready/machine-driver-libvirt/pkg/libvirt	0.012s
    FAIL
    ```
    anjannath committed Aug 1, 2022
    Configuration menu
    Copy the full SHA
    cf443cd View commit details
    Browse the repository at this point in the history