Search in sources :

Example 1 with ChangeDiskCommandParameters

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();
}
Also used : ChangeDiskCommandParameters(org.ovirt.engine.core.common.action.ChangeDiskCommandParameters) VM(org.ovirt.engine.core.common.businessentities.VM) VmManagementParametersBase(org.ovirt.engine.core.common.action.VmManagementParametersBase)

Example 2 with ChangeDiskCommandParameters

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);
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) ChangeDiskCommandParameters(org.ovirt.engine.core.common.action.ChangeDiskCommandParameters)

Example 3 with ChangeDiskCommandParameters

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);
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) ChangeDiskCommandParameters(org.ovirt.engine.core.common.action.ChangeDiskCommandParameters) ChangeCDModel(org.ovirt.engine.ui.uicommonweb.models.configure.ChangeCDModel)

Aggregations

ChangeDiskCommandParameters (org.ovirt.engine.core.common.action.ChangeDiskCommandParameters)3 VM (org.ovirt.engine.core.common.businessentities.VM)3 VmManagementParametersBase (org.ovirt.engine.core.common.action.VmManagementParametersBase)1 ChangeCDModel (org.ovirt.engine.ui.uicommonweb.models.configure.ChangeCDModel)1