Skip to content

Commit efce096

Browse files
committed
standardize Device usage
- always control devices through the Device class - add checks on devices - store all used devices instead of mounted one only - filter device by transport to keep iSCSI devices only
1 parent fca97c2 commit efce096

File tree

4 files changed

+228
-184
lines changed

4 files changed

+228
-184
lines changed

example/main.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
var (
1414
portals = flag.String("portals", "192.168.1.112:3260", "Comma delimited. Eg: 1.1.1.1,2.2.2.2")
1515
iqn = flag.String("iqn", "iqn.2010-10.org.openstack:volume-95739000-1557-44f8-9f40-e9d29fe6ec47", "")
16-
multipath = flag.Bool("multipath", false, "")
1716
username = flag.String("username", "3aX7EEf3CEgvESQG75qh", "")
1817
password = flag.String("password", "eJBDC7Bt7WE3XFDq", "")
1918
lun = flag.Int("lun", 1, "")
@@ -41,7 +40,7 @@ func main() {
4140

4241
// You can utilize the iscsiadm calls directly if you wish, but by creating a Connector
4342
// you can simplify interactions to simple calls like "Connect" and "Disconnect"
44-
c := iscsi.Connector{
43+
c := &iscsi.Connector{
4544
// Our example uses chap
4645
AuthType: "chap",
4746
// List of targets must be >= 1 (>1 signals multipath/mpio)
@@ -55,8 +54,6 @@ func main() {
5554
SecretsType: "chap"},
5655
// Lun is the lun number the devices uses for exports
5756
Lun: int32(*lun),
58-
// Multipath indicates that we want to configure this connection as a multipath device
59-
Multipath: *multipath,
6057
// Number of times we check for device path, waiting for CheckInterval seconds inbetween each check (defaults to 10 if omitted)
6158
RetryCount: 11,
6259
// CheckInterval is the time in seconds to wait inbetween device path checks when logging in to a target
@@ -71,11 +68,6 @@ func main() {
7168
os.Exit(1)
7269
}
7370

74-
if path == "" {
75-
log.Printf("Failed to connect, didn't receive a path, but also no error!")
76-
os.Exit(1)
77-
}
78-
7971
log.Printf("Connected device at path: %s\n", path)
8072
time.Sleep(3 * time.Second)
8173

0 commit comments

Comments
 (0)