use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.
the class VmListModel method createSnapshot.
private void createSnapshot() {
VM vm = getSelectedItem();
if (vm == null || getWindow() != null) {
return;
}
SnapshotModel model = SnapshotModel.createNewSnapshotModel(this);
model.setValidateByVmSnapshots(true);
setWindow(model);
model.setVm(vm);
model.initialize();
}
use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.
the class VmListModel method onExportNoTemplates.
private void onExportNoTemplates() {
ExportVmModel model = (ExportVmModel) getWindow();
Guid storageDomainId = model.getStorage().getSelectedItem().getId();
if (model.getProgress() != null) {
return;
}
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (Object item : getSelectedItems()) {
VM a = (VM) item;
MoveOrCopyParameters parameters = new MoveOrCopyParameters(a.getId(), storageDomainId);
parameters.setForceOverride(model.getForceOverride().getEntity());
parameters.setCopyCollapse(model.getCollapseSnapshots().getEntity());
parameters.setTemplateMustExists(false);
list.add(parameters);
}
model.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.ExportVm, list, result -> {
ExportVmModel localModel = (ExportVmModel) result.getState();
localModel.stopProgress();
cancel();
}, model);
}
use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.
the class VmListModel method onPowerAction.
private void onPowerAction(ActionType actionType, PowerActionParametersFactory<?> parametersFactory) {
ConfirmationModel model = (ConfirmationModel) getWindow();
if (model.getProgress() != null) {
return;
}
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (Object item : getSelectedItems()) {
VM vm = (VM) item;
list.add(parametersFactory.createActionParameters(vm));
}
model.startProgress();
Frontend.getInstance().runMultipleAction(actionType, list, result -> {
ConfirmationModel localModel = (ConfirmationModel) result.getState();
localModel.stopProgress();
cancel();
}, model);
}
use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.
the class VmListModel method runOnce.
private void runOnce() {
VM vm = getSelectedItem();
// populating VMInit
AsyncDataProvider.getInstance().getVmById(new AsyncQuery<>(result -> {
RunOnceModel runOnceModel = new WebadminRunOnceModel(result, VmListModel.this);
setWindow(runOnceModel);
runOnceModel.init();
}), vm.getId());
}
use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.
the class VmListModel method changeCD.
private void changeCD() {
final VM vm = getSelectedItem();
if (vm == null) {
return;
}
AttachCdModel model = new AttachCdModel();
setWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().changeCDTitle());
model.setHelpTag(HelpTag.change_cd);
// $NON-NLS-1$
model.setHashName("change_cd");
AttachCdModel attachCdModel = (AttachCdModel) getWindow();
List<RepoImage> images1 = new ArrayList<>(Arrays.asList(new RepoImage(ConstantsManager.getInstance().getConstants().noCds())));
attachCdModel.getIsoImage().setItems(images1);
attachCdModel.getIsoImage().setSelectedItem(Linq.firstOrNull(images1));
ImagesDataProvider.getISOImagesList(new AsyncQuery<>(images -> {
AttachCdModel _attachCdModel = (AttachCdModel) getWindow();
RepoImage eject = new RepoImage(ConsoleModel.getEjectLabel());
images.add(0, eject);
_attachCdModel.getIsoImage().setItems(images);
if (_attachCdModel.getIsoImage().getIsChangable()) {
RepoImage selectedIso = Linq.firstOrNull(images, s -> vm.getCurrentCd() != null && vm.getCurrentCd().equals(s.getRepoImageId()));
_attachCdModel.getIsoImage().setSelectedItem(selectedIso == null ? eject : selectedIso);
}
}), vm.getStoragePoolId());
// $NON-NLS-1$
UICommand tempVar = UICommand.createDefaultOkUiCommand("OnChangeCD", this);
model.getCommands().add(tempVar);
// $NON-NLS-1$
UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this);
model.getCommands().add(tempVar2);
}
Aggregations