use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.
the class BlockStorageDomainHelper method fillMetadataDevicesInfo.
public void fillMetadataDevicesInfo(StorageDomainStatic storageDomainStatic, Guid vdsId) {
try {
@SuppressWarnings("unchecked") StorageDomainStatic domainFromIrs = ((Pair<StorageDomainStatic, Guid>) resourceManager.runVdsCommand(VDSCommandType.HSMGetStorageDomainInfo, new HSMGetStorageDomainInfoVDSCommandParameters(vdsId, storageDomainStatic.getId())).getReturnValue()).getFirst();
storageDomainStatic.setFirstMetadataDevice(domainFromIrs.getFirstMetadataDevice());
storageDomainStatic.setVgMetadataDevice(domainFromIrs.getVgMetadataDevice());
} catch (Exception e) {
storageDomainStatic.setFirstMetadataDevice(null);
storageDomainStatic.setVgMetadataDevice(null);
log.info("Failed to get the domain info");
}
}
use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.
the class IrsProxy method handleMonitoredDomainsForHost.
/**
* Provides handling for the domains that are monitored by the given host.
* @return map between the domain id and the reason for domains that
* the host reporting is problematic for.
*/
private Map<Guid, DomainMonitoringResult> handleMonitoredDomainsForHost(final Guid vdsId, final String vdsName, final ArrayList<VDSDomainsData> data, Collection<Guid> monitoredDomains) {
Map<Guid, DomainMonitoringResult> domainsProblematicReportInfo = new HashMap<>();
// build a list of all domains in pool
// which are in status Active or Unknown
Set<Guid> activeDomainsInPool = new HashSet<>(storageDomainStaticDao.getAllIds(storagePoolId, StorageDomainStatus.Active));
Set<Guid> unknownDomainsInPool = new HashSet<>(storageDomainStaticDao.getAllIds(storagePoolId, StorageDomainStatus.Unknown));
Set<Guid> inActiveDomainsInPool = new HashSet<>(storageDomainStaticDao.getAllIds(storagePoolId, StorageDomainStatus.Inactive));
// visible by the host.
for (Guid tempDomainId : activeDomainsInPool) {
if (!monitoredDomains.contains(tempDomainId)) {
domainsProblematicReportInfo.put(tempDomainId, DomainMonitoringResult.NOT_REPORTED);
}
}
for (Guid tempDomainId : unknownDomainsInPool) {
if (!monitoredDomains.contains(tempDomainId)) {
domainsProblematicReportInfo.put(tempDomainId, DomainMonitoringResult.NOT_REPORTED);
}
}
Collection<Guid> storageDomainsToSync = new LinkedList<>();
// Unknown domains in pool
for (VDSDomainsData tempData : data) {
StorageDomainStatic storageDomain = storageDomainStaticDao.get(tempData.getDomainId());
if (activeDomainsInPool.contains(tempData.getDomainId()) || unknownDomainsInPool.contains(tempData.getDomainId())) {
DomainMonitoringResult domainMonitoringResult = analyzeDomainReport(tempData, false);
if (domainMonitoringResult.invalidAndActual()) {
domainsProblematicReportInfo.put(tempData.getDomainId(), domainMonitoringResult);
} else if (domainMonitoringResult.actual() && tempData.getDelay() > Config.<Double>getValue(ConfigValues.MaxStorageVdsDelayCheckSec)) {
logDelayedDomain(vdsName, storageDomain.getName(), tempData.getDelay());
}
} else if (inActiveDomainsInPool.contains(tempData.getDomainId()) && analyzeDomainReport(tempData, false).validAndActual()) {
log.warn("Storage Domain '{}' was reported by Host '{}' as Active in Pool '{}', moving to active status", getDomainIdTuple(tempData.getDomainId()), vdsName, storagePoolId);
StoragePoolIsoMap map = storagePoolIsoMapDao.get(new StoragePoolIsoMapId(tempData.getDomainId(), storagePoolId));
map.setStatus(StorageDomainStatus.Active);
storagePoolIsoMapDao.update(map);
if (storageDomain.getStorageType().isBlockDomain()) {
storageDomainsToSync.add(storageDomain.getId());
}
}
}
// For block domains, synchronize LUN details comprising the storage domain with the DB
if (!storageDomainsToSync.isEmpty()) {
getEventListener().syncStorageDomainsLuns(vdsId, storageDomainsToSync);
}
return domainsProblematicReportInfo;
}
use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.
the class IrsProxy method processDomainRecovery.
private EventResult processDomainRecovery(final Guid domainId) {
EventResult result = null;
// build a list of all the hosts in status UP in
// Pool.
List<Guid> vdssInPool = new ArrayList<>();
// Note - this method is used as it returns only hosts from VIRT supported clusters
// (we use the domain monitoring results only from those clusters hosts).
// every change to it should be inspected carefully.
List<VDS> allVds = vdsDao.getAllForStoragePoolAndStatus(storagePoolId, null);
Map<Guid, VDS> vdsMap = new HashMap<>();
for (VDS tempVDS : allVds) {
vdsMap.put(tempVDS.getId(), tempVDS);
if (tempVDS.getStatus() == VDSStatus.Up) {
vdssInPool.add(tempVDS.getId());
}
}
// build a list of all the hosts that did not report
// on this domain as in problem.
// Mark the above list as hosts we suspect are in
// problem.
Set<Guid> hostsThatReportedDomainAsInProblem = domainsInProblem.get(domainId);
List<Guid> vdssInProblem = new ArrayList<>();
for (Guid tempVDSId : vdssInPool) {
if (!hostsThatReportedDomainAsInProblem.contains(tempVDSId)) {
vdssInProblem.add(tempVDSId);
}
}
// If not All the hosts in status UP reported on
// this domain as in problem. We assume the problem
// is with the hosts
// that did report on a problem with this domain.
// (and not a problem with the domain itself).
StorageDomainStatic storageDomain = storageDomainStaticDao.get(domainId);
String domainIdTuple = getDomainIdTuple(domainId);
List<Guid> nonOpVdss = new ArrayList<>();
if (vdssInProblem.size() > 0) {
if (storageDomain.getStorageDomainType() != StorageDomainType.ImportExport && storageDomain.getStorageDomainType() != StorageDomainType.ISO) {
// operational.
for (final Guid vdsId : domainsInProblem.get(domainId)) {
VDS vds = vdsMap.get(vdsId);
if (vds == null) {
log.warn("vds '{}' reported domain '{}' - as in problem but cannot find vds in db!!", vdsId, domainIdTuple);
} else if (vds.getStatus() == VDSStatus.Up) {
log.warn("vds '{}' reported domain '{}' as in problem, attempting to move the vds to status NonOperational", vds.getName(), domainIdTuple);
final Map<String, String> customLogValues = Collections.singletonMap("StorageDomainNames", storageDomain.getName());
ThreadPoolUtil.execute(() -> resourceManager.getEventListener().vdsNonOperational(vdsId, NonOperationalReason.STORAGE_DOMAIN_UNREACHABLE, true, domainId, customLogValues));
nonOpVdss.add(vdsId);
} else {
log.warn("vds '{}' reported domain '{}' as in problem, vds is in status '{}', no need to move to nonoperational", vds.getName(), domainIdTuple, vds.getStatus());
}
}
} else {
log.warn("Storage domain '{}' is not visible to one or more hosts. " + "Since the domain's type is '{}', hosts status will not be changed to non-operational", domainIdTuple, storageDomain.getStorageDomainType());
}
result = new EventResult(true, EventType.VDSSTORAGEPROBLEMS);
} else {
// Domain.
if (storageDomain.getStorageDomainType() != StorageDomainType.Master) {
log.error("Domain '{}' was reported by all hosts in status UP as problematic. Moving the domain to NonOperational.", domainIdTuple);
result = getEventListener().storageDomainNotOperational(domainId, storagePoolId);
} else {
log.warn("Domain '{}' was reported by all hosts in status UP as problematic. Not moving the domain to NonOperational because it is being reconstructed now.", domainIdTuple);
result = getEventListener().masterDomainNotOperational(domainId, storagePoolId, false, false);
}
}
// clear from cache of domainsInProblem
clearDomainFromCache(domainId, nonOpVdss);
return result;
}
use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.
the class StorageDataCenterListModel method onAttach.
private void onAttach() {
final ListModel<EntityModel<StoragePool>> model = (ListModel<EntityModel<StoragePool>>) getWindow();
if (model.getProgress() != null) {
return;
}
if (getEntity() == null) {
cancel();
return;
}
ArrayList<StoragePool> items = new ArrayList<>();
for (EntityModel<StoragePool> a : model.getItems()) {
if (a.getIsSelected()) {
items.add(a.getEntity());
}
}
if (items.size() == 0) {
cancel();
return;
}
setSelectedDataCentersForAttach(items);
model.startProgress();
if (getEntity().getStorageDomainType() == StorageDomainType.Data) {
StoragePool dataCenter = items.get(0);
ArrayList<StorageDomain> storageDomains = new ArrayList<>();
storageDomains.add(getEntity());
AsyncDataProvider.getInstance().getStorageDomainsWithAttachedStoragePoolGuid(new AsyncQuery<>(attachedStorageDomains -> {
if (!attachedStorageDomains.isEmpty()) {
ConfirmationModel confirmationModel = new ConfirmationModel();
setWindow(null);
setWindow(confirmationModel);
List<String> stoageDomainNames = new ArrayList<>();
for (StorageDomainStatic domain : attachedStorageDomains) {
stoageDomainNames.add(domain.getStorageName());
}
confirmationModel.setItems(stoageDomainNames);
confirmationModel.setTitle(ConstantsManager.getInstance().getConstants().storageDomainsAttachedToDataCenterWarningTitle());
confirmationModel.setMessage(ConstantsManager.getInstance().getConstants().storageDomainsAttachedToDataCenterWarningMessage());
confirmationModel.setHelpTag(HelpTag.attach_storage_domain_confirmation);
// $NON-NLS-1$
confirmationModel.setHashName("attach_storage_domain_confirmation");
confirmationModel.getLatch().setIsAvailable(true);
confirmationModel.getLatch().setIsChangeable(true);
// $NON-NLS-1$
UICommand onApprove = new UICommand("OnAttachApprove", StorageDataCenterListModel.this);
onApprove.setTitle(ConstantsManager.getInstance().getConstants().ok());
onApprove.setIsDefault(true);
confirmationModel.getCommands().add(onApprove);
// $NON-NLS-1$
UICommand cancel = new UICommand("Cancel", StorageDataCenterListModel.this);
cancel.setTitle(ConstantsManager.getInstance().getConstants().cancel());
cancel.setIsCancel(true);
confirmationModel.getCommands().add(cancel);
} else {
executeAttachStorageDomains(model);
}
}), dataCenter, storageDomains);
} else {
executeAttachStorageDomains(model);
}
}
use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.
the class AbstractOpenStackStorageProviderProxy method addStorageDomain.
protected Guid addStorageDomain(StorageType storageType, StorageDomainType storageDomainType) {
// Storage domain static
StorageDomainStatic domainStaticEntry = new StorageDomainStatic();
domainStaticEntry.setId(Guid.newGuid());
domainStaticEntry.setStorage(provider.getId().toString());
domainStaticEntry.setStorageName(provider.getName());
domainStaticEntry.setDescription(provider.getDescription());
domainStaticEntry.setStorageFormat(StorageFormatType.V1);
domainStaticEntry.setStorageType(storageType);
domainStaticEntry.setStorageDomainType(storageDomainType);
domainStaticEntry.setWipeAfterDelete(false);
domainStaticEntry.setDiscardAfterDelete(false);
getDbFacade().getStorageDomainStaticDao().save(domainStaticEntry);
// Storage domain dynamic
StorageDomainDynamic domainDynamicEntry = new StorageDomainDynamic();
domainDynamicEntry.setId(domainStaticEntry.getId());
getDbFacade().getStorageDomainDynamicDao().save(domainDynamicEntry);
return domainStaticEntry.getId();
}
Aggregations