use of org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity in project ovirt-engine by oVirt.
the class GetGlusterHooksQueryTest method getExpectedHooksList.
private List<GlusterHookEntity> getExpectedHooksList() {
List<GlusterHookEntity> glusterHooks = new ArrayList<>();
GlusterHookEntity hook = new GlusterHookEntity();
hook.setClusterId(CLUSTER_ID);
hook.setGlusterCommand("start");
hook.setStage("POST");
hook.setName("cifs_config");
hook.setStatus(GlusterHookStatus.ENABLED);
hook.setChecksum("e72c504dc16c8fcd2fe8c74bb492affa");
hook.setContentType(GlusterHookContentType.TEXT);
hook.setConflictStatus(0);
glusterHooks.add(hook);
hook = new GlusterHookEntity();
hook.setClusterId(CLUSTER_ID);
hook.setGlusterCommand("create");
hook.setStage("PRE");
hook.setName("virt_config");
hook.setStatus("DISABLED");
hook.setChecksum("d72c504dc16c8fcd2fe8c74bb492affb");
hook.setContentType(GlusterHookContentType.BINARY);
hook.setConflictStatus(0);
glusterHooks.add(hook);
return glusterHooks;
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity in project ovirt-engine by oVirt.
the class AddGlusterHookCommandTest method validateFailsOnNoConflictServers.
@Test
public void validateFailsOnNoConflictServers() {
GlusterHookEntity hook = getHookEntity();
setUpMocksForAdd(true, hook);
assertFalse(cmd.validate());
assertTrue(cmd.getReturnValue().getValidationMessages().contains(EngineMessage.ACTION_TYPE_FAILED_GLUSTER_HOOK_NO_CONFLICT_SERVERS.toString()));
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity in project ovirt-engine by oVirt.
the class UpdateGlusterHookCommandTest method validateFailsOnNoConflictServers.
@Test
public void validateFailsOnNoConflictServers() {
GlusterHookEntity hook = getHookEntity();
hook.setServerHooks(Collections.singletonList(getGlusterServerHook(0, GlusterHookStatus.MISSING)));
setUpMocksForUpdate(true, hook);
assertFalse(cmd.validate());
assertTrue(cmd.getReturnValue().getValidationMessages().contains(EngineMessage.ACTION_TYPE_FAILED_GLUSTER_HOOK_NO_CONFLICT_SERVERS.toString()));
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity in project ovirt-engine by oVirt.
the class ClusterGlusterHookListModel method onDisableHook.
private void onDisableHook() {
if (getConfirmWindow() == null) {
return;
}
ConfirmationModel model = (ConfirmationModel) getConfirmWindow();
if (model.getProgress() != null) {
return;
}
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (Object item : getSelectedItems()) {
GlusterHookEntity hook = (GlusterHookEntity) item;
list.add(new GlusterHookParameters(hook.getId()));
}
model.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.DisableGlusterHook, list, result -> {
ConfirmationModel localModel = (ConfirmationModel) result.getState();
localModel.stopProgress();
cancelConfirmation();
}, model);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity in project ovirt-engine by oVirt.
the class ClusterGlusterHookListModel method resolveConflicts.
private void resolveConflicts() {
if (getWindow() != null) {
return;
}
final GlusterHookEntity hookEntity = getSelectedItem();
if (hookEntity == null) {
return;
}
final GlusterHookResolveConflictsModel conflictsModel = new GlusterHookResolveConflictsModel();
conflictsModel.setTitle(ConstantsManager.getInstance().getConstants().resolveConflictsGlusterHookTitle());
conflictsModel.setHelpTag(HelpTag.gluster_hook_resolve_conflicts);
// $NON-NLS-1$
conflictsModel.setHashName("gluster_hook_resolve_conflicts");
hookEntity.setServerHooks(new ArrayList<GlusterServerHook>());
conflictsModel.setGlusterHookEntity(hookEntity);
setWindow(conflictsModel);
conflictsModel.startProgress();
AsyncDataProvider.getInstance().getGlusterHook(new AsyncQuery<>(returnValue -> {
List<GlusterServerHook> serverHooks = returnValue.getServerHooks();
hookEntity.setServerHooks(serverHooks);
ArrayList<EntityModel<GlusterServerHook>> serverHookModels = new ArrayList<>();
GlusterServerHook engineCopy = new GlusterServerHook();
engineCopy.setHookId(hookEntity.getId());
// $NON-NLS-1$
engineCopy.setServerName("Engine (Master)");
engineCopy.setStatus(hookEntity.getStatus());
engineCopy.setContentType(hookEntity.getContentType());
engineCopy.setChecksum(hookEntity.getChecksum());
EntityModel<GlusterServerHook> engineCopyModel = new EntityModel<>(engineCopy);
serverHookModels.add(engineCopyModel);
for (GlusterServerHook serverHook : serverHooks) {
serverHookModels.add(new EntityModel<>(serverHook));
}
conflictsModel.getHookSources().setItems(serverHookModels);
conflictsModel.getHookSources().setSelectedItem(engineCopyModel);
ArrayList<GlusterServerHook> serverHooksWithEngine = new ArrayList<>(serverHooks);
serverHooksWithEngine.add(0, engineCopy);
conflictsModel.getServerHooksList().setItems(serverHooksWithEngine);
conflictsModel.getServerHooksList().setSelectedItem(engineCopy);
conflictsModel.stopProgress();
// $NON-NLS-1$
UICommand command = UICommand.createDefaultOkUiCommand("OnResolveConflicts", ClusterGlusterHookListModel.this);
conflictsModel.getCommands().add(command);
// $NON-NLS-1$
command = new UICommand("Cancel", ClusterGlusterHookListModel.this);
command.setTitle(ConstantsManager.getInstance().getConstants().close());
command.setIsCancel(true);
conflictsModel.getCommands().add(command);
}), hookEntity.getId(), true);
}
Aggregations