-
Notifications
You must be signed in to change notification settings - Fork 242
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
Check VBM node type automatically and support csi rund 3.0 protocol #1177
Check VBM node type automatically and support csi rund 3.0 protocol #1177
Conversation
Skipping CI for Draft Pull Request. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mowangdk The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
ba66ddb
to
2beaa0a
Compare
9573d39
to
7ba78d8
Compare
7ba78d8
to
46fda93
Compare
5e73aa0
to
ca77072
Compare
ca77072
to
8d21509
Compare
c6cdf94
to
f205b53
Compare
0144108
to
811a254
Compare
811a254
to
816a559
Compare
I'll merge this PR since the e2e test for the business line has passed. |
klog.V(5).InfoS("CheckVFIOUsage: eval symlink success", "path", actualPath) | ||
groupNumber := filepath.Base(actualPath) | ||
// the command returns -1 if nothing is returned | ||
output, _ := exec.Command("lsof", filepath.Join("/dev/vfio", groupNumber)).CombinedOutput() |
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 is expensive, I would strongly recommend not using this. Instead, ask the user to lock this file, so that we can use lock to detect usage. Or ask the user to write a PID file, and we can just check if the process is alive.
// the command returns -1 if nothing is returned | ||
output, _ := exec.Command("lsof", filepath.Join("/dev/vfio", groupNumber)).CombinedOutput() | ||
if strings.TrimSpace(string(output)) != "" { | ||
return errors.Errorf("CheckVFIOUsage: device: %s is still be in used, output: %s", d.deviceNumber, output) |
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.
convert output to string before logging. Or it will output a list of number.
if err == nil { | ||
return false | ||
} | ||
return strings.Contains(strings.ToLower(err.Error()), "no such file or directory") |
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.
don't check error string. It is subject to change. Use errors.Is instead.
if err != nil { | ||
klog.Errorf("get vmoc failed: %+v", err) | ||
} | ||
if err == nil && value == "true" { |
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.
else if value == "true". And we should not ignore all errors?
} | ||
} | ||
} else { | ||
output, err := utils.CommandOnNode("xdragon-bdf", "--nvme", "-id=%s", volumeId).CombinedOutput() |
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.
Note: new usage of nsenter. We should try to remove nsenter usage.
@@ -309,7 +323,8 @@ func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis | |||
} | |||
klog.Infof("NodePublishVolume: TargetPath: %s is umounted, start mount in kata mode", req.TargetPath) | |||
mountFlags := req.GetVolumeCapability().GetMount().GetMountFlags() | |||
returned, err := ns.mountRunDVolumes(req.VolumeId, sourcePath, req.TargetPath, fsType, mkfsOptions, isBlock, mountFlags) | |||
pvName := utils.GetPvNameFormPodMnt(targetPath) |
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 is fragile, target path format can change in the future.
What type of PR is this?
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: