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

reorganize virtwrap/cache NamespaceKey functions #354

Merged
merged 4 commits into from
Aug 7, 2017

Conversation

mpolednik
Copy link
Contributor

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.

@kubevirt-bot
Copy link
Contributor

Can one of the admins verify this patch?

@mpolednik
Copy link
Contributor Author

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?

Copy link
Member

@rmohr rmohr left a 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.

@@ -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))
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

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!

@rmohr
Copy link
Member

rmohr commented Aug 3, 2017

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?

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>
@mpolednik
Copy link
Contributor Author

Took a bit longer approach to the move. The PR now contains commit that

  1. split libvirt client code from manager.go to virtwrap/cli/libvirt.go,
  2. moves errors under virtwrap/errors package,
  3. moves VMNamespace funcs to the cache package.

@rmohr
Copy link
Member

rmohr commented Aug 4, 2017

ok to test

Copy link
Member

@rmohr rmohr left a 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>
Copy link
Member

@rmohr rmohr left a 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.

@rmohr rmohr requested a review from davidvossel August 7, 2017 12:23
Copy link
Member

@davidvossel davidvossel left a comment

Choose a reason for hiding this comment

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

great stuff!

@rmohr rmohr merged commit 8777a0d into kubevirt:master Aug 7, 2017
kubevirt-bot pushed a commit to kubevirt-bot/kubevirt that referenced this pull request Nov 6, 2020
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.

None yet

4 participants