Search in sources :

Example 1 with VmHostDevicesParameters

use of org.ovirt.engine.core.common.action.VmHostDevicesParameters in project ovirt-engine by oVirt.

the class BackendVmHostDevicesResource method add.

@Override
public Response add(final HostDevice hostDevice) {
    validateParameters(hostDevice, "id|name");
    String deviceName = hostDevice.getName();
    if (hostDevice.isSetId()) {
        // in case both 'name' and 'id' is set, 'id' takes priority
        deviceName = HexUtils.hex2string(hostDevice.getId());
    }
    return performCreate(ActionType.AddVmHostDevices, new VmHostDevicesParameters(vmId, deviceName), new DeviceNameResolver(deviceName));
}
Also used : VmHostDevicesParameters(org.ovirt.engine.core.common.action.VmHostDevicesParameters)

Example 2 with VmHostDevicesParameters

use of org.ovirt.engine.core.common.action.VmHostDevicesParameters in project ovirt-engine by oVirt.

the class VmHostDeviceListModel method onRemove.

private void onRemove() {
    final ConfirmationModel model = (ConfirmationModel) getConfirmWindow();
    if (model.getProgress() != null) {
        return;
    }
    model.startProgress();
    ArrayList<String> deviceNames = getSelectedPrimaryDeviceNames();
    Frontend.getInstance().runAction(ActionType.RemoveVmHostDevices, new VmHostDevicesParameters(getEntity().getId(), deviceNames), result -> {
        model.stopProgress();
        setConfirmWindow(null);
    });
}
Also used : VmHostDevicesParameters(org.ovirt.engine.core.common.action.VmHostDevicesParameters) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 3 with VmHostDevicesParameters

use of org.ovirt.engine.core.common.action.VmHostDevicesParameters in project ovirt-engine by oVirt.

the class VmHostDeviceListModel method doAttachDevices.

private void doAttachDevices(Collection<EntityModel<HostDeviceView>> items) {
    List<String> deviceNamesToAttach = new ArrayList<>();
    for (EntityModel<HostDeviceView> model : items) {
        deviceNamesToAttach.add(model.getEntity().getDeviceName());
    }
    Frontend.getInstance().runAction(ActionType.AddVmHostDevices, new VmHostDevicesParameters(getEntity().getId(), deviceNamesToAttach), result -> {
        syncSearch();
        getWindow().stopProgress();
        setWindow(null);
    });
}
Also used : HostDeviceView(org.ovirt.engine.core.common.businessentities.HostDeviceView) VmHostDevicesParameters(org.ovirt.engine.core.common.action.VmHostDevicesParameters) ArrayList(java.util.ArrayList)

Aggregations

VmHostDevicesParameters (org.ovirt.engine.core.common.action.VmHostDevicesParameters)3 ArrayList (java.util.ArrayList)1 HostDeviceView (org.ovirt.engine.core.common.businessentities.HostDeviceView)1 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)1