Search in sources :

Example 1 with ExportVmModel

use of org.ovirt.engine.ui.uicommonweb.models.vms.ExportVmModel in project ovirt-engine by oVirt.

the class TemplateListModel method onExport.

private void onExport() {
    ExportVmModel model = (ExportVmModel) getWindow();
    if (model.getProgress() != null) {
        return;
    }
    if (!model.validate()) {
        return;
    }
    model.startProgress();
    getTemplatesNotPresentOnExportDomain();
}
Also used : ExportVmModel(org.ovirt.engine.ui.uicommonweb.models.vms.ExportVmModel)

Example 2 with ExportVmModel

use of org.ovirt.engine.ui.uicommonweb.models.vms.ExportVmModel in project ovirt-engine by oVirt.

the class VmBaseListModel method postShowWarningOnExistingVms.

private void postShowWarningOnExistingVms(final ExportVmModel exportModel, List<StoragePool> storagePools, QueryType getVmOrTemplateQuery) {
    StoragePool storagePool = storagePools.size() > 0 ? storagePools.get(0) : null;
    if (storagePool != null) {
        Guid storageDomainId = exportModel.getStorage().getSelectedItem().getId();
        GetAllFromExportDomainQueryParameters tempVar = new GetAllFromExportDomainQueryParameters(storagePool.getId(), storageDomainId);
        Frontend.getInstance().runQuery(getVmOrTemplateQuery, tempVar, new AsyncQuery<>((AsyncCallback<QueryReturnValue>) returnValue -> {
            ExportVmModel windowModel = (ExportVmModel) getWindow();
            List<T> foundVms = new ArrayList<>();
            if (returnValue != null) {
                Iterable<T> iterableReturnValue = asIterableReturnValue(returnValue.getReturnValue());
                for (T selectedItem1 : getSelectedItems()) {
                    for (T returnValueItem : iterableReturnValue) {
                        if (entititesEqualsNullSafe(returnValueItem, selectedItem1)) {
                            foundVms.add(selectedItem1);
                            break;
                        }
                    }
                }
            }
            if (foundVms.size() != 0) {
                windowModel.setMessage(composeEntityOnStorage(composeExistingVmsWarningMessage(foundVms)));
            }
            exportModel.stopProgress();
        }));
    } else {
        exportModel.stopProgress();
    }
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) AsyncCallback(org.ovirt.engine.ui.frontend.AsyncCallback) UnitVmModelNetworkAsyncCallback(org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModelNetworkAsyncCallback) ArrayList(java.util.ArrayList) ExportVmModel(org.ovirt.engine.ui.uicommonweb.models.vms.ExportVmModel) Guid(org.ovirt.engine.core.compat.Guid) GetAllFromExportDomainQueryParameters(org.ovirt.engine.core.common.queries.GetAllFromExportDomainQueryParameters)

Example 3 with ExportVmModel

use of org.ovirt.engine.ui.uicommonweb.models.vms.ExportVmModel in project ovirt-engine by oVirt.

the class VmBaseListModel method showWarningOnExistingEntities.

