-
Notifications
You must be signed in to change notification settings - Fork 115
feat(uuid): add partition table uuid support #635
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
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #635 +/- ##
===========================================
- Coverage 46.58% 45.69% -0.90%
===========================================
Files 78 79 +1
Lines 3834 3889 +55
===========================================
- Hits 1786 1777 -9
- Misses 1888 1953 +65
+ Partials 160 159 -1
Continue to review full report at Codecov.
|
27508d1 to
2f61c8e
Compare
| // partition table uuid instead of create partition described in | ||
| // https://github.com/openebs/node-disk-manager/issues/621 . | ||
| // This feature must enabled with GPTBasedUUID. | ||
| PartitionTableUUID Feature = "PartitionTableUUID" |
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.
Can you add one check, to make sure this feature gets enabled only with GPTBasedUUID. The check can be added here, so that such dependent features can be checked in future also.
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.
I think you missed this comment. PTAL.
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.
@akhilerm Sorry, the here link previously point to the pkg/partition/partition.go file, so i add the feature check in that files. What the here point to exactly ?
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.
oops. sorry for that, the check should be in the feature pkg here. So everything related to features are handled there.
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.
Also, the check needed is, if PartitionTableUUID feature gate is given , we should make sure that GPTBasedUUID is also provided. The best place to make that check is in the feature pkg.
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.
OK, I get that. I will fix it!
akhilerm
left a comment
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.
@cospotato Given some comments.
Also you need to update the node-disk-manager.yaml, and run make manifests so that the updated ndm-operator.yaml is generated.
|
Hello @akhilerm ,comments resolved. |
| limitations under the License. | ||
| */ | ||
|
|
||
| package probe |
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.
@cospotato Do we need a new probe for fetching this details? Can this be included in some existing probes? WDYT?
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.
@akhilerm I think it's need this new probe to get partition table UUID by blkid. Because only the udevprobe can provide partition table UUID in the existing probes. But on CentOS 7, the host udev did not provide it. But we use the cache from host udev. So we cannot get partition table UUID with udev on CentOS 7 host.
| case features.FeatureGates.IsEnabled(features.PartitionTableUUID) && len(bd.PartitionInfo.PartitionTableType) > 0: | ||
| if len(bd.PartitionInfo.PartitionTableUUID) == 0 { | ||
| klog.Errorf("device(%s) has a partition table, but can not get partition table uuid", bd.DevPath) | ||
| break |
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.
What will happen in the following case:
- The
breakgets executed here, which means the uuid wont be generated. - NDM goes onto create a partition on the disk, but it will fail since a partition table already exists
- This will trigger a rescan and causes an infinite loop
Can we have some checks for the above case also, possibly in the eventhandler or addhandler?
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 GPT partition table without UUID is very weird. But This may be happened. Or can we ignore this disk ?
| @@ -1,3 +1,6 @@ | |||
| //go:build (linux && ignore) || cgo | |||
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.
What is this build tag used for?
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.
Sorry, this and the below line changed because of my local environment is go 1.17.1 . The gofmt cause the change. The help described this: go help
To keep a file from being considered for the build:
//go:build ignore
(any other unsatisfied word will work as well, but "ignore" is conventional.)
To build a file only when using cgo, and only on Linux and OS X:
//go:build cgo && (linux || darwin)
It just a mark make us can set the file ignore when compiling.
| @@ -1,3 +1,6 @@ | |||
| //go:build (linux && ignore) || cgo | |||
| // +build linux,ignore cgo | |||
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.
What does the ignore tag do here?
akhilerm
left a comment
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.
Commented on a few more changes.
pkg/features/features.go
Outdated
|
|
||
| // IsEnabled returns true if the feature is enabled | ||
| func (fg featureFlag) IsEnabled(f Feature) bool { | ||
| if !fg.checkRequired(f) { |
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.
This need not be checked everytime, since we set the flag to default value initially.
z0marlin
left a comment
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.
@cospotato left a few comments.
| func (bp *blkidProbe) FillBlockDeviceDetails(bd *blockdevice.BlockDevice) { | ||
| di := &blkid.DeviceIdentifier{DevPath: bd.DevPath} | ||
|
|
||
| bd.FSInfo.FileSystem = di.GetOnDiskFileSystem() |
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.
right now udevprobe and mountprobe fill the filesystem information for the device. Is this required here too?
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.
I think this can check the bd.FSInfo.FileSystem length if zero before fill 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.
@cospotato can you please add this check (check if FS is already filled by prior probes)
pkg/features/features.go
Outdated
| // disable the feature if the requirement does not meet expectations | ||
| if !checkRequirement(fg, k) { | ||
| fg[k] = false | ||
| v = false | ||
|
|
||
| klog.Warningf("Feature gate: %s required: \"%v\" dose not meet expectation, set to disable", k, requirementString(k)) | ||
| } |
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.
while using a map works in this scenario, it would break for cases when there are more complex requirements in which case we would have to do a graph traversal of sorts to determine if the requirements are satisfied. Although, I don't think feature gates will reach that complexity, do we want to consider those cases in this code? if not, then can we have some comments explaining the limitations for future reference. @akhilerm @cospotato wdyt?
an example that would break when using the above logic:
A requires B
B requires C
C is set to false by the user while B is set to true.
In this case, the correct setting would be A, B, C set to false. But in the code, it will depend on the order of traversal of the map and we may have a wrong setting.
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.
Maybe we will never reach that complexity. There are two solution in this case:
- Calculate the requirement graph in initiation phase
- The More easier solution: calculate the requirement in
IsEnabledmethod
I prefer the first solution. But it will introduce complexity. @z0marlin @akhilerm WDYT ?
Maybe we can create a new issue to implement this feature.
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.
I also prefer the first solution. Will raise an issue to enhance the feature flag mechanism. I guess for now we will avoid those checks?
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.
Refer issue #651 for dependent features.
edd089b to
2313e9c
Compare
|
@cospotato Can you resolve the conflicts so that CI can be run |
OK, I will fix it. |
|
@akhilerm Can you show the the |
|
@cospotato I think the BCH can be ignored for now as the results are from old code, which we may need to refactor. |
|
@cospotato The changes for dependent feature gates have been merged, Can you rebase those changes into this PR so that we can merge this. |
@akhilerm OK. I will rebase it. Thank you. |
c58a061 to
9d4703a
Compare
akhilerm
left a comment
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.
Changes looks good. Thanks @cospotato
Can we exclude the helm chart section from the PR, so that we can update it as part of the release? The operator.yaml is fine, since its not versioned.
|
@akhilerm Dose you means exclude the changes in |
Yes |
akhilerm
left a comment
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.
LGTM
z0marlin
left a comment
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.
LGTM. One small change and we are good to go.
| func (bp *blkidProbe) FillBlockDeviceDetails(bd *blockdevice.BlockDevice) { | ||
| di := &blkid.DeviceIdentifier{DevPath: bd.DevPath} | ||
|
|
||
| bd.FSInfo.FileSystem = di.GetOnDiskFileSystem() |
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.
@cospotato can you please add this check (check if FS is already filled by prior probes)
|
@z0marlin Thank you. Fixed |
z0marlin
left a comment
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.
Thanks for working on this :)
akhilerm
left a comment
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.
LGTM
Pull Request template
Why is this PR required? What issue does it fix?: #621
What this PR does?: Add partition table uuid support
Does this PR require any upgrade changes?: No
If the changes in this PR are manually verified, list down the scenarios covered::
CentOS 7host: 🆗CentOS 8host: 🆗Ubuntu 16.04host: 🆗Any additional information for your reviewer? :
Mention if this PR is part of any design or a continuation of previous PRs
Checklist:
DiskGUIDinstead ofPartitionUUID#621<type>(<scope>): <subject>