use of org.ovirt.engine.core.common.action.ChangeDiskCommandParameters in project ovirt-engine by oVirt.
the class BackendVmCdromResource method update.
@Override
public Cdrom update(Cdrom cdrom) {
validateParameters(cdrom, "file");
boolean current = ParametersHelper.getBooleanParameter(httpHeaders, uriInfo, CURRENT, true, false);
if (current) {
ChangeDiskCommandParameters parameters = new ChangeDiskCommandParameters(vmId, cdrom.getFile().getId());
performAction(ActionType.ChangeDisk, parameters);
} else {
VM vm = getVm();
vm = map(cdrom, vm);
VmManagementParametersBase parameters = new VmManagementParametersBase(vm);
performAction(ActionType.UpdateVm, parameters);
}
return get();
}
use of org.ovirt.engine.core.common.action.ChangeDiskCommandParameters in project ovirt-engine by oVirt.
the class VmListModel method onChangeCD.
private void onChangeCD() {
VM vm = getSelectedItem();
if (vm == null) {
cancel();
return;
}
AttachCdModel model = (AttachCdModel) getWindow();
if (model.getProgress() != null) {
return;
}
if (Objects.equals(model.getIsoImage().getSelectedItem().getRepoImageId(), vm.getCurrentCd())) {
cancel();
return;
}
String isoName = // $NON-NLS-1$
Objects.equals(model.getIsoImage().getSelectedItem().getRepoImageId(), ConsoleModel.getEjectLabel()) ? // $NON-NLS-1$
"" : model.getIsoImage().getSelectedItem().getRepoImageId();
model.startProgress();
Frontend.getInstance().runAction(ActionType.ChangeDisk, new ChangeDiskCommandParameters(vm.getId(), isoName), result -> {
AttachCdModel attachCdModel = (AttachCdModel) result.getState();
attachCdModel.stopProgress();
cancel();
}, model);
}
use of org.ovirt.engine.core.common.action.ChangeDiskCommandParameters in project ovirt-engine by oVirt.
the class VmListModel method changeCD.
private void changeCD(Object sender, EventArgs e) {
ChangeCDModel model = (ChangeCDModel) sender;
// TODO: Patch!
String isoName = model.getTitle();
if (Objects.equals(isoName, ConstantsManager.getInstance().getConstants().noCds())) {
return;
}
Object tempVar = getSelectedItem();
VM vm = (VM) ((tempVar instanceof VM) ? tempVar : null);
if (vm == null) {
return;
}
Frontend.getInstance().runMultipleAction(ActionType.ChangeDisk, new ArrayList<>(Arrays.asList(new ActionParametersBase[] { new ChangeDiskCommandParameters(vm.getId(), // $NON-NLS-1$
Objects.equals(isoName, ConsoleModel.getEjectLabel()) ? "" : isoName) })), result -> {
}, null);
}
Aggregations