-
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
refactor: virtwrap: remove/improve some code #11548
Changes from 1 commit
565a30e
b40f027
574a7ff
55cb71c
ebbfa47
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -172,12 +172,18 @@ func indexedDomainInterfaces(domain *api.Domain) map[string]api.Interface { | |
return domainInterfaces | ||
} | ||
|
||
type SetDomainFunc func(*v1.VirtualMachineInstance, *api.DomainSpec) (cli.VirDomain, error) | ||
|
||
// withNetworkIfacesResources adds network interfaces as placeholders to the domain spec | ||
// to trigger the addition of the dependent resources/devices (e.g. PCI controllers). | ||
// As its last step, it reads the generated configuration and removes the network interfaces | ||
// so none will be created with the domain creation. | ||
// The dependent devices are left in the configuration, to allow future hotplug. | ||
func withNetworkIfacesResources(vmi *v1.VirtualMachineInstance, domainSpec *api.DomainSpec, f func(v *v1.VirtualMachineInstance, s *api.DomainSpec) (cli.VirDomain, error)) (cli.VirDomain, error) { | ||
func withNetworkIfacesResources( | ||
vmi *v1.VirtualMachineInstance, | ||
domainSpec *api.DomainSpec, | ||
f SetDomainFunc, | ||
) (cli.VirDomain, error) { | ||
Comment on lines
+182
to
+186
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The linter is configured to allow line lengths up to 140 [1]. Now that the function type is used, do we exceed it? [1] https://github.com/kubevirt/kubevirt/blob/main/.golangci.yml#L50 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah! We do have an agreed line length limit! That's great, I can point it out to people now! :) To your question, I don't think we exceed after using function type but I'll double check and revert the change if it is still <= 140 chars per line. Thanks! |
||
domainSpecWithIfacesResource := appendPlaceholderInterfacesToTheDomain(vmi, domainSpec) | ||
dom, err := f(vmi, domainSpecWithIfacesResource) | ||
if err != nil { | ||
|
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.
Does it need to be exposed?
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.
No, I'll change it