Michael Kublin has uploaded a new change for review. Change subject: engine: Removing canDoaction from ConnectHostToStoragePoolServersCommand ......................................................................
engine: Removing canDoaction from ConnectHostToStoragePoolServersCommand The following change is removing canDoAction from ConnectHostToStoragePoolServersCommand. The purpose of canDoAction was validate storage connections at vdsm, the following API is depreacted and not usefull at vdsm side, and not provide any benefit to engine, also the following command is internal so no reason to perfrom additional xml rpc call in order to validate storage server connection. Benefit, reduced number of XML RPC calls via InitVdsOnUp, meaning vds should be moved to status UP much faster. Additional benefit, less code, less bugs Change-Id: I0124e47b2f1194e5de9b40216cd285c47b1b6f94 Signed-off-by: Michael Kublin <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/ConnectHostToStoragePoolServersCommand.java 1 file changed, 8 insertions(+), 42 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/09/11309/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/ConnectHostToStoragePoolServersCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/ConnectHostToStoragePoolServersCommand.java index 889f7f1..b9ff5ad 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/ConnectHostToStoragePoolServersCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/ConnectHostToStoragePoolServersCommand.java @@ -1,6 +1,8 @@ package org.ovirt.engine.core.bll.storage; +import java.util.HashMap; import java.util.List; +import java.util.Map; import org.ovirt.engine.core.bll.Backend; import org.ovirt.engine.core.bll.InternalCommandAttribute; @@ -10,7 +12,6 @@ import org.ovirt.engine.core.common.businessentities.StorageServerConnections; import org.ovirt.engine.core.common.vdscommands.ConnectStorageServerVDSCommandParameters; import org.ovirt.engine.core.common.vdscommands.VDSCommandType; -import org.ovirt.engine.core.dal.VdcBllMessages; /** * Connect host to all Storage server connections in Storage pool. We @@ -30,56 +31,27 @@ @Override protected void executeCommand() { - setSucceeded(ConnectStorageServer(getStoragePool().getstorage_pool_type(), getConnections())); + InitConnectionList(); + setSucceeded(connectStorageServer(getStoragePool().getstorage_pool_type(), getConnections())); if (getNeedToConnectIso()) { - if (!ConnectStorageServer(getIsoType(), getIsoConnections())) { + if (!connectStorageServer(getIsoType(), getIsoConnections())) { log.infoFormat("Failed to connect host {0} to StoragePool {1} Iso domain/s connections", getVds() .getvds_name(), getStoragePool().getname()); } } if (getNeedToConnectExport()) { - if (!ConnectStorageServer(getExportType(), getExportConnections())) { + if (!connectStorageServer(getExportType(), getExportConnections())) { log.infoFormat("Failed to connect host {0} to StoragePool {1} Export domain/s connections", getVds() .getvds_name(), getStoragePool().getname()); } } } - @Override - protected boolean canDoAction() { - boolean returnValue = true; - InitConnectionList(); - if (!ValidConnection(getStoragePool().getstorage_pool_type(), getConnections())) { - addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_CONNECTION); - returnValue = false; - } else { - if (getIsoConnections() != null && getIsoConnections().size() != 0) { - setNeedToConnectIso(ValidConnection(getIsoType(), getIsoConnections())); - if (!getNeedToConnectIso()) { - log.infoFormat( - "Failed to validated connections for host {0} to StoragePool {1} Iso domain/s connections", - getVds().getvds_name(), - getStoragePool().getname()); - } - } - if (getExportConnections() != null && getExportConnections().size() != 0) { - setNeedToConnectExport(ValidConnection(getExportType(), getExportConnections())); - if (!getNeedToConnectExport()) { - log.infoFormat( - "Failed to validated connections for host {0} to StoragePool {1} Export domain/s connections", - getVds().getvds_name(), - getStoragePool().getname()); - } - } - } - return returnValue; - } - - protected boolean ConnectStorageServer(StorageType type, List<StorageServerConnections> connections) { + private boolean connectStorageServer(StorageType type, List<StorageServerConnections> connections) { boolean connectSucceeded = true; if (connections != null && connections.size() > 0) { - java.util.HashMap<String, String> retValues = (java.util.HashMap<String, String>) Backend + Map<String, String> retValues = (HashMap<String, String>) Backend .getInstance() .getResourceManager() .RunVdsCommand( @@ -93,10 +65,4 @@ } return connectSucceeded; } - - protected boolean ValidConnection(StorageType type, List<StorageServerConnections> connections) { - return (connections != null && (connections.isEmpty() || StorageHelperDirector.getInstance().getItem(type) - .validateStoragePoolConnectionsInHost(getVds(), connections, getStoragePool().getId()))); - } - } -- To view, visit http://gerrit.ovirt.org/11309 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0124e47b2f1194e5de9b40216cd285c47b1b6f94 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Michael Kublin <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
