mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 11:00:25 +00:00
rbd: rename mapOptions and options argument slices
With the new support for passing --options, referring to ExecCommand() argument slices as mapOptions and options is confusing. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
parent
1f17d25407
commit
5631b83dd0
@ -214,8 +214,7 @@ func createPath(ctx context.Context, volOpt *rbdVolume, cr *util.Credentials) (s
|
|||||||
|
|
||||||
util.TraceLog(ctx, "rbd: map mon %s", volOpt.Monitors)
|
util.TraceLog(ctx, "rbd: map mon %s", volOpt.Monitors)
|
||||||
|
|
||||||
// Map options
|
mapArgs := []string{
|
||||||
mapOptions := []string{
|
|
||||||
"--id", cr.ID,
|
"--id", cr.ID,
|
||||||
"-m", volOpt.Monitors,
|
"-m", volOpt.Monitors,
|
||||||
"--keyfile=" + cr.KeyFile,
|
"--keyfile=" + cr.KeyFile,
|
||||||
@ -230,17 +229,17 @@ func createPath(ctx context.Context, volOpt *rbdVolume, cr *util.Credentials) (s
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update options with device type selection
|
// Update options with device type selection
|
||||||
mapOptions = append(mapOptions, "--device-type", accessType)
|
mapArgs = append(mapArgs, "--device-type", accessType)
|
||||||
|
|
||||||
if volOpt.readOnly {
|
if volOpt.readOnly {
|
||||||
mapOptions = append(mapOptions, "--read-only")
|
mapArgs = append(mapArgs, "--read-only")
|
||||||
}
|
}
|
||||||
|
|
||||||
if volOpt.MapOptions != "" {
|
if volOpt.MapOptions != "" {
|
||||||
mapOptions = append(mapOptions, "--options", volOpt.MapOptions)
|
mapArgs = append(mapArgs, "--options", volOpt.MapOptions)
|
||||||
}
|
}
|
||||||
// Execute map
|
// Execute map
|
||||||
stdout, stderr, err := util.ExecCommand(ctx, rbd, mapOptions...)
|
stdout, stderr, err := util.ExecCommand(ctx, rbd, mapArgs...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
util.WarningLog(ctx, "rbd: map error %v, rbd output: %s", err, stderr)
|
util.WarningLog(ctx, "rbd: map error %v, rbd output: %s", err, stderr)
|
||||||
// unmap rbd image if connection timeout
|
// unmap rbd image if connection timeout
|
||||||
@ -315,11 +314,12 @@ func detachRBDImageOrDeviceSpec(ctx context.Context, imageOrDeviceSpec string, i
|
|||||||
if ndbType {
|
if ndbType {
|
||||||
accessType = accessTypeNbd
|
accessType = accessTypeNbd
|
||||||
}
|
}
|
||||||
options := []string{"unmap", "--device-type", accessType, imageOrDeviceSpec}
|
unmapArgs := []string{"unmap", "--device-type", accessType, imageOrDeviceSpec}
|
||||||
if unmapOptions != "" {
|
if unmapOptions != "" {
|
||||||
options = append(options, "--options", unmapOptions)
|
unmapArgs = append(unmapArgs, "--options", unmapOptions)
|
||||||
}
|
}
|
||||||
_, stderr, err := util.ExecCommand(ctx, rbd, options...)
|
|
||||||
|
_, stderr, err := util.ExecCommand(ctx, rbd, unmapArgs...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Messages for krbd and nbd differ, hence checking either of them for missing mapping
|
// Messages for krbd and nbd differ, hence checking either of them for missing mapping
|
||||||
// This is not applicable when a device path is passed in
|
// This is not applicable when a device path is passed in
|
||||||
|
Loading…
Reference in New Issue
Block a user