@Test(dependsOnMethods = "testResolveVolumeOffering")
  public void testCreateVolume() throws Exception {
    try {
      volume =
          connection.createVolumeInLocation(
              location.getId(), TAG, FORMAT, cheapestStorage.getName(), cheapestStorage.getId());
      // wait up to 5 minutes for this to become "unmounted"
      assert new RetryablePredicate<Volume>(
              new VolumeUnmounted(connection), 300, 5, TimeUnit.SECONDS)
          .apply(volume);
    } catch (IllegalStateException e) {
      int code = HttpResponseException.class.cast(e.getCause()).getResponse().getStatusCode();
      if (code == 409 || code == 500) {
        Set<? extends Volume> volumes = connection.listVolumes();
        try {
          volume =
              Iterables.find(
                  volumes,
                  new Predicate<Volume>() {

                    @Override
                    public boolean apply(Volume input) {
                      return input.getState() == Volume.State.UNMOUNTED;
                    }
                  });
        } catch (NoSuchElementException ex) {
          killInstance(TAG + 1);
        }
      } else {
        throw e;
      }
    }
    assertEquals(volume.getInstanceId(), null);
    assertEquals(volume.getLocation(), location.getId());

    final String id = volume.getId();
    Set<? extends Volume> allVolumes = connection.listVolumes();

    // refresh volume as it may have been just created
    volume =
        Iterables.find(
            allVolumes,
            new Predicate<Volume>() {

              @Override
              public boolean apply(Volume input) {
                return input.getId().equals(id);
              }
            });

    assert (allVolumes.contains(volume)) : String.format("volume %s not in %s", volume, volume);
  }