예제 #1
0
  private void host_SelectedItemChanged() {
    VDS host = getHost().getSelectedItem();
    if (getCurrentStorageItem() != null) {
      // When changing host clear items for san storage model.
      if (getCurrentStorageItem() instanceof SanStorageModelBase) {
        SanStorageModelBase sanStorageModel = (SanStorageModelBase) getCurrentStorageItem();
        if (getStorage() == null) {
          sanStorageModel.setItems(null);
        }
      }

      if (host != null) {
        getCurrentStorageItem().getUpdateCommand().execute();

        String prefix = host.isOvirtNode() ? localFSPath : ""; // $NON-NLS-1$
        if (!StringHelper.isNullOrEmpty(prefix)) {
          for (Object item : getStorageModels()) {
            if (item instanceof LocalStorageModel) {
              LocalStorageModel model = (LocalStorageModel) item;
              model.getPath().setEntity(prefix);
              model.getPath().setIsChangeable(false);
            }
          }
        }
      }
    }
  }
예제 #2
0
  @Override
  protected void PostDiscoverTargets(java.util.ArrayList<SanTargetModel> newItems) {
    super.PostDiscoverTargets(newItems);

    InitializeItems(null, newItems);

    // Remember all discovered targets.
    lastDiscoveredTargets.clear();
    lastDiscoveredTargets.addAll(newItems);
  }
예제 #3
0
  @Override
  protected void UpdateInternal() {
    super.UpdateInternal();

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

    VDS host = (VDS) getContainer().getHost().getSelectedItem();
    if (host == null) {
      ProposeDiscover();
      return;
    }

    ClearItems();
    InitializeItems(null, null);

    getContainer().StartProgress(null);

    Frontend.RunQuery(
        VdcQueryType.GetDeviceList,
        new GetDeviceListQueryParameters(host.getvds_id(), getType()),
        new AsyncQuery(
            this,
            new INewAsyncCallback() {
              @Override
              public void OnSuccess(Object target, Object returnValue) {

                SanStorageModel model = (SanStorageModel) target;
                VdcQueryReturnValue response = (VdcQueryReturnValue) returnValue;
                if (response.getSucceeded()) {
                  model.ApplyData((java.util.ArrayList<LUNs>) response.getReturnValue(), false);
                } else {
                  model.setGetLUNsFailure("Could not retrieve LUNs, please check your storage.");
                }
                model.getContainer().StopProgress();
              }
            },
            true));
  }
예제 #4
0
  @Override
  protected void Update() {
    lastDiscoveredTargets.clear();

    super.Update();
  }