Skip to content

Commit 037c85c

Browse files
authored
Merge pull request #4 from Seagate/feat/saswwn
Feat/saswwn
2 parents c4f22d9 + e480970 commit 037c85c

File tree

5 files changed

+19
-27
lines changed

5 files changed

+19
-27
lines changed

SECURITY.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ We take the security of the csi-lib-sas project seriously. If you find any secur
66

77
:warning: **Please do not publicly report any security vulnerabilities via GitHub issues.**
88

9-
If you have concerns or questions, please email us at [opensource@seagate.com](mailto:opensource@seagate.com).
9+
If you have concerns or questions, please email us at [opensource@seagate.com](mailto:opensource@seagate.com).
1010

1111
To report an actual vulnerability, please use the "[Seagate Responsible Vulnerability Disclosure Policy](https://www.seagate.com/legal-privacy/responsible-vulnerability-disclosure-policy/)"
12-
1312

1413
### Reporting Format
1514

16-
To make your reporting meaningful and help us understand the nature and scope of the issue, please include as much information as possible.
15+
To make your reporting meaningful and help us understand the nature and scope of the issue, please include as much information as possible.
1716

1817
### Preferred Languages
1918

SECURITY_CONTACTS

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,5 @@
33
# They are the contact point for the Product Security Team to reach out
44
# to for triaging and handling of incoming issues.
55
#
6-
# The below names agree to abide by the
7-
# [Embargo Policy](https://github.com/kubernetes/sig-release/blob/master/security-release-process-documentation/security-release-process.md#embargo-policy)
8-
# and will be removed and replaced if they violate that agreement.
9-
#
10-
# DO NOT REPORT SECURITY VULNERABILITIES DIRECTLY TO THESE NAMES, FOLLOW THE
11-
# INSTRUCTIONS AT https://kubernetes.io/security/
12-
13-
jskazinski
146

7+
opensource@seagate.com

example/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func main() {
6161

6262
// Use command line arguments for test settings
6363
c := sas.Connector{
64-
TargetWWN: *wwn,
64+
VolumeWWN: *wwn,
6565
}
6666

6767
dp, err := sas.Attach(ctx, &c, &sas.OSioHandler{})

sas/sas.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ type ioHandler interface {
3939

4040
// Connector provides a struct to hold all of the needed parameters to make our SAS connection
4141
type Connector struct {
42-
VolumeName string `json:"volume_name"`
43-
TargetWWN string `json:"target_wwn"`
44-
Multipath bool `json:"multipath"`
45-
TargetDevice string `json:"target_device"`
46-
SCSIDevices []string `json:"scsi_devices"`
47-
IoHandler ioHandler
42+
VolumeName string `json:"volume_name"` // Passed In: A name given to the storage volume by the provisioner, for debugging.
43+
VolumeWWN string `json:"volume_wwn"` // Passed In: 128 bit world wide name given to storage volume.
44+
Multipath bool `json:"multipath"` // Discovered: True indicates that OSPathName is a multipath device (dm-#), otherwise it is a regular device (/dev/sdX)
45+
OSPathName string `json:"os_device_path"` // Discovered: The OS path to the storage volume WWN, for example /dev/sdb or /dev/dm-5
46+
OSDevicePaths []string `json:"scsi_devices"` // Discovered: The OS path(s) to the storage volume WWN, for example ["/dev/sdb"] or ["/dev/sdb", "/dev/sdc"]
47+
IoHandler ioHandler // Passed In
4848
}
4949

5050
// OSioHandler is a wrapper that includes all the necessary io functions used for (Should be used as default io handler)
@@ -68,7 +68,7 @@ func Attach(ctx context.Context, c *Connector, io ioHandler) (string, error) {
6868
return "", err
6969
}
7070

71-
return c.TargetDevice, nil
71+
return c.OSPathName, nil
7272
}
7373

7474
// Detach performs a detach operation on a volume
@@ -200,7 +200,7 @@ func discoverDevices(logger klog.Logger, c *Connector, io ioHandler) error {
200200
var devices []string
201201

202202
c.Multipath = false
203-
c.TargetDevice = ""
203+
c.OSPathName = ""
204204
rescaned := false
205205

206206
// two-phase search:
@@ -209,21 +209,21 @@ func discoverDevices(logger klog.Logger, c *Connector, io ioHandler) error {
209209
for true {
210210

211211
// Find the multipath device using WWN
212-
dm, devices = findDiskById(logger, c.TargetWWN, io)
212+
dm, devices = findDiskById(logger, c.VolumeWWN, io)
213213
logger.V(1).Info("find disk by id returned", "dm", dm, "devices", devices)
214214

215215
for _, device := range devices {
216216
logger.V(3).Info("add scsi device", "device", device)
217217
if device != "" {
218-
c.SCSIDevices = append(c.SCSIDevices, device)
218+
c.OSDevicePaths = append(c.OSDevicePaths, device)
219219
}
220220
}
221221

222222
// if multipath device is found, break
223-
if dm != "" && len(c.SCSIDevices) > 0 {
223+
if dm != "" && len(c.OSDevicePaths) > 0 {
224224
c.Multipath = true
225-
c.TargetDevice = dm
226-
logger.V(1).Info("multipath device was discovered", "dm", dm, "SCSIDevices", c.SCSIDevices)
225+
c.OSPathName = dm
226+
logger.V(1).Info("multipath device was discovered", "dm", dm, "OSDevicePaths", c.OSDevicePaths)
227227
break
228228
}
229229

@@ -239,7 +239,7 @@ func discoverDevices(logger klog.Logger, c *Connector, io ioHandler) error {
239239
}
240240

241241
// if no disk matches input wwn, return error
242-
c.TargetDevice = dm
242+
c.OSPathName = dm
243243
if dm == "" {
244244
err := fmt.Errorf("no SAS disk found")
245245
logger.Error(err, "no device discovered", "dm", dm)

sas/sas_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func TestSearchDisk(t *testing.T) {
8989
logger, _ := ktesting.NewTestContext(t)
9090
fakeConnector := Connector{
9191
VolumeName: "fakeVol",
92-
TargetWWN: "3600508b400105e210000900000490000",
92+
VolumeWWN: "3600508b400105e210000900000490000",
9393
}
9494

9595
error := discoverDevices(logger, &fakeConnector, &fakeIOHandler{})

0 commit comments

Comments
 (0)