package org.ovirt.engine.core.bll.storage;

import org.ovirt.engine.core.common.businessentities.VDS;
import org.ovirt.engine.core.common.businessentities.StorageDomain;
import org.ovirt.engine.core.common.businessentities.StoragePool;
import org.ovirt.engine.core.utils.log.Log;
import org.ovirt.engine.core.utils.log.LogFactory;

public class ConnectSingleAsyncOperation extends ActivateDeactivateSingleAsyncOperation {

    public ConnectSingleAsyncOperation(java.util.ArrayList<VDS> vdss, StorageDomain domain, StoragePool storagePool) {
        super(vdss, domain, storagePool);
    }

    @Override
    public void execute(int iterationId) {
        try {
            StorageHelperDirector.getInstance().getItem(getStorageDomain().getStorageType())
                    .connectStorageToDomainByVdsId(getStorageDomain(), getVdss().get(iterationId).getId());
        } catch (RuntimeException e) {
            log.errorFormat("Failed to connect host {0} to storage pool {1}. Exception: {3}", getVdss()
                    .get(iterationId).getName(), getStoragePool().getName(), e);
        }
    }

    private static Log log = LogFactory.getLog(ConnectSingleAsyncOperation.class);
}

@@ -637,24 +637,71 @@
 rationId) %7B%0A
+        VDS vds = getVdss().get(iterationId);%0A%0A
         try 
@@ -870,34 +870,11 @@
 (), 
-getVdss().get(iterationId)
+vds
 .get
@@ -990,16 +990,35 @@
 age 
-pool %7B1%7D
+domain (name: %7B1%7D, id: %7B2%7D)
 . Ex
@@ -1031,26 +1031,16 @@
 n: %7B3%7D%22,
- getVdss()
 %0A       
@@ -1052,32 +1052,48 @@
         
+vds
 .get
-(iterationId
+Name(), getStorageDomain(
 ).getNam
@@ -1111,22 +1111,22 @@
 rage
-Pool
+Domain
 ().get
-Name
+Id
 (), 

Improve log message on failure to connect to storage server