コード例 #1
0
  /**
   * Add the application to the volume applicationIds attribute
   *
   * @param voluri The volume that will be updated
   * @param dbClient
   */
  protected void addApplicationToVolume(URI voluri, DbClient dbClient) {
    Volume volume = dbClient.queryObject(Volume.class, voluri);
    StringSet applications = volume.getVolumeGroupIds();
    if (applications == null) {
      applications = new StringSet();
    }
    applications.add(getId().toString());
    volume.setVolumeGroupIds(applications);
    dbClient.updateObject(volume);

    // handle clones
    StringSet fullCopies = volume.getFullCopies();
    List<Volume> fullCopiesToUpdate = new ArrayList<Volume>();
    if (fullCopies != null && !fullCopies.isEmpty()) {
      for (String fullCopyId : fullCopies) {
        Volume fullCopy = dbClient.queryObject(Volume.class, URI.create(fullCopyId));
        if (fullCopy != null && NullColumnValueGetter.isNullValue(fullCopy.getFullCopySetName())) {
          fullCopy.setFullCopySetName(fullCopy.getReplicationGroupInstance());
          fullCopiesToUpdate.add(fullCopy);
        }
      }
    }

    if (!fullCopiesToUpdate.isEmpty()) {
      dbClient.updateObject(fullCopiesToUpdate);
    }
  }
コード例 #2
0
  /**
   * Add the application to the volume applicationIds attribute
   *
   * @param voluri The volumes that will be updated
   * @param dbClient
   */
  private void addApplicationToVolume(Volume volume, DbClient dbClient) {

    StringSet applications = volume.getVolumeGroupIds();
    if (applications == null) {
      applications = new StringSet();
    }
    applications.add(getId().toString());
    volume.setVolumeGroupIds(applications);
    dbClient.updateObject(volume);

    // Once volumes in VNX CG are added to an application, the CG's arrayConsistency
    // should turn to false
    if (volume.isInCG() && ControllerUtils.isVnxVolume(volume, dbClient)) {
      URI cguri = volume.getConsistencyGroup();
      BlockConsistencyGroup cg = dbClient.queryObject(BlockConsistencyGroup.class, cguri);
      if (cg.getArrayConsistency()) {
        log.info("Updated consistency group arrayConsistency");
        cg.setArrayConsistency(false);
        dbClient.updateObject(cg);
      }
    }
  }