-
Notifications
You must be signed in to change notification settings - Fork 55
Conversation
pkg/pmem-device-manager/pmd-lvm.go
Outdated
@@ -287,3 +295,86 @@ func getVolumeGroups(groups []string) ([]vgInfo, error) { | |||
|
|||
return vgs, nil | |||
} | |||
|
|||
func createNS(r *ndctl.Region, uselimit uint) error { |
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 logic in this function is complex enough that we should have a unit test which covers different scenarios.
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 particular code was authored by @okartau. I just moved the existing code from pmem-ns-init.go
to here.
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.
Then tests were already missing before. Now would still be a good time to add them.
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.
Tests for this part of code is a bit complicated as the code depends on underlined PMEM hardware region properties(size, interleaves, max extent). Current LVM unit tests are run on a pre-populated logical volume groups.
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 approach for cases like this is to introduce an interface and then test the code with a mock implementation of the interface.
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 approach for cases like this is to introduce an interface and then test the code with a mock implementation of the interface.
@pohly Seems like it's a bigger effort, do you mind to deal this separately.
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.
Okay. Please file an issue to track it.
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.
Filed #692
74e1179
to
361029e
Compare
As we are using 'shared/Bidirectional' mounts for LVM driver also, we could create the needed physical devices(namespaces, volume groups) in the same driver session. This invalidates the usage of init-containers. Few advantages of merging the init-containers functionality to driver code: - smaller container image size - allows us to implement features that are common to both modes(ex: pmemPercentage) FIXES intel#532
361029e
to
5365a34
Compare
As we are using 'shared/Bidirectional' mounts for LVM driver also, we
could create the needed physical devices(namespaces, volume groups) in
the same driver session. This invalidates the usage of init-containers.
Few advantages of merging the init-containers functionality to driver code:
pmemPercentage)
FIXES #532