use of org.ovirt.engine.core.common.action.ActionParametersBase in project ovirt-engine by oVirt.
the class RegisterTemplateModel method onSave.
protected void onSave() {
List<ActionParametersBase> parameters = prepareActionParameters();
ActionType actionType = ActionType.ImportVmTemplateFromConfiguration;
onSave(actionType, parameters);
}
use of org.ovirt.engine.core.common.action.ActionParametersBase in project ovirt-engine by oVirt.
the class RegisterVmModel method prepareParameters.
private List<ActionParametersBase> prepareParameters() {
ArrayList<ActionParametersBase> parameters = new ArrayList<>();
for (RegisterVmData registerVmData : getEntities().getItems()) {
VM vm = registerVmData.getEntity();
Cluster cluster = registerVmData.getCluster().getSelectedItem();
ImportVmFromConfParameters params = new ImportVmFromConfParameters(cloneExternalVnicProfiles(cluster), registerVmData.getReassignMacs().getEntity());
params.setContainerId(vm.getId());
params.setStorageDomainId(getStorageDomainId());
params.setImagesExistOnTargetStorageDomain(true);
params.setClusterId(cluster != null ? cluster.getId() : null);
params.setAllowPartialImport(registerVmData.getAllowPartialImport().getEntity());
if (isQuotaEnabled()) {
Quota quota = registerVmData.getClusterQuota().getSelectedItem();
params.setQuotaId(quota != null ? quota.getId() : null);
params.setDiskMap(vm.getDiskMap());
updateDiskQuotas(new ArrayList<>(params.getDiskMap().values()));
}
parameters.add(params);
}
return parameters;
}
use of org.ovirt.engine.core.common.action.ActionParametersBase in project ovirt-engine by oVirt.
the class StorageDataCenterListModel method onDetach.
private void onDetach() {
final ConfirmationModel model = (ConfirmationModel) getWindow();
if (!model.validate()) {
return;
}
setdetachPrms(new ArrayList<ActionParametersBase>());
setremovePrms(new ArrayList<ActionParametersBase>());
for (Object item : getSelectedItems()) {
StorageDomain storageDomain = (StorageDomain) item;
if (storageDomain.getStorageType() != StorageType.LOCALFS) {
DetachStorageDomainFromPoolParameters param = new DetachStorageDomainFromPoolParameters();
param.setStorageDomainId(getEntity().getId());
if (storageDomain.getStoragePoolId() != null) {
param.setStoragePoolId(storageDomain.getStoragePoolId());
}
getdetachPrms().add(param);
} else {
AsyncDataProvider.getInstance().getLocalStorageHost(new AsyncQuery<>(locaVds -> {
StorageDomain storage = getEntity();
RemoveStorageDomainParameters tempVar = new RemoveStorageDomainParameters(storage.getId());
tempVar.setVdsId(locaVds != null ? locaVds.getId() : null);
tempVar.setDoFormat(model.getForce().getEntity());
RemoveStorageDomainParameters removeStorageDomainParameters = tempVar;
getremovePrms().add(removeStorageDomainParameters);
if (getremovePrms().size() + getdetachPrms().size() == getSelectedItems().size()) {
Frontend.getInstance().runMultipleAction(ActionType.RemoveStorageDomain, getremovePrms());
}
}), storageDomain.getStoragePoolName());
}
if (getdetachPrms().size() > 0) {
Frontend.getInstance().runMultipleAction(ActionType.DetachStorageDomainFromPool, getdetachPrms());
}
}
cancel();
}
use of org.ovirt.engine.core.common.action.ActionParametersBase in project ovirt-engine by oVirt.
the class StorageDataCenterListModel method activate.
private void activate() {
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (Object item : getSelectedItems()) {
StorageDomain a = (StorageDomain) item;
StorageDomainPoolParametersBase parameters = new StorageDomainPoolParametersBase();
parameters.setStorageDomainId(getEntity().getId());
if (a.getStoragePoolId() != null) {
parameters.setStoragePoolId(a.getStoragePoolId());
}
list.add(parameters);
}
Frontend.getInstance().runMultipleAction(ActionType.ActivateStorageDomain, list, result -> {
}, null);
}
use of org.ovirt.engine.core.common.action.ActionParametersBase in project ovirt-engine by oVirt.
the class UploadImageModel method pauseUploads.
public static void pauseUploads(List<? extends Disk> disks) {
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (Disk disk : disks) {
ImageTransfer updates = new ImageTransfer();
updates.setPhase(ImageTransferPhase.PAUSED_USER);
TransferImageStatusParameters parameters = new TransferImageStatusParameters();
parameters.setUpdates(updates);
parameters.setDiskId(disk.getId());
list.add(parameters);
}
Frontend.getInstance().runMultipleAction(ActionType.TransferImageStatus, list);
}
Aggregations