Browse Source

Fixed birdged SP remove bug

TC pushbot 5 4 years ago
parent
commit
65c49d933c
1 changed files with 7 additions and 1 deletions
  1. 7 1
      storage.go

+ 7 - 1
storage.go

@@ -201,12 +201,18 @@ func BridgeFSHandlerToGroup(fsh *fs.FileSystemHandler, sp *storage.StoragePool)
 }
 
 func DebridgeFSHandlerFromGroup(fshUUID string, sp *storage.StoragePool) error {
+	isBridged, err := bridgeManager.IsBridgedFSH(fshUUID, sp.Owner)
+	if err != nil || !isBridged {
+		return errors.New("FSH not bridged")
+	}
+
 	newStorageList := []*fs.FileSystemHandler{}
 	fshExists := false
 	for _, fsh := range sp.Storages {
 		if fsh.UUID != fshUUID {
-			fshExists = true
 			newStorageList = append(newStorageList, fsh)
+		} else {
+			fshExists = true
 		}
 	}