protected void showWarningOnExistingEntities(final ExportVmModel model, final QueryType getVmOrTemplateQuery) {
    Guid storageDomainId = model.getStorage().getSelectedItem().getId();
    AsyncDataProvider.getInstance().getDataCentersByStorageDomain(new AsyncQuery<>(storagePools -> postShowWarningOnExistingVms(model, storagePools, getVmOrTemplateQuery)), storageDomainId);
}
Also used : ExportVmModel(org.ovirt.engine.ui.uicommonweb.models.vms.ExportVmModel) FullUnitToVmBaseBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.FullUnitToVmBaseBuilder) FrontendActionAsyncResult(org.ovirt.engine.ui.uicompat.FrontendActionAsyncResult) VmType(org.ovirt.engine.core.common.businessentities.VmType) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) AddVmParameters(org.ovirt.engine.core.common.action.AddVmParameters) ActionType(org.ovirt.engine.core.common.action.ActionType) VmWatchdogType(org.ovirt.engine.core.common.businessentities.VmWatchdogType) UnitVmModel(org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel) Map(java.util.Map) VmInterfaceCreatingManager(org.ovirt.engine.ui.uicommonweb.models.vms.VmInterfaceCreatingManager) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) DisplayType(org.ovirt.engine.core.common.businessentities.DisplayType) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) StringHelper(org.ovirt.engine.core.compat.StringHelper) VmHighPerformanceConfigurationModel(org.ovirt.engine.ui.uicommonweb.models.vms.VmHighPerformanceConfigurationModel) List(java.util.List) KeyValueModel(org.ovirt.engine.ui.uicommonweb.models.vms.key_value.KeyValueModel) UnitToGraphicsDeviceParamsBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.UnitToGraphicsDeviceParamsBuilder) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) GetAllFromExportDomainQueryParameters(org.ovirt.engine.core.common.queries.GetAllFromExportDomainQueryParameters) Guid(org.ovirt.engine.core.compat.Guid) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) StorageDomainStatus(org.ovirt.engine.core.common.businessentities.StorageDomainStatus) HasDiskWindow(org.ovirt.engine.ui.uicommonweb.models.vms.HasDiskWindow) ArrayList(java.util.ArrayList) AsyncCallback(org.ovirt.engine.ui.frontend.AsyncCallback) UnitVmModelNetworkAsyncCallback(org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModelNetworkAsyncCallback) Frontend(org.ovirt.engine.ui.frontend.Frontend) ExportOvaModel(org.ovirt.engine.ui.uicommonweb.models.vms.ExportOvaModel) BalloonEnabled(org.ovirt.engine.ui.uicommonweb.models.vms.BalloonEnabled) VmWatchdog(org.ovirt.engine.core.common.businessentities.VmWatchdog) Model(org.ovirt.engine.ui.uicommonweb.models.Model) Linq(org.ovirt.engine.ui.uicommonweb.Linq) BuilderExecutor(org.ovirt.engine.ui.uicommonweb.builders.BuilderExecutor) VmBasedWidgetSwitchModeCommand(org.ovirt.engine.ui.uicommonweb.models.vms.VmBasedWidgetSwitchModeCommand) IconUtils(org.ovirt.engine.ui.uicommonweb.IconUtils) VM(org.ovirt.engine.core.common.businessentities.VM) TabName(org.ovirt.engine.ui.uicommonweb.models.TabName) ListWithSimpleDetailsModel(org.ovirt.engine.ui.uicommonweb.models.ListWithSimpleDetailsModel) StorageDomainType(org.ovirt.engine.core.common.businessentities.StorageDomainType) VmManagementParametersBase(org.ovirt.engine.core.common.action.VmManagementParametersBase) VDS(org.ovirt.engine.core.common.businessentities.VDS) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) VmSpecificUnitToVmBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.VmSpecificUnitToVmBuilder) Guid(org.ovirt.engine.core.compat.Guid)

Example 4 with ExportVmModel

use of org.ovirt.engine.ui.uicommonweb.models.vms.ExportVmModel in project ovirt-engine by oVirt.

the class VmBaseListModel method export.

protected void export() {
    T selectedEntity = getSelectedItem();
    if (selectedEntity == null) {
        return;
    }
    if (getWindow() != null) {
        return;
    }
    ExportVmModel model = new ExportVmModel();
    setWindow(model);
    model.startProgress();
    setupExportModel(model);
    AsyncDataProvider.getInstance().getStorageDomainList(new AsyncQuery<>(storageDomains -> {
        List<StorageDomain> filteredStorageDomains = new ArrayList<>();
        for (StorageDomain a : storageDomains) {
            if (a.getStorageDomainType() == StorageDomainType.ImportExport) {
                filteredStorageDomains.add(a);
            }
        }
        postExportGetStorageDomainList(filteredStorageDomains);
    }), extractStoragePoolIdNullSafe(selectedEntity));
    // check, if the VM has a disk which doesn't allow snapshot
    sendWarningForNonExportableDisks(selectedEntity);
}
Also used : ExportVmModel(org.ovirt.engine.ui.uicommonweb.models.vms.ExportVmModel) FullUnitToVmBaseBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.FullUnitToVmBaseBuilder) FrontendActionAsyncResult(org.ovirt.engine.ui.uicompat.FrontendActionAsyncResult) VmType(org.ovirt.engine.core.common.businessentities.VmType) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) AddVmParameters(org.ovirt.engine.core.common.action.AddVmParameters) ActionType(org.ovirt.engine.core.common.action.ActionType) VmWatchdogType(org.ovirt.engine.core.common.businessentities.VmWatchdogType) UnitVmModel(org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel) Map(java.util.Map) VmInterfaceCreatingManager(org.ovirt.engine.ui.uicommonweb.models.vms.VmInterfaceCreatingManager) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) DisplayType(org.ovirt.engine.core.common.businessentities.DisplayType) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) StringHelper(org.ovirt.engine.core.compat.StringHelper) VmHighPerformanceConfigurationModel(org.ovirt.engine.ui.uicommonweb.models.vms.VmHighPerformanceConfigurationModel) List(java.util.List) KeyValueModel(org.ovirt.engine.ui.uicommonweb.models.vms.key_value.KeyValueModel) UnitToGraphicsDeviceParamsBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.UnitToGraphicsDeviceParamsBuilder) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) GetAllFromExportDomainQueryParameters(org.ovirt.engine.core.common.queries.GetAllFromExportDomainQueryParameters) Guid(org.ovirt.engine.core.compat.Guid) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) StorageDomainStatus(org.ovirt.engine.core.common.businessentities.StorageDomainStatus) HasDiskWindow(org.ovirt.engine.ui.uicommonweb.models.vms.HasDiskWindow) ArrayList(java.util.ArrayList) AsyncCallback(org.ovirt.engine.ui.frontend.AsyncCallback) UnitVmModelNetworkAsyncCallback(org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModelNetworkAsyncCallback) Frontend(org.ovirt.engine.ui.frontend.Frontend) ExportOvaModel(org.ovirt.engine.ui.uicommonweb.models.vms.ExportOvaModel) BalloonEnabled(org.ovirt.engine.ui.uicommonweb.models.vms.BalloonEnabled) VmWatchdog(org.ovirt.engine.core.common.businessentities.VmWatchdog) Model(org.ovirt.engine.ui.uicommonweb.models.Model) Linq(org.ovirt.engine.ui.uicommonweb.Linq) BuilderExecutor(org.ovirt.engine.ui.uicommonweb.builders.BuilderExecutor) VmBasedWidgetSwitchModeCommand(org.ovirt.engine.ui.uicommonweb.models.vms.VmBasedWidgetSwitchModeCommand) IconUtils(org.ovirt.engine.ui.uicommonweb.IconUtils) VM(org.ovirt.engine.core.common.businessentities.VM) TabName(org.ovirt.engine.ui.uicommonweb.models.TabName) ListWithSimpleDetailsModel(org.ovirt.engine.ui.uicommonweb.models.ListWithSimpleDetailsModel) StorageDomainType(org.ovirt.engine.core.common.businessentities.StorageDomainType) VmManagementParametersBase(org.ovirt.engine.core.common.action.VmManagementParametersBase) VDS(org.ovirt.engine.core.common.businessentities.VDS) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) VmSpecificUnitToVmBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.VmSpecificUnitToVmBuilder) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) ExportVmModel(org.ovirt.engine.ui.uicommonweb.models.vms.ExportVmModel) List(java.util.List) ArrayList(java.util.ArrayList)

