Search in sources :

Example 1 with ReconstructMasterVDSCommandParameters

use of org.ovirt.engine.core.common.vdscommands.ReconstructMasterVDSCommandParameters in project ovirt-engine by oVirt.

the class ReconstructMasterDomainCommand method reconstructMaster.

protected boolean reconstructMaster() {
    isLastMaster = proceedStorageDomainTreatmentByDomainType(getNewMasterStorageDomain(), false);
    // To issue a reconstructMaster you need to set the domain inactive unless the selected domain is the current master
    if (getParameters().isInactive() && !getStorageDomain().getId().equals(getNewMasterStorageDomainId())) {
        executeInNewTransaction(() -> {
            setStorageDomainStatus(StorageDomainStatus.Inactive, getCompensationContext());
            calcStoragePoolStatusByDomainsStatus();
            getCompensationContext().stateChanged();
            return null;
        });
    }
    if (isLastMaster) {
        return stopSpm();
    }
    boolean commandSucceeded = stopSpm();
    if (commandSucceeded) {
        commandSucceeded = runVdsCommand(VDSCommandType.DisconnectStoragePool, new DisconnectStoragePoolVDSCommandParameters(getVds().getId(), getStoragePool().getId(), getVds().getVdsSpmId())).getSucceeded();
    }
    if (!commandSucceeded) {
        return false;
    }
    List<StoragePoolIsoMap> domains = storagePoolIsoMapDao.getAllForStoragePool(getStoragePool().getId());
    // set to true here in case of failure in executing/getting answer from the reconstruct vds command,
    // unless we know that the command failed we assume that it succeeded (use by RecoveryStoragePool command in
    // order to avoid detaching domain that is already part of the pool in vdsm).
    setActionReturnValue(true);
    return runVdsCommand(VDSCommandType.ReconstructMaster, new ReconstructMasterVDSCommandParameters(getVds().getId(), getVds().getVdsSpmId(), getStoragePool().getId(), getStoragePool().getName(), getNewMasterStorageDomainId(), domains, getStoragePool().getMasterDomainVersion())).getSucceeded();
}
Also used : StoragePoolIsoMap(org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap) ReconstructMasterVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.ReconstructMasterVDSCommandParameters) DisconnectStoragePoolVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.DisconnectStoragePoolVDSCommandParameters)

Aggregations

StoragePoolIsoMap (org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap)1 DisconnectStoragePoolVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.DisconnectStoragePoolVDSCommandParameters)1 ReconstructMasterVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.ReconstructMasterVDSCommandParameters)1