コード例 #1
0
  public void OnConfirmPMHost() {
    HostModel model = (HostModel) getWindow();

    if (!model.Validate()) {
      return;
    }

    if (!((Boolean) model.getIsPm().getEntity())) {
      ConfirmationModel confirmModel = new ConfirmationModel();
      setConfirmWindow(confirmModel);
      confirmModel.setTitle("Power Management Configuration");
      confirmModel.setHashName("power_management_configuration");
      confirmModel.setMessage(
          "You haven't configured Power Management for this Host. Are you sure you want to continue?");

      UICommand tempVar = new UICommand("OnAddHost", this);
      tempVar.setTitle("OK");
      tempVar.setIsDefault(true);
      confirmModel.getCommands().add(tempVar);
      UICommand tempVar2 = new UICommand("CancelConfirmWithFocus", this);
      tempVar2.setTitle("Cancel");
      tempVar2.setIsCancel(true);
      confirmModel.getCommands().add(tempVar2);
    } else {
      OnAddHost();
    }
  }
コード例 #2
0
  public void CancelConfirmWithFocus() {
    setConfirmWindow(null);

    HostModel hostModel = (HostModel) getWindow();
    hostModel.setIsPowerManagementSelected(true);
    hostModel.getIsPm().setEntity(true);
  }
コード例 #3
0
  public void PostOnAddHost(VdcReturnValueBase returnValue) {
    HostModel model = (HostModel) getWindow();

    model.StopProgress();

    if (returnValue != null && returnValue.getSucceeded()) {
      Cancel();
      PostAction();
    }
  }
コード例 #4
0
  public void OnAddHost() {
    CancelConfirm();

    HostModel model = (HostModel) getWindow();

    if (model.getProgress() != null) {
      return;
    }

    if (!model.Validate()) {
      return;
    }

    // Save changes.
    VDS host = new VDS();
    host.setvds_name((String) model.getName().getEntity());
    host.sethost_name((String) model.getHost().getEntity());
    host.setManagmentIp((String) model.getManagementIp().getEntity());
    host.setport((Integer) model.getPort().getEntity());
    host.setvds_group_id(((VDSGroup) model.getCluster().getSelectedItem()).getId());
    host.setpm_enabled((Boolean) model.getIsPm().getEntity());
    host.setpm_user(
        (Boolean) model.getIsPm().getEntity() ? (String) model.getPmUserName().getEntity() : null);
    host.setpm_password(
        (Boolean) model.getIsPm().getEntity() ? (String) model.getPmPassword().getEntity() : null);
    host.setpm_type(
        (Boolean) model.getIsPm().getEntity()
            ? (String) model.getPmType().getSelectedItem()
            : null);
    host.setPmOptionsMap(
        (Boolean) model.getIsPm().getEntity()
            ? new ValueObjectMap(model.getPmOptionsMap(), false)
            : null);

    AddVdsActionParameters vdsActionParams = new AddVdsActionParameters();
    vdsActionParams.setvds(host);
    vdsActionParams.setVdsId(host.getId());
    vdsActionParams.setRootPassword((String) model.getRootPassword().getEntity());

    model.StartProgress(null);

    Frontend.RunAction(
        VdcActionType.AddVds,
        vdsActionParams,
        new IFrontendActionAsyncCallback() {
          @Override
          public void Executed(FrontendActionAsyncResult result) {

            ClusterGuideModel localModel = (ClusterGuideModel) result.getState();
            localModel.PostOnAddHost(result.getReturnValue());
          }
        },
        this);
  }
コード例 #5
0
  public void AddHost() {
    HostModel model = new HostModel();
    setWindow(model);
    model.setTitle("New Host");
    model.setHashName("new_host");
    model.getPort().setEntity(54321);
    model.getOverrideIpTables().setEntity(true);

    model.getCluster().setSelectedItem(getEntity());
    model.getCluster().setIsChangable(false);

    java.util.ArrayList<storage_pool> dataCenters = DataProvider.GetDataCenterList();
    model.getDataCenter().setItems(dataCenters);
    if (getEntity().getstorage_pool_id() != null) {
      model
          .getDataCenter()
          .setSelectedItem(
              Linq.FirstOrDefault(
                  dataCenters,
                  new Linq.DataCenterPredicate((Guid) getEntity().getstorage_pool_id())));
    }
    model.getDataCenter().setIsChangable(false);

    UICommand tempVar = new UICommand("OnConfirmPMHost", this);
    tempVar.setTitle("OK");
    tempVar.setIsDefault(true);
    model.getCommands().add(tempVar);
    UICommand tempVar2 = new UICommand("Cancel", this);
    tempVar2.setTitle("Cancel");
    tempVar2.setIsCancel(true);
    model.getCommands().add(tempVar2);
  }
コード例 #6
0
 /** {@inheritDoc} */
 @Override
 public HostLocalDomainControllerAdd getCompensatingUpdate(final HostModel original) {
   LocalDomainControllerElement dc = original.getLocalDomainControllerElement();
   if (dc == null) return null;
   return new HostLocalDomainControllerAdd();
 }
コード例 #7
0
 /** {@inheritDoc} */
 @Override
 protected void applyUpdate(final HostModel element) throws UpdateFailedException {
   if (!element.removeLocalDomainController()) {
     throw new UpdateFailedException("No local domain controller configured");
   }
 }