kubevirt / kubernetes-device-plugins

Incubating: A number of Kubernetes device-plugins developed and useful for KubeVirt
MIT License
44 stars 37 forks source link

Failed to build vfio #62

Closed x8091 closed 4 years ago

x8091 commented 5 years ago

I am trying to compiling vfio module, but got following error: cd cmd/vfio && go fmt && go vet && go install -v vet: ./vfio.go:46:28: cannot use (pci.PCILister literal) (value of type pci.PCILister) as dpm.ListerInterface value in argument to dpm.NewManager: wrong type for method Discover Makefile:20: recipe for target 'build-vfio' failed make: *** [build-vfio] Error 2

Please help to check

phoracek commented 5 years ago

Hello @x8091. Was it failing before? We recently tagged a new version of https://github.com/kubevirt/device-plugin-manager. In this new version we use beta version of Device Plugin API (instead of alpha). I would guess it is this change which causes VFIO DP to fail.

We have two options, either to lock device-plugin-manager version in Gopkg.toml to v1.9.2 or make the code of plugins kept in this repository compatible with v1.10.0, I don't mind neither. Please send a PR with the prefered option.

x8091 commented 5 years ago

Thanks. I changed as your suggestion:

diff --git a/Gopkg.toml b/Gopkg.toml
index 9656eaf6..117c0b88 100644
--- a/Gopkg.toml
+++ b/Gopkg.toml
@@ -34,6 +34,6 @@
   name = "github.com/kubevirt/device-plugin-manager"

 [[constraint]]
-  version = "~v1.10"
+  version = "v1.9.2"
   name = "k8s.io/kubernetes"

diff --git a/vendor/github.com/kubevirt/device-plugin-manager/Gopkg.toml b/vendor/github.com/kubevirt/device-plugin-manager/Gopkg.toml
index 19bec1e6..5ac11045 100644
--- a/vendor/github.com/kubevirt/device-plugin-manager/Gopkg.toml
+++ b/vendor/github.com/kubevirt/device-plugin-manager/Gopkg.toml
@@ -8,8 +8,8 @@

 [[constraint]]
   name = "google.golang.org/grpc"
-  version = "1.10.0"
+  version = "1.9.2"

 [[constraint]]
   name = "k8s.io/kubernetes"
-  version = "1.10.0"
+  version = "1.9.2"

But it still fails to compile:

./vfio.go:46:41: cannot use pci.PCILister literal (type pci.PCILister) as type "github.com/kubevirt/device-plugin-manager/pkg/dpm".ListerInterface in argument to "github.com/kubevirt/device-plugin-manager/pkg/dpm".NewManager:
    pci.PCILister does not implement "github.com/kubevirt/device-plugin-manager/pkg/dpm".ListerInterface (wrong type for Discover method)
        have Discover(chan "github.com/kubevirt/kubernetes-device-plugins/vendor/github.com/kubevirt/device-plugin-manager/pkg/dpm".PluginNameList)
        want Discover(chan "github.com/kubevirt/device-plugin-manager/pkg/dpm".PluginNameList)
make: *** [build-vfio] Error 2
phoracek commented 5 years ago

@x8091 I think it maybe it an issue in your Go environment. I cloned the master and ran make build docker-build and it all passed fine (without any dependencies changed). Would you think that is possible?

x8091 commented 5 years ago

I tried on 2 machines (MacOS and Ubuntu1804) with go1.12.1 I have been using it for several projects, so I don't think it's causing compile issue. BTW, Can you check the diff I mentioned above? I found 4 files in the repo:

modified:   Gopkg.lock
modified:   Gopkg.toml
modified:   vendor/github.com/kubevirt/device-plugin-manager/Gopkg.lock
modified:   vendor/github.com/kubevirt/device-plugin-manager/Gopkg.toml

not sure which files you're referring to.

phoracek commented 5 years ago

You should not edit anything under vendor/ manually. I updated version of deps on both the plugin-manager and this repo in https://github.com/kubevirt/kubernetes-device-plugins/pull/63. Could you please check if the PR works better for you? It passes on my laptop and on Travis CI.

x8091 commented 5 years ago

Thanks @phoracek. I pulled your PR

commit 71329bae204b6a733a0d2cc565abbd6e76feff28 (HEAD -> master)
Author: Petr Horacek <phoracek@redhat.com>
Date:   Fri Oct 18 16:32:22 2019 +0200

    update dependencies

    Use newer Go and Kubernetes.

    Signed-off-by: Petr Horacek <phoracek@redhat.com>

commit 98fda99e06db30cf815ef14ffdbb5cff0f9709ee (origin/master, origin/HEAD)
Author: Nick Burrett <nick@sqrt.co.uk>
Date:   Wed Sep 18 09:50:03 2019 +0100

    Fix compile error: "Info call has possible formatting directive %s"

    Signed-off-by: Nick Burrett <nick@sqrt.co.uk>

However, compiling still failed:

~/go/src/kubernetes-device-plugins$ make build-vfio
cd cmd/vfio && go fmt && go vet && go install -v
# kubernetes-device-plugins/cmd/vfio [kubernetes-device-plugins/cmd/vfio.test]
./vfio.go:46:41: cannot use pci.PCILister literal (type pci.PCILister) as type "kubernetes-device-plugins/vendor/github.com/kubevirt/device-plugin-manager/pkg/dpm".ListerInterface in argument to "kubernetes-device-plugins/vendor/github.com/kubevirt/device-plugin-manager/pkg/dpm".NewManager:
    pci.PCILister does not implement "kubernetes-device-plugins/vendor/github.com/kubevirt/device-plugin-manager/pkg/dpm".ListerInterface (wrong type for Discover method)
        have Discover(chan "github.com/kubevirt/kubernetes-device-plugins/vendor/github.com/kubevirt/device-plugin-manager/pkg/dpm".PluginNameList)
        want Discover(chan "kubernetes-device-plugins/vendor/github.com/kubevirt/device-plugin-manager/pkg/dpm".PluginNameList)
Makefile:20: recipe for target 'build-vfio' failed
make: *** [build-vfio] Error 2

I tried on both MacOS and Ubuntu with go version go1.11 linux/amd64 and go version go1.12.1 darwin/amd64

Can you share more details about your environment and setup?

phoracek commented 5 years ago

This is super weird. I installed fresh Fedora 30 VM.

Then I installed Go 1.12.10 and other development dependencies on top of it:

dnf install -y go make

Get the DPs repository and build VFIO:

go get github.com/kubevirt/kubernetes-device-plugins
cd go/src/github.com/kubevirt/kubernetes-device-plugins/
make build-vfio

It built the binary successfully on completely fresh system. I'm not sure what could be the issue and I can't really debug it without a reproducer. Please let me know if you have an idea on how to do it.

kubevirt-bot commented 4 years ago

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

/lifecycle stale

kubevirt-bot commented 4 years ago

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

/lifecycle rotten

kubevirt-bot commented 4 years ago

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

/close

kubevirt-bot commented 4 years ago

@kubevirt-bot: Closing this issue.

In response to [this](https://github.com/kubevirt/kubernetes-device-plugins/issues/62#issuecomment-601730210): >Rotten issues close after 30d of inactivity. >Reopen the issue with `/reopen`. >Mark the issue as fresh with `/remove-lifecycle rotten`. > >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.