use of org.ovirt.engine.core.common.scheduling.AffinityGroup in project ovirt-engine by oVirt.
the class AffinityGroupListModel method edit.
private void edit() {
if (getWindow() != null) {
return;
}
AffinityGroup affinityGroup = getSelectedItem();
if (affinityGroup == null) {
return;
}
AffinityGroupModel model = new EditAffinityGroupModel(affinityGroup, this, getClusterId(), getClusterName());
model.init();
setWindow(model);
}
use of org.ovirt.engine.core.common.scheduling.AffinityGroup in project ovirt-engine by oVirt.
the class AffinityGroupListModel method onRemove.
private void onRemove() {
ConfirmationModel model = (ConfirmationModel) getConfirmWindow();
if (model.getProgress() != null) {
return;
}
ArrayList<ActionParametersBase> parameters = new ArrayList<>();
for (AffinityGroup affinityGroup : getSelectedItems()) {
parameters.add(new AffinityGroupCRUDParameters(affinityGroup.getId(), affinityGroup));
}
model.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.RemoveAffinityGroup, parameters, result -> {
ConfirmationModel localModel = (ConfirmationModel) result.getState();
localModel.stopProgress();
cancel();
}, model);
}
use of org.ovirt.engine.core.common.scheduling.AffinityGroup in project ovirt-engine by oVirt.
the class VmAffinityGroupListModel method getNewAffinityGroup.
@Override
protected AffinityGroup getNewAffinityGroup() {
AffinityGroup affinityGroup = super.getNewAffinityGroup();
affinityGroup.setVmIds(new ArrayList<Guid>());
affinityGroup.getVmIds().add(getEntity().getId());
return affinityGroup;
}
use of org.ovirt.engine.core.common.scheduling.AffinityGroup in project ovirt-engine by oVirt.
the class AffinityGroupModel method onSave.
void onSave() {
if (!validate()) {
return;
}
if (getProgress() != null) {
return;
}
AffinityGroup group = getAffinityGroup();
group.setName(getName().getEntity());
group.setDescription(getDescription().getEntity());
group.setClusterId(clusterId);
// Save VM details
group.setVmEnforcing(getVmAffinityEnforcing().getEntity());
group.setVmAffinityRule(getVmAffinityRule().getSelectedItem());
group.setVmIds(getVmsSelectionModel().getSelectedVmIds());
// Save host details
group.setVdsEnforcing(getHostAffinityEnforcing().getEntity());
group.setVdsAffinityRule(getHostAffinityRule().getSelectedItem());
group.setVdsIds(getHostsSelectionModel().getSelectedHostIds());
startProgress();
Frontend.getInstance().runAction(saveActionType, new AffinityGroupCRUDParameters(group.getId(), group), result -> {
stopProgress();
if (result != null && result.getReturnValue() != null && result.getReturnValue().getSucceeded()) {
cancel();
}
}, this);
}
use of org.ovirt.engine.core.common.scheduling.AffinityGroup in project ovirt-engine by oVirt.
the class ProcessOvfUpdateForStoragePoolCommand method populateVmsMetadataForOvfUpdate.
/**
* Create and returns map contains valid vms metadata
*/
protected Map<Guid, KeyValuePairCompat<String, List<Guid>>> populateVmsMetadataForOvfUpdate(List<Guid> idsToProcess) {
Map<Guid, KeyValuePairCompat<String, List<Guid>>> vmsAndTemplateMetadata = new HashMap<>();
List<VM> vms = vmDao.getVmsByIds(idsToProcess);
for (VM vm : vms) {
if (VMStatus.ImageLocked != vm.getStatus()) {
updateVmDisksFromDb(vm);
if (!verifyImagesStatus(vm.getDiskList())) {
continue;
}
ArrayList<DiskImage> vmImages = ovfUpdateProcessHelper.getVmImagesFromDb(vm);
if (!verifyImagesStatus(vmImages)) {
continue;
}
vm.setSnapshots(snapshotDao.getAllWithConfiguration(vm.getId()));
if (!verifySnapshotsStatus(vm.getSnapshots())) {
continue;
}
ovfUpdateProcessHelper.loadVmData(vm);
Long currentDbGeneration = vmStaticDao.getDbGeneration(vm.getId());
if (currentDbGeneration == null) {
log.warn("currentDbGeneration of VM (name: '{}', id: '{}') is null, probably because the VM was deleted during the run of OvfDataUpdater.", vm.getName(), vm.getId());
continue;
}
if (vm.getStaticData().getDbGeneration() == currentDbGeneration) {
List<LunDisk> lunDisks = DisksFilter.filterLunDisks(vm.getDiskMap().values());
for (LunDisk lun : lunDisks) {
lun.getLun().setLunConnections(new ArrayList<>(storageServerConnectionDao.getAllForLun(lun.getLun().getId())));
}
List<AffinityGroup> affinityGroups = affinityGroupDao.getAllAffinityGroupsByVmId(vm.getId());
List<Label> affinityLabels = labelDao.getAllByEntityIds(Collections.singletonList(vm.getId()));
Set<DbUser> dbUsers = new HashSet<>(dbUserDao.getAllForVm(vm.getId()));
FullEntityOvfData fullEntityOvfData = new FullEntityOvfData(vm);
fullEntityOvfData.setDiskImages(vmImages);
fullEntityOvfData.setLunDisks(lunDisks);
fullEntityOvfData.setAffinityGroups(affinityGroups);
fullEntityOvfData.setAffinityLabels(affinityLabels);
fullEntityOvfData.setDbUsers(dbUsers);
ovfHelper.populateUserToRoles(fullEntityOvfData, vm.getId());
proccessedOvfConfigurationsInfo.add(ovfUpdateProcessHelper.buildMetadataDictionaryForVm(vm, vmsAndTemplateMetadata, fullEntityOvfData));
proccessedIdsInfo.add(vm.getId());
proccessedOvfGenerationsInfo.add(vm.getStaticData().getDbGeneration());
proccessDisksDomains(vm.getDiskList());
}
}
}
return vmsAndTemplateMetadata;
}
Aggregations