-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
reorganize virtwrap/cache NamespaceKey functions #354
Conversation
Can one of the admins verify this patch? |
Maybe point for discussion: I'm thinking of moving the libvirt connection handling under cache while leaving the manager (KillVM, SyncVM, iface, helpers) stay in virtwrap. Opinions? |
59c78c7
to
4c6a0d0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The move of the key function is good, one comment on the function renaming.
pkg/virt-handler/rest/console.go
Outdated
@@ -52,7 +52,7 @@ func (t *Console) Console(request *restful.Request, response *restful.Response) | |||
namespace := request.PathParameter("namespace") | |||
vm := v1.NewVMReferenceFromNameWithNS(namespace, vmName) | |||
log := logging.DefaultLogger().Object(vm) | |||
domain, err := t.connection.LookupDomainByName(virtwrap.VMNamespaceKeyFunc(vm)) | |||
domain, err := t.connection.LookupDomainByName(virtwrap.VmNamespaceKeyFunc(vm)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Go uses VMNamespaceKeyFunc, see https://github.com/golang/go/wiki/CodeReviewComments#initialisms
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, couldn't find this source. Will drop the renaming for sure!
Maybe moving it to a cli package alongside cache? |
The errors can live in their own package to avoid circular dependencies inside (and even outside of) virtwrap. Signed-off-by: Martin Polednik <mpolednik@redhat.com>
4c6a0d0
to
3d982d3
Compare
Took a bit longer approach to the move. The PR now contains commit that
|
3d982d3
to
e054790
Compare
ok to test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ups a small error. I was wondering why the code coverage decreased so much. The reason is, that there is no test-suit entrypoint anymore in virtwrap.
You need to run gingko bootstrap
in the virtwrap folder.
The file manager.go was contained two loosely related themes of functionality: the DomainManager and some libvirt connectivity. The libvirt part can be isolated under cli, allowing us to treat is just as another client within KubeVirt. Signed-off-by: Martin Polednik <mpolednik@redhat.com>
k8s/meta/v1 was imported twice under different names, there is no reason to have such pollution in the namespace at the moment. Signed-off-by: Martin Polednik <mpolednik@redhat.com>
Mirroring the k8s client, VMNamespaceKeyFunc and SplitVMNamespaceKey should belong together under one package. Cache was chosen as it is that way in k8s/client-go. Signed-off-by: Martin Polednik <mpolednik@redhat.com>
e054790
to
85b8a4f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The usual CI test failing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great stuff!
Add regular PVC creation e2e test.
The functions had two issues: they had been placed in different packages and didn't really follow golang's naming convention. This PR solves both, moving the functions to virtwrap package.
The final destination should be the cache package, but that requires more refactoring to avoid cyclic imports.