-
Notifications
You must be signed in to change notification settings - Fork 20
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
Fix nvme block resize #366
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1022,12 +1022,29 @@ func (s *Service) nodeExpandRawBlockVolume(ctx context.Context, volumeWWN string | |
if len(deviceNames) > 0 { | ||
var devName string | ||
for _, deviceName := range deviceNames { | ||
devicePath := sysBlock + deviceName | ||
log.Infof("Rescanning unmounted (raw block) device %s to expand size", deviceName) | ||
err = s.Fs.GetUtil().DeviceRescan(context.Background(), devicePath) | ||
if err != nil { | ||
log.Errorf("Failed to rescan device (%s) with error (%s)", devicePath, err.Error()) | ||
return nil, status.Error(codes.Internal, err.Error()) | ||
if strings.HasPrefix(deviceName, "nvme") { | ||
nvmeControllerDevice, err := s.Fs.GetUtil().GetNVMeController(deviceName) | ||
if err != nil { | ||
log.Errorf("Failed to rescan device (%s) with error (%s)", deviceName, err.Error()) | ||
return nil, status.Error(codes.Internal, err.Error()) | ||
} | ||
if nvmeControllerDevice != "" { | ||
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. So there seems to be a place where nvmeControllerDevice can be empty but GetNVMeController() returns no error. Is this code still then correct? 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. For PowerMax, we have two devices: nvme0c0n1 and nvme0n1. Here, nvme0c0n1 is a controller, but nvme0n1 is not. The GetNVMeController function processes each device as follows:
|
||
devicePath := dev + nvmeControllerDevice | ||
log.Infof("Rescanning unmounted (raw block) device %s to expand size", devicePath) | ||
err = s.nvmeLib.DeviceRescan(devicePath) | ||
if err != nil { | ||
log.Errorf("Failed to rescan device (%s) with error (%s)", devicePath, err.Error()) | ||
return nil, status.Error(codes.Internal, err.Error()) | ||
} | ||
} | ||
} else { | ||
devicePath := sysBlock + deviceName | ||
log.Infof("Rescanning unmounted (raw block) device %s to expand size", deviceName) | ||
err = s.Fs.GetUtil().DeviceRescan(context.Background(), devicePath) | ||
if err != nil { | ||
log.Errorf("Failed to rescan device (%s) with error (%s)", devicePath, err.Error()) | ||
return nil, status.Error(codes.Internal, err.Error()) | ||
} | ||
} | ||
devName = deviceName | ||
} | ||
|
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.
Why would the GetNVMeController() call fail? Is bailing out the proper handling? Could anything else be done? The error message is inaccurate and can cause problems during troubleshooting. Is it better to indicate that there was a failure to get the device controller?