@@ -144,26 +144,14 @@ public boolean hostDisconnected(Host host, StoragePool pool) {
144144 logger .error ("Failed to add host by HostListener as host was not found with id : {}" , host .getId ());
145145 return false ;
146146 }
147- // TODO add storage pool get validation
148- logger .info ("Disconnecting host {} from ONTAP storage pool {}" , host .getName (), pool .getName ());
149-
150- try {
151- DeleteStoragePoolCommand cmd = new DeleteStoragePoolCommand (pool );
152- long hostId = host .getId ();
153- Answer answer = _agentMgr .easySend (hostId , cmd );
154-
155- if (answer != null && answer .getResult ()) {
156- logger .info ("Successfully disconnected host {} from ONTAP storage pool {}" , host .getName (), pool .getName ());
157- return true ;
158- } else {
159- String errMsg = (answer != null ) ? answer .getDetails () : "Unknown error" ;
160- logger .warn ("Failed to disconnect host {} from storage pool {}. Error: {}" , host .getName (), pool .getName (), errMsg );
161- return false ;
162- }
163- } catch (Exception e ) {
164- logger .error ("Exception while disconnecting host {} from storage pool {}" , host .getName (), pool .getName (), e );
165- return false ;
147+ logger .debug ("hostDisconnected called for host {}, pool {}" , host .getName (), pool .getName ());
148+
149+ StoragePoolHostVO storagePoolHost = storagePoolHostDao .findByPoolHost (pool .getId (), host .getId ());
150+ if (storagePoolHost != null ) {
151+ storagePoolHostDao .deleteStoragePoolHostDetails (host .getId (), pool .getId ());
166152 }
153+
154+ return true ;
167155 }
168156
169157 @ Override
0 commit comments