Source:
private EventResult runConnectHostToPoolEvent(final Guid storagePoolId, final VDS vds) { EventResult result = new EventResult(true, EventType.VDSCONNECTTOPOOL); StoragePool storagePool = getStoragePoolDAO().get(storagePoolId); StorageDomain masterDomain = getStorageDomainDAO().getStorageDomainByTypeAndPool(storagePoolId, StorageDomainType.Master); boolean masterDomainInactiveOrUnknown = masterDomain.getStatus() == StorageDomainStatus.InActive || masterDomain.getStatus() == StorageDomainStatus.Unknown; VDSReturnValue returnValue = ResourceManager.getInstance().runVdsCommand(VDSCommandType.ConnectStoragePool, new ConnectStoragePoolVDSCommandParameters(vds.getId(), storagePoolId, vds.getVdsSpmId(), masterDomain.getId(), storagePool.getmaster_domain_version())); if (!returnValue.getSucceeded()) { VDSError error = returnValue.getVdsError(); if ((error == null || error.getCode() != VdcBllErrors.CannotConnectMultiplePools) && masterDomainInactiveOrUnknown) { log.infoFormat("Could not connect host {0} to pool {1}, as the master domain is in inactive/unknown status - not failing the operation", vds.getName(), storagePool .getName()); } else { log.errorFormat("Could not connect host {0} to pool {1} with the message: {2}", vds.getName(), storagePool .getName(), error != null ? error.getMessage() : ""); result.setSuccess(false); } } if (result.isSuccess()) { result.setSuccess(proceedVdsStats(!masterDomainInactiveOrUnknown)); if (!result.isSuccess()) { AuditLogDirector.log(new AuditLogableBase(getVdsId()), AuditLogType.VDS_STORAGE_VDS_STATS_FAILED); } } return result; }

Target:
private EventResult runConnectHostToPoolEvent(final Guid storagePoolId, final VDS vds) { EventResult result = new EventResult(true, EventType.VDSCONNECTTOPOOL); StoragePool storagePool = getStoragePoolDAO().get(storagePoolId); StorageDomain masterDomain = getStorageDomainDAO().getStorageDomainByTypeAndPool(storagePoolId, StorageDomainType.Master); boolean masterDomainInactiveOrUnknown = masterDomain.getStatus() == StorageDomainStatus.InActive || masterDomain.getStatus() == StorageDomainStatus.Unknown; VDSError error = null; try { VDSReturnValue vdsReturnValue = runVdsCommand(VDSCommandType.ConnectStoragePool, new ConnectStoragePoolVDSCommandParameters(vds.getId(), storagePoolId, vds.getVdsSpmId(), masterDomain.getId(), storagePool.getmaster_domain_version())); if (!vdsReturnValue.getSucceeded()) { error = vdsReturnValue.getVdsError(); } } catch (VdcBLLException e) { error = e.getVdsError(); } if (error != null) { if (error.getCode() != VdcBllErrors.CannotConnectMultiplePools && masterDomainInactiveOrUnknown) { log.infoFormat("Could not connect host {0} to pool {1}, as the master domain is in inactive/unknown status - not failing the operation", vds.getName(), storagePool .getName()); } else { log.errorFormat("Could not connect host {0} to pool {1} with the message: {2}", vds.getName(), storagePool .getName(), error.getMessage()); result.setSuccess(false); } } if (result.isSuccess()) { result.setSuccess(proceedVdsStats(!masterDomainInactiveOrUnknown)); if (!result.isSuccess()) { AuditLogDirector.log(new AuditLogableBase(getVdsId()), AuditLogType.VDS_STORAGE_VDS_STATS_FAILED); } } return result; }