Search in sources :

Example 1 with SynchronizeNumberOfAsyncOperations

use of org.ovirt.engine.core.utils.SynchronizeNumberOfAsyncOperations in project ovirt-engine by oVirt.

the class RemoveStoragePoolCommand method connectAllHostToPoolAndDomain.

/**
 * @param masterDomain
 *            Connect all hosts to the pool and to the domains
 */
protected void connectAllHostToPoolAndDomain(final StorageDomain masterDomain) {
    final List<VDS> vdsList = getAllRunningVdssInPool();
    final StoragePool storagePool = getStoragePool();
    SynchronizeNumberOfAsyncOperations sync = new SynchronizeNumberOfAsyncOperations(vdsList.size(), null, new ActivateDeactivateSingleAsyncOperationFactory() {

        @Override
        public ISingleAsyncOperation createSingleAsyncOperation() {
            return Injector.injectMembers(new ConnectVDSToPoolAndDomains(vdsList, masterDomain, storagePool));
        }

        @Override
        public void initialize(List parameters) {
        // no need to initilalize params
        }
    });
    sync.execute();
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) VDS(org.ovirt.engine.core.common.businessentities.VDS) SynchronizeNumberOfAsyncOperations(org.ovirt.engine.core.utils.SynchronizeNumberOfAsyncOperations) ISingleAsyncOperation(org.ovirt.engine.core.utils.ISingleAsyncOperation) List(java.util.List)

Example 2 with SynchronizeNumberOfAsyncOperations

use of org.ovirt.engine.core.utils.SynchronizeNumberOfAsyncOperations in project ovirt-engine by oVirt.

the class StorageHandlingCommandBase method runSynchronizeOperation.

protected void runSynchronizeOperation(ActivateDeactivateSingleAsyncOperationFactory factory, Object... addionalParams) {
    List<VDS> allRunningVdsInPool = getAllRunningVdssInPool();
    ArrayList<Object> parameters = initAsyncOperationParameters(allRunningVdsInPool);
    if (addionalParams.length > 0) {
        parameters.addAll(Arrays.asList(addionalParams));
    }
    SynchronizeNumberOfAsyncOperations sync = new SynchronizeNumberOfAsyncOperations(allRunningVdsInPool.size(), parameters, factory);
    sync.execute();
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) SynchronizeNumberOfAsyncOperations(org.ovirt.engine.core.utils.SynchronizeNumberOfAsyncOperations)

Aggregations

VDS (org.ovirt.engine.core.common.businessentities.VDS)2 SynchronizeNumberOfAsyncOperations (org.ovirt.engine.core.utils.SynchronizeNumberOfAsyncOperations)2 List (java.util.List)1 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)1 ISingleAsyncOperation (org.ovirt.engine.core.utils.ISingleAsyncOperation)1