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

FC volume plugin: Support WWID for volume identifier #48741

Merged
merged 2 commits into from
Aug 11, 2017

Conversation

mtanino
Copy link

@mtanino mtanino commented Jul 11, 2017

What this PR does / why we need it:

This PR adds World Wide Identifier (WWID) parameter to FCVolumeSource as an unique volume identifier.

Which issue this PR fixes: fixes #48639

Special notes for your reviewer:

/cc @rootfs @jsafrane @msau42

Release note:

FC volume plugin: Support WWID for volume identifier

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 11, 2017
@k8s-ci-robot
Copy link
Contributor

Hi @mtanino. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 11, 2017
@mtanino
Copy link
Author

mtanino commented Jul 11, 2017

/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 11, 2017
@k8s-github-robot k8s-github-robot added kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Jul 11, 2017
@k8s-ci-robot
Copy link
Contributor

@mtanino: you can't request testing unless you are a kubernetes member.

In response to this:

/ok-to-test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@@ -648,15 +648,22 @@ func validateISCSIVolumeSource(iscsi *api.ISCSIVolumeSource, fldPath *field.Path

func validateFCVolumeSource(fc *api.FCVolumeSource, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if len(fc.TargetWWNs) < 1 {
allErrs = append(allErrs, field.Required(fldPath.Child("targetWWNs"), ""))
if len(fc.TargetWWNs) < 1 && len(fc.WWIDs) < 1 {
Copy link
Member

Choose a reason for hiding this comment

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

I'd appreciate an unit test for this.

Copy link
Author

Choose a reason for hiding this comment

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

done

} else {
if *fc.Lun < 0 || *fc.Lun > 255 {
allErrs = append(allErrs, field.Invalid(fldPath.Child("lun"), fc.Lun, validation.InclusiveRangeError(0, 255)))
if len(fc.TargetWWNs) != 0 && len(fc.WWIDs) != 0 {
Copy link
Member

Choose a reason for hiding this comment

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

I'd appreciate an unit test for this.

Copy link
Author

Choose a reason for hiding this comment

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

done

@jsafrane
Copy link
Member

/ok-to-test
/assign @rootfs

// Optional: FC volume World Wide Identifiers (WWIDs)
// Either WWIDs or TargetWWNs and Lun must be set, but not both simultaneously.
// +optional
WWIDs []string `json:"WWIDs,omitempty" protobuf:"bytes,5,rep,name=WWIDs"`
Copy link
Member

Choose a reason for hiding this comment

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

json fields must be lowercase, i.e. probably json:"wwids,omitempty"

Copy link
Member

@jsafrane jsafrane Jul 11, 2017

Choose a reason for hiding this comment

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

'+ the same for protobuf field

Copy link
Author

Choose a reason for hiding this comment

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

done

@jsafrane
Copy link
Member

/test pull-kubernetes-verify

@jsafrane
Copy link
Member

make verify is complaining about these files:

W0711 11:24:43.198]    M pkg/apis/apps/v1beta1/zz_generated.conversion.go
W0711 11:24:43.198]    M pkg/apis/batch/v1/zz_generated.conversion.go
W0711 11:24:43.198]    M pkg/apis/extensions/v1beta1/zz_generated.conversion.go

These should be modified only when apps/v1beta1/types.go, batch/v1/types.go or extensions/v1beta1/types.go change and I do not see any such change in your PR. I guess your hack/update-all.sh regenerated them from some reason on your system. Try to run update-all.sh again or remove them manually from the patch.

@mtanino
Copy link
Author

mtanino commented Jul 11, 2017

@jsafrane
Thank you for the review. I updated the patch based on your comments.

These should be modified only when apps/v1beta1/types.go, batch/v1/types.go or
extensions/v1beta1/types.go change and I do not see any such change in your PR. I guess your
hack/update-all.sh regenerated them from some reason on your system.

I'm not sure but after hack/update-all.sh again, these three files were still regenerated.
Therefore, I checkout original file for these three zz_generated.conversion.go to avoid to commit and then pushed above commit.

@jsafrane
Copy link
Member

@mtanino, now it looks much better, please run hack/update-bazel.sh and that should be all from the process view. And real review can start :-)

disk, err := io.EvalSymlinks(dev_id + name)
if err != nil {
glog.V(2).Infof("fc: failed to find a corresponding disk from symlink[%s], error %v", dev_id+name, err)
return "", ""
Copy link
Member

Choose a reason for hiding this comment

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

It seems to me that continue would be more appropriate here - there is a weird symlink there, but that should not stop the plugin from trying the other links in the directory.

Copy link
Author

Choose a reason for hiding this comment

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

In my understanding, fc_path is unique under /dev/by-id.
Therefore, if symlink evaluation or checkDiskExist of scsi-3600508b400105e210000900000490000 fails, checking other links seems meaning less.

Also seems strings.Contains causes unexpected behavior because there is a possibility that choose partitioned device such as sda1, sda2, etc. I think we should check whether name matches fc_path completely.

ex.

lrwxrwxrwx 1 root root   9 Jul  7 19:47 scsi-3600508b400105e210000900000490000 -> ../../sdb
lrwxrwxrwx 1 root root   9 Jul  7 19:45 scsi-35000c500676fb68f -> ../../sda
lrwxrwxrwx 1 root root  10 Jul  7 19:45 scsi-35000c500676fb68f-part1 -> ../../sda1
lrwxrwxrwx 1 root root  10 Jul  7 19:45 scsi-35000c500676fb68f-part2 -> ../../sda2
lrwxrwxrwx 1 root root  10 Jul  7 19:45 scsi-35000c500676fb68f-part3 -> ../../sda3
lrwxrwxrwx 1 root root  10 Jul  7 19:45 scsi-35000c500676fb68f-part4 -> ../../sda4
lrwxrwxrwx 1 root root  10 Jul  7 19:45 scsi-35000c500676fb68f-part5 -> ../../sda5
lrwxrwxrwx 1 root root   9 Jul  7 19:45 wwn-0x5000c500676fb68f -> ../../sda
lrwxrwxrwx 1 root root  10 Jul  7 19:45 wwn-0x5000c500676fb68f-part1 -> ../../sda1
lrwxrwxrwx 1 root root  10 Jul  7 19:45 wwn-0x5000c500676fb68f-part2 -> ../../sda2
lrwxrwxrwx 1 root root  10 Jul  7 19:45 wwn-0x5000c500676fb68f-part3 -> ../../sda3
lrwxrwxrwx 1 root root  10 Jul  7 19:45 wwn-0x5000c500676fb68f-part4 -> ../../sda4
lrwxrwxrwx 1 root root  10 Jul  7 19:45 wwn-0x5000c500676fb68f-part5 -> ../../sda5
lrwxrwxrwx 1 root root   9 Mar 31 13:20 wwn-0x5001480000000000 -> ../../sr0

Any thought?

Copy link
Member

Choose a reason for hiding this comment

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

ok, with name == fs_path I see that return is correct here

err = checkDiskExist(b, disk, wwid)
if err != nil {
glog.V(2).Infof("fc: failed to get wwid from disk[%s], error %v", dev_id+name, err)
return "", ""
Copy link
Member

Choose a reason for hiding this comment

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

dtto, continue here?

Copy link
Member

Choose a reason for hiding this comment

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

scratch the previous comment, return is correct here

@nikhiljindal
Copy link
Contributor

/approve for federation. Al federation changes in this PR are auto generated.

@mtanino
Copy link
Author

mtanino commented Jul 11, 2017

/test pull-kubernetes-node-e2e

@mtanino
Copy link
Author

mtanino commented Jul 11, 2017

/test pull-kubernetes-e2e-gce-etcd3

@mtanino
Copy link
Author

mtanino commented Aug 2, 2017

@rootfs @jsafrane @msau42
Just resolved merge conflict. No other changes.

Conflicting files
pkg/volume/fc/fc_util.go

@k8s-github-robot k8s-github-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Aug 2, 2017
@mtanino
Copy link
Author

mtanino commented Aug 2, 2017

/retest

@rootfs
Copy link
Contributor

rootfs commented Aug 2, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 2, 2017
@mtanino
Copy link
Author

mtanino commented Aug 4, 2017

/assign @thockin
/assign @smarterclayton

@thockin
Copy link
Member

thockin commented Aug 10, 2017

/approve

@k8s-github-robot k8s-github-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Aug 10, 2017
mtanino added 2 commits August 10, 2017 09:59
This PR adds World Wide Identifier (WWID) parameter to
FCVolumeSource as an unique volume identifier.

fixes kubernetes#48639
@k8s-github-robot k8s-github-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Aug 10, 2017
@mtanino
Copy link
Author

mtanino commented Aug 10, 2017

@thockin
Thank you for the approval.

@rootfs
The patch is updated to resolve the merge conflict. No other changes.

Conflicting files
staging/src/k8s.io/api/core/v1/generated.pb.go

@mtanino
Copy link
Author

mtanino commented Aug 10, 2017

/retest

@rootfs
Copy link
Contributor

rootfs commented Aug 10, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 10, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jsafrane, mtanino, nikhiljindal, rootfs, thockin

Associated issue: 48639

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@mtanino
Copy link
Author

mtanino commented Aug 10, 2017

/retest

@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/storage Categorizes an issue or PR as relevant to SIG Storage. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FC volume plugin should support World Wide Identifier (WWID) parameter as an unique volume identifier
9 participants