Alissa Bonas has uploaded a new change for review.

Change subject: core: call connectStorageServer when add a domain
......................................................................

core: call connectStorageServer when add a domain

If a storage domain is created with an already existing storage
connection, it's possible that the storage connection is not mounted
on the host via which the storage domain creation is done, thus
resulting a failure in domain creation.
This patch adds a connectStorageServer call in domain creation flow
to make sure the connection is valid and mount it before the call
to createStorageDomain.

Change-Id: Ib93e681a36f439277054bf22d8ecb319e330d14f
Bug-Url: https://bugzilla.redhat.com/991797
Signed-off-by: Alissa Bonas <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddStorageDomainCommand.java
1 file changed, 21 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/80/17680/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddStorageDomainCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddStorageDomainCommand.java
index c9ec381..ec5642e 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddStorageDomainCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddStorageDomainCommand.java
@@ -11,6 +11,9 @@
 import org.ovirt.engine.core.common.AuditLogType;
 import org.ovirt.engine.core.common.VdcObjectType;
 import org.ovirt.engine.core.common.action.StorageDomainManagementParameter;
+import 
org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase;
+import org.ovirt.engine.core.common.action.VdcActionType;
+import org.ovirt.engine.core.common.action.VdcReturnValueBase;
 import org.ovirt.engine.core.common.businessentities.SANState;
 import org.ovirt.engine.core.common.businessentities.StorageDomain;
 import org.ovirt.engine.core.common.businessentities.StorageDomainDynamic;
@@ -18,6 +21,7 @@
 import org.ovirt.engine.core.common.businessentities.StorageDomainType;
 import org.ovirt.engine.core.common.businessentities.StorageFormatType;
 import org.ovirt.engine.core.common.businessentities.StoragePool;
+import org.ovirt.engine.core.common.businessentities.StorageServerConnections;
 import org.ovirt.engine.core.common.businessentities.StorageType;
 import org.ovirt.engine.core.common.errors.VdcBllMessages;
 import org.ovirt.engine.core.common.utils.Pair;
@@ -104,12 +108,28 @@
     protected void executeCommand() {
         initializeStorageDomain();
         addStorageDomainInDb();
-        if (addStorageDomainInIrs()) {
+        // check connection to storage
+        VdcReturnValueBase connectReturnValue = connectStorage();
+        if (!connectReturnValue.getSucceeded()) {
+            setSucceeded(false);
+            getReturnValue().setFault(connectReturnValue.getFault());
+        }
+        else if (addStorageDomainInIrs()) {
             updateStorageDomainDynamicFromIrs();
             setSucceeded(true);
         }
     }
 
+    protected VdcReturnValueBase connectStorage() {
+        VdcReturnValueBase result = null;
+        String connectionId = getStorageDomain().getStorage();
+        StorageServerConnections connection = 
getStorageServerConnectionDAO().get(connectionId);
+        result = 
Backend.getInstance().runInternalAction(VdcActionType.ConnectStorageToVds,
+                            new 
StorageServerConnectionParametersBase(connection, getParameters().getVdsId()));
+        return result;
+
+    }
+
     @Override
     public AuditLogType getAuditLogTypeValue() {
         return getSucceeded() ? AuditLogType.USER_ADD_STORAGE_DOMAIN : 
AuditLogType.USER_ADD_STORAGE_DOMAIN_FAILED;


-- 
To view, visit http://gerrit.ovirt.org/17680
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib93e681a36f439277054bf22d8ecb319e330d14f
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alissa Bonas <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to