add the ability to delete luns at runtime

This commit is contained in:
chessman
2019-06-27 18:16:21 +03:00
parent 93a6cf0c31
commit 58fb435e3d

View File

@@ -87,6 +87,12 @@ func AddBackendStorage(bs config.BackendStorage) error {
return nil
}
func DelBackendStorage(deviceID uint64) {
globalSCSILUMap.mutex.Lock()
defer globalSCSILUMap.mutex.Unlock()
delete(globalSCSILUMap.AllDevices, deviceID)
}
func AddLUNMapping(m LUNMapping) error {
globalSCSILUMap.mutex.Lock()
defer globalSCSILUMap.mutex.Unlock()
@@ -99,6 +105,12 @@ func AddLUNMapping(m LUNMapping) error {
return nil
}
func DelLUNMapping(m LUNMapping) {
globalSCSILUMap.mutex.Lock()
defer globalSCSILUMap.mutex.Unlock()
delete(globalSCSILUMap.TargetsLUNMap[m.TargetName], m.LUN)
}
func InitSCSILUMap(config *config.Config) error {
for _, bs := range config.Storages {
if err := AddBackendStorage(bs); err != nil {