Skip to content

Commit 0799fec

Browse files
authored
tunelinux: use constant iscsid service name across all distros (#118)
* Problem: * Installing on Fedora yields empty service name for iscsi * Implementation: * Drop iscsi map lookup for service names(legacy) as iscsi service * name is now same across all major distros. Earlier it used to be * open-iscsi on some SLES versions. * Testing: * Review: gcostea, rkumar Signed-off-by: Shiva Krishna, Merla <[email protected]>
1 parent bfa59fe commit 0799fec

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

linux/os.go

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,6 @@ var OsIscsiPackageMap = map[string]string{
6969
OsTypeAmazon: iscsiInitiatorUtils,
7070
}
7171

72-
// OsIscsiServiceMap provides mapping of os distribution to iscsi service name
73-
var OsIscsiServiceMap = map[string]string{
74-
OsTypeUbuntu: iscsid,
75-
OsTypeSuse: iscsid,
76-
OsTypeRedhat: iscsid,
77-
OsTypeCentos: iscsid,
78-
OsTypeOracle: iscsid,
79-
OsTypeAmazon: iscsid,
80-
}
81-
8272
var osInfo *OsInfo
8373
var osInfoLock sync.Mutex
8474

@@ -498,7 +488,7 @@ func EnableService(serviceType string) (err error) {
498488
func enableSystemdService(osInfo *OsInfo, serviceType string) (err error) {
499489
var serviceName string
500490
if serviceType == iscsi {
501-
serviceName = OsIscsiServiceMap[osInfo.GetOsDistro()]
491+
serviceName = "iscsid.service"
502492
} else if serviceType == multipath {
503493
serviceName = "multipathd.service"
504494
} else {
@@ -555,8 +545,8 @@ func enableInitVService(osInfo *OsInfo, serviceType string) (err error) {
555545
func enableUbuntuService(osInfo *OsInfo, serviceType string) (err error) {
556546
var serviceName string
557547
if serviceType == iscsi {
558-
// get distro specific iscsi service name
559-
serviceName = OsIscsiServiceMap[osInfo.GetOsDistro()]
548+
// generic for all distros
549+
serviceName = iscsid
560550
} else if serviceType == multipath {
561551
// generic for all distros
562552
serviceName = multipathd
@@ -634,7 +624,7 @@ func getServiceCommandArgs(osInfo *OsInfo, packageType string, operation string)
634624
// suse 11.* has open-iscsi and 12.* has iscsid
635625
args = append(args, openIscsi)
636626
} else {
637-
args = append(args, OsIscsiServiceMap[osInfo.GetOsDistro()])
627+
args = append(args, iscsid)
638628
}
639629
}
640630

0 commit comments

Comments
 (0)