use of org.ovirt.engine.core.common.businessentities.Cluster in project ovirt-engine by oVirt.
the class VnicProfileMappingModel method mergeShownRows.
private void mergeShownRows() {
for (Entry<Cluster, List<VnicProfileMappingItem>> showCluster : shownMappingRows.entrySet()) {
final Cluster cluster = showCluster.getKey();
final List<VnicProfileMappingItem> showClusterRows = showCluster.getValue();
final Set<VnicProfileMappingEntity> existingMappings;
if (externalVnicProfiles.containsKey(cluster)) {
existingMappings = externalVnicProfiles.get(cluster);
} else {
existingMappings = new HashSet<>();
externalVnicProfiles.put(cluster, existingMappings);
}
for (VnicProfileMappingItem shownRow : showClusterRows) {
final VnicProfileMappingEntity shownMapping = shownRow.getEntity();
addOrReplace(existingMappings, shownMapping);
}
}
}
use of org.ovirt.engine.core.common.businessentities.Cluster in project ovirt-engine by oVirt.
the class ImportVmFromConfigurationCommand method initUnregisteredVM.
private void initUnregisteredVM() {
List<OvfEntityData> ovfEntityDataList = unregisteredOVFDataDao.getByEntityIdAndStorageDomain(getParameters().getContainerId(), getParameters().getStorageDomainId());
if (!ovfEntityDataList.isEmpty()) {
try {
// We should get only one entity, since we fetched the entity with a specific Storage Domain
ovfEntityData = ovfEntityDataList.get(0);
FullEntityOvfData fullEntityOvfData = ovfHelper.readVmFromOvf(ovfEntityData.getOvfData());
VM vmFromConfiguration = fullEntityOvfData.getVm();
if (Guid.isNullOrEmpty(getParameters().getClusterId())) {
Cluster cluster = drMappingHelper.getMappedCluster(fullEntityOvfData.getClusterName(), vmFromConfiguration.getId(), getParameters().getClusterMap());
if (cluster != null) {
getParameters().setClusterId(cluster.getId());
}
}
vmFromConfiguration.setClusterId(getParameters().getClusterId());
getParameters().setVm(vmFromConfiguration);
getParameters().setDestDomainId(ovfEntityData.getStorageDomainId());
getParameters().setSourceDomainId(ovfEntityData.getStorageDomainId());
getParameters().setUserToRoles(fullEntityOvfData.getUserToRoles());
// For quota, update disks when required
if (getParameters().getDiskMap() != null) {
vmFromConfiguration.setDiskMap(getParameters().getDiskMap());
vmFromConfiguration.setImages(getDiskImageListFromDiskMap(getParameters().getDiskMap()));
}
// Note: The VM's OVF does not preserve the username and password for the LUN's connection.
// Therefore to achieve a simple VM registration the iSCSI storage server should not use
// credentials, although if the user will use the mapping attribute, one can set the credentials through
// there.
drMappingHelper.mapExternalLunDisks(DisksFilter.filterLunDisks(vmFromConfiguration.getDiskMap().values()), getParameters().getExternalLunMap());
mapEntities(fullEntityOvfData);
} catch (OvfReaderException e) {
log.error("Failed to parse a given ovf configuration: {}:\n{}", e.getMessage(), ovfEntityData.getOvfData());
log.debug("Exception", e);
}
}
}
use of org.ovirt.engine.core.common.businessentities.Cluster in project ovirt-engine by oVirt.
the class GlusterGeoRepSyncJob method refreshGeoRepDataForVolume.
/**
* Exposing this to be called via BLL command in case of force sync of geo-replication session data for volume
*/
public void refreshGeoRepDataForVolume(final GlusterVolumeEntity volume) {
if (volume == null) {
throw new EngineException(EngineError.GlusterVolumeGeoRepSyncFailed, "No volume information");
}
Cluster cluster = clusterDao.get(volume.getClusterId());
discoverGeoRepDataInCluster(cluster, volume);
List<GlusterGeoRepSession> geoRepSessions = geoRepDao.getGeoRepSessions(volume.getId());
refreshGeoRepSessionStatusForSessions(cluster, geoRepSessions);
}
use of org.ovirt.engine.core.common.businessentities.Cluster in project ovirt-engine by oVirt.
the class GlusterHookSyncJob method refreshHooks.
@OnTimerMethodAnnotation("refreshHooks")
public void refreshHooks() {
log.debug("Refreshing hooks list");
List<Cluster> clusters = clusterDao.getAll();
for (Cluster cluster : clusters) {
refreshHooksInCluster(cluster, false);
}
}
use of org.ovirt.engine.core.common.businessentities.Cluster in project ovirt-engine by oVirt.
the class GlusterHostValidator method checkGlusterQuorum.
public List<String> checkGlusterQuorum(Cluster cluster, Iterable<Guid> selectedHostIdsForMaintenance) {
List<String> volumesWithoutQuorum = new ArrayList<>();
if (cluster.supportsGlusterService()) {
List<GlusterBrickEntity> bricksGoingToMaintenance = new ArrayList<>();
for (Guid serverId : selectedHostIdsForMaintenance) {
bricksGoingToMaintenance.addAll(brickDao.getGlusterVolumeBricksByServerId(serverId));
}
List<GlusterVolumeEntity> volumesInCluster = volumeDao.getByClusterId(cluster.getId());
volumesWithoutQuorum = volumesInCluster.stream().filter(volume -> volume.getStatus() == GlusterStatus.UP && volume.getVolumeType().isReplicatedType() && !isQuorumMet(volume, bricksGoingToMaintenance)).map(v -> v.getName()).collect(Collectors.toList());
}
return volumesWithoutQuorum;
}
Aggregations