Example 5 with ExportVmModel

use of org.ovirt.engine.ui.uicommonweb.models.vms.ExportVmModel in project ovirt-engine by oVirt.

the class TemplateListModel method doExport.

private void doExport() {
    ExportVmModel model = (ExportVmModel) getWindow();
    ArrayList<ActionParametersBase> list = new ArrayList<>();
    for (Object item : getSelectedItems()) {
        VmTemplate a = (VmTemplate) item;
        if (a.getId().equals(Guid.Empty)) {
            continue;
        }
        MoveOrCopyParameters tempVar = new MoveOrCopyParameters(a.getId(), model.getStorage().getSelectedItem().getId());
        tempVar.setForceOverride(model.getForceOverride().getEntity());
        list.add(tempVar);
    }
    model.startProgress();
    Frontend.getInstance().runMultipleAction(ActionType.ExportVmTemplate, list, result -> {
        ExportVmModel localModel = (ExportVmModel) result.getState();
        localModel.stopProgress();
        cancel();
    }, model);
}
Also used : VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) ArrayList(java.util.ArrayList) ExportVmModel(org.ovirt.engine.ui.uicommonweb.models.vms.ExportVmModel) MoveOrCopyParameters(org.ovirt.engine.core.common.action.MoveOrCopyParameters) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Aggregations

ExportVmModel (org.ovirt.engine.ui.uicommonweb.models.vms.ExportVmModel)9 ArrayList (java.util.ArrayList)6 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)6 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)5 Guid (org.ovirt.engine.core.compat.Guid)5 List (java.util.List)4 Map (java.util.Map)4 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)4 ActionType (org.ovirt.engine.core.common.action.ActionType)4 DisplayType (org.ovirt.engine.core.common.businessentities.DisplayType)4 VM (org.ovirt.engine.core.common.businessentities.VM)4 VmType (org.ovirt.engine.core.common.businessentities.VmType)4 VmWatchdog (org.ovirt.engine.core.common.businessentities.VmWatchdog)4 VmWatchdogType (org.ovirt.engine.core.common.businessentities.VmWatchdogType)4 QueryType (org.ovirt.engine.core.common.queries.QueryType)4 Frontend (org.ovirt.engine.ui.frontend.Frontend)4 IconUtils (org.ovirt.engine.ui.uicommonweb.IconUtils)4 BuilderExecutor (org.ovirt.engine.ui.uicommonweb.builders.BuilderExecutor)4 FullUnitToVmBaseBuilder (org.ovirt.engine.ui.uicommonweb.builders.vm.FullUnitToVmBaseBuilder)4 UnitToGraphicsDeviceParamsBuilder (org.ovirt.engine.ui.uicommonweb.builders.vm.UnitToGraphicsDeviceParamsBuilder)4