diff --git a/acceptance/clients/clients.go b/acceptance/clients/clients.go
index 6075fbc..822945f 100644
--- a/acceptance/clients/clients.go
+++ b/acceptance/clients/clients.go
@@ -96,6 +96,25 @@
 	})
 }
 
+// NewBlockStorageV2Client returns a *ServiceClient for making calls
+// to the OpenStack Block Storage v2 API. An error will be returned
+// if authentication or client creation was not possible.
+func NewBlockStorageV2Client() (*gophercloud.ServiceClient, error) {
+	ao, err := openstack.AuthOptionsFromEnv()
+	if err != nil {
+		return nil, err
+	}
+
+	client, err := openstack.AuthenticatedClient(ao)
+	if err != nil {
+		return nil, err
+	}
+
+	return openstack.NewBlockStorageV2(client, gophercloud.EndpointOpts{
+		Region: os.Getenv("OS_REGION_NAME"),
+	})
+}
+
 // NewComputeV2Client returns a *ServiceClient for making calls
 // to the OpenStack Compute v2 API. An error will be returned
 // if authentication or client creation was not possible.
diff --git a/acceptance/openstack/blockstorage/v1/.blockstorage.go.swp b/acceptance/openstack/blockstorage/v1/.blockstorage.go.swp
new file mode 100644
index 0000000..0b710e7
--- /dev/null
+++ b/acceptance/openstack/blockstorage/v1/.blockstorage.go.swp
Binary files differ
diff --git a/acceptance/openstack/blockstorage/v1/blockstorage.go b/acceptance/openstack/blockstorage/v1/blockstorage.go
new file mode 100644
index 0000000..3d4c9f1
--- /dev/null
+++ b/acceptance/openstack/blockstorage/v1/blockstorage.go
@@ -0,0 +1,183 @@
+// Package v1 contains common functions for creating block storage based
+// resources for use in acceptance tests. See the `*_test.go` files for
+// example usages.
+package v1
+
+import (
+	"testing"
+
+	"github.com/gophercloud/gophercloud"
+	"github.com/gophercloud/gophercloud/acceptance/tools"
+	"github.com/gophercloud/gophercloud/openstack/blockstorage/v1/snapshots"
+	"github.com/gophercloud/gophercloud/openstack/blockstorage/v1/volumes"
+	"github.com/gophercloud/gophercloud/openstack/blockstorage/v1/volumetypes"
+)
+
+// CreateSnapshot will create a volume snapshot based off of a given volume and
+// with a random name. An error will be returned if the snapshot failed to be
+// created.
+func CreateSnapshot(t *testing.T, client *gophercloud.ServiceClient, volume *volumes.Volume) (*snapshots.Snapshot, error) {
+	if testing.Short() {
+		t.Skip("Skipping test that requires snapshot creation in short mode.")
+	}
+
+	snapshotName := tools.RandomString("ACPTTEST", 16)
+	t.Logf("Attempting to create snapshot %s based on volume %s", snapshotName, volume.ID)
+
+	createOpts := snapshots.CreateOpts{
+		Name:     snapshotName,
+		VolumeID: volume.ID,
+	}
+
+	snapshot, err := snapshots.Create(client, createOpts).Extract()
+	if err != nil {
+		return snapshot, err
+	}
+
+	err = snapshots.WaitForStatus(client, snapshot.ID, "available", 60)
+	if err != nil {
+		return snapshot, err
+	}
+
+	return snapshot, nil
+}
+
+// CreateVolume will create a volume with a random name and size of 1GB. An
+// error will be returned if the volume was unable to be created.
+func CreateVolume(t *testing.T, client *gophercloud.ServiceClient) (*volumes.Volume, error) {
+	if testing.Short() {
+		t.Skip("Skipping test that requires volume creation in short mode.")
+	}
+
+	volumeName := tools.RandomString("ACPTTEST", 16)
+	t.Logf("Attempting to create volume: %s", volumeName)
+
+	createOpts := volumes.CreateOpts{
+		Size: 1,
+		Name: volumeName,
+	}
+
+	volume, err := volumes.Create(client, createOpts).Extract()
+	if err != nil {
+		return volume, err
+	}
+
+	err = volumes.WaitForStatus(client, volume.ID, "available", 60)
+	if err != nil {
+		return volume, err
+	}
+
+	return volume, nil
+}
+
+// CreateVolumeType will create a volume type with a random name. An error will
+// be returned if the volume type was unable to be created.
+func CreateVolumeType(t *testing.T, client *gophercloud.ServiceClient) (*volumetypes.VolumeType, error) {
+	volumeTypeName := tools.RandomString("ACPTTEST", 16)
+	t.Logf("Attempting to create volume type: %s", volumeTypeName)
+
+	createOpts := volumetypes.CreateOpts{
+		Name: volumeTypeName,
+		ExtraSpecs: map[string]interface{}{
+			"capabilities": "ssd",
+			"priority":     3,
+		},
+	}
+
+	volumeType, err := volumetypes.Create(client, createOpts).Extract()
+	if err != nil {
+		return volumeType, err
+	}
+
+	return volumeType, nil
+}
+
+// DeleteSnapshot will delete a snapshot. A fatal error will occur if the
+// snapshot failed to be deleted. This works best when used as a deferred
+// function.
+func DeleteSnapshotshot(t *testing.T, client *gophercloud.ServiceClient, snapshot *snapshots.Snapshot) {
+	err := snapshots.Delete(client, snapshot.ID).ExtractErr()
+	if err != nil {
+		t.Fatalf("Unable to delete snapshot %s: %v", snapshot.ID, err)
+	}
+
+	// Volumes can't be deleted until their snapshots have been,
+	// so block up to 120 seconds for the snapshot to delete.
+	err = gophercloud.WaitFor(120, func() (bool, error) {
+		_, err := snapshots.Get(client, snapshot.ID).Extract()
+		if err != nil {
+			return true, nil
+		}
+
+		return false, nil
+	})
+	if err != nil {
+		t.Fatalf("Unable to wait for snapshot to delete: %v", err)
+	}
+
+	t.Logf("Deleted snapshot: %s", snapshot.ID)
+}
+
+// DeleteVolume will delete a volume. A fatal error will occur if the volume
+// failed to be deleted. This works best when used as a deferred function.
+func DeleteVolume(t *testing.T, client *gophercloud.ServiceClient, volume *volumes.Volume) {
+	err := volumes.Delete(client, volume.ID).ExtractErr()
+	if err != nil {
+		t.Fatalf("Unable to delete volume %s: %v", volume.ID, err)
+	}
+
+	t.Logf("Deleted volume: %s", volume.ID)
+}
+
+// DeleteVolumeType will delete a volume type. A fatal error will occur if the
+// volume type failed to be deleted. This works best when used as a deferred
+// function.
+func DeleteVolumeType(t *testing.T, client *gophercloud.ServiceClient, volumeType *volumetypes.VolumeType) {
+	err := volumetypes.Delete(client, volumeType.ID).ExtractErr()
+	if err != nil {
+		t.Fatalf("Unable to delete volume type %s: %v", volumeType.ID, err)
+	}
+
+	t.Logf("Deleted volume type: %s", volumeType.ID)
+}
+
+// PrintVolume will print a volume and all of its attributes.
+func PrintVolume(t *testing.T, volume *volumes.Volume) {
+	t.Logf("ID: %s", volume.ID)
+	t.Logf("Status: %s", volume.Status)
+	t.Logf("Name: %s", volume.Name)
+	t.Logf("AvailabilityZone: %s", volume.AvailabilityZone)
+	t.Logf("Bootable: %s", volume.Bootable)
+	t.Logf("CreatedAt: %v", volume.CreatedAt)
+	t.Logf("Description: %s", volume.Description)
+	t.Logf("VolumeType: %s", volume.VolumeType)
+	t.Logf("SnapshotID: %s", volume.SnapshotID)
+	t.Logf("SourceVolID: %s", volume.SourceVolID)
+	t.Logf("Size: %d", volume.Size)
+	t.Logf("Metadata: %#v", volume.Metadata)
+	t.Logf("Attachments: %#v", volume.Attachments)
+}
+
+// PrintVolumeType will print a volume type and all of its attributes.
+func PrintVolumeType(t *testing.T, volumeType *volumetypes.VolumeType) {
+	t.Logf("ID: %s", volumeType.ID)
+	t.Logf("Name: %s", volumeType.Name)
+	t.Logf("ExtraSpecs: %#v", volumeType.ExtraSpecs)
+}
+
+// PrintSnapshot will print a snapshot and all of its attributes.
+func PrintSnapshot(t *testing.T, snapshot *snapshots.Snapshot) {
+	t.Logf("ID: %s", snapshot.ID)
+	t.Logf("Status: %s", snapshot.Status)
+	t.Logf("Name: %s", snapshot.Name)
+	t.Logf("AvailabilityZone: %s", snapshot.AvailabilityZone)
+	t.Logf("Bootable: %s", snapshot.Bootable)
+	t.Logf("CreatedAt: %v", snapshot.CreatedAt)
+	t.Logf("Description: %s", snapshot.Description)
+	t.Logf("VolumeType: %s", snapshot.VolumeType)
+	t.Logf("SnapshotID: %s", snapshot.SnapshotID)
+	t.Logf("VolumeID: %s", snapshot.VolumeID)
+	t.Logf("Size: %d", snapshot.Size)
+	t.Logf("Metadata: %#v", snapshot.Metadata)
+	t.Logf("Attachments: %#v", snapshot.Attachments)
+}
diff --git a/acceptance/openstack/blockstorage/v1/snapshots_test.go b/acceptance/openstack/blockstorage/v1/snapshots_test.go
index 2b737e7..2dc58db 100644
--- a/acceptance/openstack/blockstorage/v1/snapshots_test.go
+++ b/acceptance/openstack/blockstorage/v1/snapshots_test.go
@@ -1,70 +1,57 @@
-// +build acceptance
+// +build acceptance blockstorage
 
 package v1
 
 import (
 	"testing"
 
-	"github.com/gophercloud/gophercloud"
+	"github.com/gophercloud/gophercloud/acceptance/clients"
 	"github.com/gophercloud/gophercloud/openstack/blockstorage/v1/snapshots"
-	"github.com/gophercloud/gophercloud/openstack/blockstorage/v1/volumes"
-	th "github.com/gophercloud/gophercloud/testhelper"
 )
 
-func TestSnapshots(t *testing.T) {
+func TestSnapshotsList(t *testing.T) {
+	client, err := clients.NewBlockStorageV1Client()
+	if err != nil {
+		t.Fatalf("Unable to create a blockstorage client: %v", err)
+	}
 
-	client, err := newClient(t)
-	th.AssertNoErr(t, err)
+	allPages, err := snapshots.List(client, snapshots.ListOpts{}).AllPages()
+	if err != nil {
+		t.Fatalf("Unable to retrieve snapshots: %v", err)
+	}
 
-	v, err := volumes.Create(client, &volumes.CreateOpts{
-		Name: "gophercloud-test-volume",
-		Size: 1,
-	}).Extract()
-	th.AssertNoErr(t, err)
+	allSnapshots, err := snapshots.ExtractSnapshots(allPages)
+	if err != nil {
+		t.Fatalf("Unable to extract snapshots: %v", err)
+	}
 
-	err = volumes.WaitForStatus(client, v.ID, "available", 120)
-	th.AssertNoErr(t, err)
+	for _, snapshot := range allSnapshots {
+		PrintSnapshot(t, &snapshot)
+	}
+}
 
-	t.Logf("Created volume: %v\n", v)
+func TestSnapshotsCreateDelete(t *testing.T) {
+	client, err := clients.NewBlockStorageV1Client()
+	if err != nil {
+		t.Fatalf("Unable to create a blockstorage client: %v", err)
+	}
 
-	ss, err := snapshots.Create(client, &snapshots.CreateOpts{
-		Name:     "gophercloud-test-snapshot",
-		VolumeID: v.ID,
-	}).Extract()
-	th.AssertNoErr(t, err)
+	volume, err := CreateVolume(t, client)
+	if err != nil {
+		t.Fatalf("Unable to create volume: %v", err)
+	}
+	defer DeleteVolume(t, client, volume)
 
-	err = snapshots.WaitForStatus(client, ss.ID, "available", 120)
-	th.AssertNoErr(t, err)
+	snapshot, err := CreateSnapshot(t, client, volume)
+	if err != nil {
+		t.Fatalf("Unable to create snapshot: %v", err)
+	}
+	defer DeleteSnapshotshot(t, client, snapshot)
 
-	t.Logf("Created snapshot: %+v\n", ss)
+	newSnapshot, err := snapshots.Get(client, snapshot.ID).Extract()
+	if err != nil {
+		t.Errorf("Unable to retrieve snapshot: %v", err)
+	}
 
-	err = snapshots.Delete(client, ss.ID).ExtractErr()
-	th.AssertNoErr(t, err)
-
-	err = gophercloud.WaitFor(120, func() (bool, error) {
-		_, err := snapshots.Get(client, ss.ID).Extract()
-		if err != nil {
-			return true, nil
-		}
-
-		return false, nil
-	})
-	th.AssertNoErr(t, err)
-
-	t.Log("Deleted snapshot\n")
-
-	err = volumes.Delete(client, v.ID).ExtractErr()
-	th.AssertNoErr(t, err)
-
-	err = gophercloud.WaitFor(120, func() (bool, error) {
-		_, err := volumes.Get(client, v.ID).Extract()
-		if err != nil {
-			return true, nil
-		}
-
-		return false, nil
-	})
-	th.AssertNoErr(t, err)
-
-	t.Log("Deleted volume\n")
+	PrintSnapshot(t, newSnapshot)
 }
diff --git a/acceptance/openstack/blockstorage/v1/volumes_test.go b/acceptance/openstack/blockstorage/v1/volumes_test.go
index a7bf123..e375c59 100644
--- a/acceptance/openstack/blockstorage/v1/volumes_test.go
+++ b/acceptance/openstack/blockstorage/v1/volumes_test.go
@@ -3,61 +3,49 @@
 package v1
 
 import (
-	"os"
 	"testing"
 
-	"github.com/gophercloud/gophercloud"
-	"github.com/gophercloud/gophercloud/openstack"
+	"github.com/gophercloud/gophercloud/acceptance/clients"
 	"github.com/gophercloud/gophercloud/openstack/blockstorage/v1/volumes"
-	"github.com/gophercloud/gophercloud/pagination"
-	th "github.com/gophercloud/gophercloud/testhelper"
 )
 
-func newClient(t *testing.T) (*gophercloud.ServiceClient, error) {
-	ao, err := openstack.AuthOptionsFromEnv()
-	th.AssertNoErr(t, err)
-
-	client, err := openstack.AuthenticatedClient(ao)
-	th.AssertNoErr(t, err)
-
-	return openstack.NewBlockStorageV1(client, gophercloud.EndpointOpts{
-		Region: os.Getenv("OS_REGION_NAME"),
-	})
-}
-
-func TestVolumes(t *testing.T) {
-	client, err := newClient(t)
-	th.AssertNoErr(t, err)
-
-	cv, err := volumes.Create(client, &volumes.CreateOpts{
-		Size: 1,
-		Name: "gophercloud-test-volume",
-	}).Extract()
-	th.AssertNoErr(t, err)
-	defer func() {
-		err = volumes.WaitForStatus(client, cv.ID, "available", 60)
-		th.AssertNoErr(t, err)
-		err = volumes.Delete(client, cv.ID).ExtractErr()
-		th.AssertNoErr(t, err)
-	}()
-
-	_, err = volumes.Update(client, cv.ID, &volumes.UpdateOpts{
-		Name: "gophercloud-updated-volume",
-	}).Extract()
-	th.AssertNoErr(t, err)
-
-	v, err := volumes.Get(client, cv.ID).Extract()
-	th.AssertNoErr(t, err)
-	t.Logf("Got volume: %+v\n", v)
-
-	if v.Name != "gophercloud-updated-volume" {
-		t.Errorf("Unable to update volume: Expected name: gophercloud-updated-volume\nActual name: %s", v.Name)
+func TestVolumesList(t *testing.T) {
+	client, err := clients.NewBlockStorageV1Client()
+	if err != nil {
+		t.Fatalf("Unable to create a blockstorage client: %v", err)
 	}
 
-	err = volumes.List(client, &volumes.ListOpts{Name: "gophercloud-updated-volume"}).EachPage(func(page pagination.Page) (bool, error) {
-		vols, err := volumes.ExtractVolumes(page)
-		th.CheckEquals(t, 1, len(vols))
-		return true, err
-	})
-	th.AssertNoErr(t, err)
+	allPages, err := volumes.List(client, volumes.ListOpts{}).AllPages()
+	if err != nil {
+		t.Fatalf("Unable to retrieve volumes: %v", err)
+	}
+
+	allVolumes, err := volumes.ExtractVolumes(allPages)
+	if err != nil {
+		t.Fatalf("Unable to extract volumes: %v", err)
+	}
+
+	for _, volume := range allVolumes {
+		PrintVolume(t, &volume)
+	}
+}
+
+func TestVolumesCreateDestroy(t *testing.T) {
+	client, err := clients.NewBlockStorageV1Client()
+	if err != nil {
+		t.Fatalf("Unable to create blockstorage client: %v", err)
+	}
+
+	volume, err := CreateVolume(t, client)
+	if err != nil {
+		t.Fatalf("Unable to create volume: %v", err)
+	}
+	defer DeleteVolume(t, client, volume)
+
+	newVolume, err := volumes.Get(client, volume.ID).Extract()
+	if err != nil {
+		t.Errorf("Unable to retrieve volume: %v", err)
+	}
+
+	PrintVolume(t, newVolume)
 }
diff --git a/acceptance/openstack/blockstorage/v1/volumetypes_test.go b/acceptance/openstack/blockstorage/v1/volumetypes_test.go
index ebfa3de..843ea21 100644
--- a/acceptance/openstack/blockstorage/v1/volumetypes_test.go
+++ b/acceptance/openstack/blockstorage/v1/volumetypes_test.go
@@ -1,49 +1,46 @@
-// +build acceptance
+// +build acceptance blockstorage
 
 package v1
 
 import (
 	"testing"
-	"time"
 
+	"github.com/gophercloud/gophercloud/acceptance/clients"
 	"github.com/gophercloud/gophercloud/openstack/blockstorage/v1/volumetypes"
-	"github.com/gophercloud/gophercloud/pagination"
-	th "github.com/gophercloud/gophercloud/testhelper"
 )
 
-func TestVolumeTypes(t *testing.T) {
-	client, err := newClient(t)
-	th.AssertNoErr(t, err)
+func TestVolumeTypesList(t *testing.T) {
+	client, err := clients.NewBlockStorageV1Client()
+	if err != nil {
+		t.Fatalf("Unable to create a blockstorage client: %v", err)
+	}
 
-	vt, err := volumetypes.Create(client, &volumetypes.CreateOpts{
-		ExtraSpecs: map[string]interface{}{
-			"capabilities": "gpu",
-			"priority":     3,
-		},
-		Name: "gophercloud-test-volumeType",
-	}).Extract()
-	th.AssertNoErr(t, err)
-	defer func() {
-		time.Sleep(10000 * time.Millisecond)
-		err = volumetypes.Delete(client, vt.ID).ExtractErr()
-		if err != nil {
-			t.Error(err)
-			return
-		}
-	}()
-	t.Logf("Created volume type: %+v\n", vt)
+	allPages, err := volumetypes.List(client).AllPages()
+	if err != nil {
+		t.Fatalf("Unable to retrieve volume types: %v", err)
+	}
 
-	vt, err = volumetypes.Get(client, vt.ID).Extract()
-	th.AssertNoErr(t, err)
-	t.Logf("Got volume type: %+v\n", vt)
+	allVolumeTypes, err := volumetypes.ExtractVolumeTypes(allPages)
+	if err != nil {
+		t.Fatalf("Unable to extract volume types: %v", err)
+	}
 
-	err = volumetypes.List(client).EachPage(func(page pagination.Page) (bool, error) {
-		volTypes, err := volumetypes.ExtractVolumeTypes(page)
-		if len(volTypes) != 1 {
-			t.Errorf("Expected 1 volume type, got %d", len(volTypes))
-		}
-		t.Logf("Listing volume types: %+v\n", volTypes)
-		return true, err
-	})
-	th.AssertNoErr(t, err)
+	for _, volumeType := range allVolumeTypes {
+		PrintVolumeType(t, &volumeType)
+	}
+}
+
+func TestVolumeTypesCreateDestroy(t *testing.T) {
+	client, err := clients.NewBlockStorageV1Client()
+	if err != nil {
+		t.Fatalf("Unable to create a blockstorage client: %v", err)
+	}
+
+	volumeType, err := CreateVolumeType(t, client)
+	if err != nil {
+		t.Fatalf("Unable to create volume type: %v", err)
+	}
+	defer DeleteVolumeType(t, client, volumeType)
+
+	PrintVolumeType(t, volumeType)
 }
diff --git a/acceptance/openstack/blockstorage/v2/blockstorage.go b/acceptance/openstack/blockstorage/v2/blockstorage.go
new file mode 100644
index 0000000..e007c2a
--- /dev/null
+++ b/acceptance/openstack/blockstorage/v2/blockstorage.go
@@ -0,0 +1,74 @@
+// Package v2 contains common functions for creating block storage based
+// resources for use in acceptance tests. See the `*_test.go` files for
+// example usages.
+package v2
+
+import (
+	"testing"
+
+	"github.com/gophercloud/gophercloud"
+	"github.com/gophercloud/gophercloud/acceptance/tools"
+	"github.com/gophercloud/gophercloud/openstack/blockstorage/v2/volumes"
+)
+
+// CreateVolume will create a volume with a random name and size of 1GB. An
+// error will be returned if the volume was unable to be created.
+func CreateVolume(t *testing.T, client *gophercloud.ServiceClient) (*volumes.Volume, error) {
+	if testing.Short() {
+		t.Skip("Skipping test that requires volume creation in short mode.")
+	}
+
+	volumeName := tools.RandomString("ACPTTEST", 16)
+	t.Logf("Attempting to create volume: %s", volumeName)
+
+	createOpts := volumes.CreateOpts{
+		Size: 1,
+		Name: volumeName,
+	}
+
+	volume, err := volumes.Create(client, createOpts).Extract()
+	if err != nil {
+		return volume, err
+	}
+
+	err = volumes.WaitForStatus(client, volume.ID, "available", 60)
+	if err != nil {
+		return volume, err
+	}
+
+	return volume, nil
+}
+
+// DeleteVolume will delete a volume. A fatal error will occur if the volume
+// failed to be deleted. This works best when used as a deferred function.
+func DeleteVolume(t *testing.T, client *gophercloud.ServiceClient, volume *volumes.Volume) {
+	err := volumes.Delete(client, volume.ID).ExtractErr()
+	if err != nil {
+		t.Fatalf("Unable to delete volume %s: %v", volume.ID, err)
+	}
+
+	t.Logf("Deleted volume: %s", volume.ID)
+}
+
+// PrintVolume will print a volume and all of its attributes.
+func PrintVolume(t *testing.T, volume *volumes.Volume) {
+	t.Logf("ID: %s", volume.ID)
+	t.Logf("Status: %s", volume.Status)
+	t.Logf("Size: %d", volume.Size)
+	t.Logf("AvailabilityZone: %s", volume.AvailabilityZone)
+	t.Logf("CreatedAt: %v", volume.CreatedAt)
+	t.Logf("UpdatedAt: %v", volume.CreatedAt)
+	t.Logf("Attachments: %#v", volume.Attachments)
+	t.Logf("Name: %s", volume.Name)
+	t.Logf("Description: %s", volume.Description)
+	t.Logf("VolumeType: %s", volume.VolumeType)
+	t.Logf("SnapshotID: %s", volume.SnapshotID)
+	t.Logf("SourceVolID: %s", volume.SourceVolID)
+	t.Logf("Metadata: %#v", volume.Metadata)
+	t.Logf("UserID: %s", volume.UserID)
+	t.Logf("Bootable: %s", volume.Bootable)
+	t.Logf("Encrypted: %s", volume.Encrypted)
+	t.Logf("ReplicationStatus: %s", volume.ReplicationStatus)
+	t.Logf("ConsistencyGroupID: %s", volume.ConsistencyGroupID)
+	t.Logf("Multiattach: %t", volume.Multiattach)
+}
diff --git a/acceptance/openstack/blockstorage/v2/extensions/extensions.go b/acceptance/openstack/blockstorage/v2/extensions/extensions.go
new file mode 100644
index 0000000..685f769
--- /dev/null
+++ b/acceptance/openstack/blockstorage/v2/extensions/extensions.go
@@ -0,0 +1,97 @@
+// Package extensions contains common functions for creating block storage
+// resources that are extensions of the block storage API. See the `*_test.go`
+// files for example usages.
+package extensions
+
+import (
+	"testing"
+
+	"github.com/gophercloud/gophercloud"
+	"github.com/gophercloud/gophercloud/openstack/blockstorage/v2/extensions/volumeactions"
+	"github.com/gophercloud/gophercloud/openstack/blockstorage/v2/volumes"
+	"github.com/gophercloud/gophercloud/openstack/compute/v2/servers"
+)
+
+// CreateVolumeAttach will attach a volume to an instance. An error will be
+// returned if the attachment failed.
+func CreateVolumeAttach(t *testing.T, client *gophercloud.ServiceClient, volume *volumes.Volume, server *servers.Server) error {
+	if testing.Short() {
+		t.Skip("Skipping test that requires volume attachment in short mode.")
+	}
+
+	attachOpts := volumeactions.AttachOpts{
+		MountPoint:   "/mnt",
+		Mode:         "rw",
+		InstanceUUID: server.ID,
+	}
+
+	t.Logf("Attempting to attach volume %s to server %s", volume.ID, server.ID)
+
+	if err := volumeactions.Attach(client, volume.ID, attachOpts).ExtractErr(); err != nil {
+		return err
+	}
+
+	if err := volumes.WaitForStatus(client, volume.ID, "in-use", 60); err != nil {
+		return err
+	}
+
+	t.Logf("Attached volume %s to server %s", volume.ID, server.ID)
+
+	return nil
+}
+
+// CreateVolumeReserve creates a volume reservation. An error will be returned
+// if the reservation failed.
+func CreateVolumeReserve(t *testing.T, client *gophercloud.ServiceClient, volume *volumes.Volume) error {
+	if testing.Short() {
+		t.Skip("Skipping test that requires volume reservation in short mode.")
+	}
+
+	t.Logf("Attempting to reserve volume %s", volume.ID)
+
+	if err := volumeactions.Reserve(client, volume.ID).ExtractErr(); err != nil {
+		return err
+	}
+
+	t.Logf("Reserved volume %s", volume.ID)
+
+	return nil
+}
+
+// DeleteVolumeAttach will detach a volume from an instance. A fatal error will
+// occur if the snapshot failed to be deleted. This works best when used as a
+// deferred function.
+func DeleteVolumeAttach(t *testing.T, client *gophercloud.ServiceClient, volume *volumes.Volume) {
+	t.Logf("Attepting to detach volume volume: %s", volume.ID)
+
+	detachOpts := volumeactions.DetachOpts{
+		AttachmentID: volume.Attachments[0].AttachmentID,
+	}
+
+	if err := volumeactions.Detach(client, volume.ID, detachOpts).ExtractErr(); err != nil {
+		t.Fatalf("Unable to detach volume %s: %v", volume.ID, err)
+	}
+
+	if err := volumes.WaitForStatus(client, volume.ID, "available", 60); err != nil {
+		t.Fatalf("Volume %s failed to become unavailable in 60 seconds: %v", volume.ID, err)
+	}
+
+	t.Logf("Detached volume: %s", volume.ID)
+}
+
+// DeleteVolumeReserve deletes a volume reservation. A fatal error will occur
+// if the deletion request failed. This works best when used as a deferred
+// function.
+func DeleteVolumeReserve(t *testing.T, client *gophercloud.ServiceClient, volume *volumes.Volume) {
+	if testing.Short() {
+		t.Skip("Skipping test that requires volume reservation in short mode.")
+	}
+
+	t.Logf("Attempting to unreserve volume %s", volume.ID)
+
+	if err := volumeactions.Unreserve(client, volume.ID).ExtractErr(); err != nil {
+		t.Fatalf("Unable to unreserve volume %s: %v", volume.ID, err)
+	}
+
+	t.Logf("Unreserved volume %s", volume.ID)
+}
diff --git a/acceptance/openstack/blockstorage/v2/extensions/volumeactions_test.go b/acceptance/openstack/blockstorage/v2/extensions/volumeactions_test.go
index 20a4597..83d1571 100644
--- a/acceptance/openstack/blockstorage/v2/extensions/volumeactions_test.go
+++ b/acceptance/openstack/blockstorage/v2/extensions/volumeactions_test.go
@@ -3,147 +3,116 @@
 package extensions
 
 import (
-	"os"
 	"testing"
 
-	"github.com/gophercloud/gophercloud"
-	"github.com/gophercloud/gophercloud/openstack"
-	"github.com/gophercloud/gophercloud/openstack/blockstorage/v2/extensions/volumeactions"
+	"github.com/gophercloud/gophercloud/acceptance/clients"
 	"github.com/gophercloud/gophercloud/openstack/blockstorage/v2/volumes"
-	th "github.com/gophercloud/gophercloud/testhelper"
+
+	blockstorage "github.com/gophercloud/gophercloud/acceptance/openstack/blockstorage/v2"
+	compute "github.com/gophercloud/gophercloud/acceptance/openstack/compute/v2"
 )
 
-func newClient(t *testing.T) (*gophercloud.ServiceClient, error) {
-	ao, err := openstack.AuthOptionsFromEnv()
-	th.AssertNoErr(t, err)
-
-	client, err := openstack.AuthenticatedClient(ao)
-	th.AssertNoErr(t, err)
-
-	return openstack.NewBlockStorageV2(client, gophercloud.EndpointOpts{
-		Region: os.Getenv("OS_REGION_NAME"),
-	})
-}
-
-func TestVolumeAttach(t *testing.T) {
-	client, err := newClient(t)
-	th.AssertNoErr(t, err)
-
-	t.Logf("Creating volume")
-	cv, err := volumes.Create(client, &volumes.CreateOpts{
-		Size: 1,
-		Name: "blockv2-volume",
-	}).Extract()
-	th.AssertNoErr(t, err)
-
-	defer func() {
-		err = volumes.WaitForStatus(client, cv.ID, "available", 60)
-		th.AssertNoErr(t, err)
-
-		t.Logf("Deleting volume")
-		err = volumes.Delete(client, cv.ID).ExtractErr()
-		th.AssertNoErr(t, err)
-	}()
-
-	err = volumes.WaitForStatus(client, cv.ID, "available", 60)
-	th.AssertNoErr(t, err)
-
-	instanceID := os.Getenv("OS_INSTANCE_ID")
-	if instanceID == "" {
-		t.Fatal("Environment variable OS_INSTANCE_ID is required")
+func TestVolumeActionsAttachCreateDestroy(t *testing.T) {
+	blockClient, err := clients.NewBlockStorageV2Client()
+	if err != nil {
+		t.Fatalf("Unable to create a blockstorage client: %v", err)
 	}
 
-	t.Logf("Attaching volume")
-	err = volumeactions.Attach(client, cv.ID, &volumeactions.AttachOpts{
-		MountPoint:   "/mnt",
-		Mode:         "rw",
-		InstanceUUID: instanceID,
-	}).ExtractErr()
-	th.AssertNoErr(t, err)
+	computeClient, err := clients.NewComputeV2Client()
+	if err != nil {
+		t.Fatalf("Unable to create a compute client: %v", err)
+	}
 
-	err = volumes.WaitForStatus(client, cv.ID, "in-use", 60)
-	th.AssertNoErr(t, err)
+	choices, err := clients.AcceptanceTestChoicesFromEnv()
+	if err != nil {
+		t.Fatal(err)
+	}
 
-	t.Logf("Detaching volume")
-	err = volumeactions.Detach(client, cv.ID).ExtractErr()
-	th.AssertNoErr(t, err)
+	server, err := compute.CreateServer(t, computeClient, choices)
+	if err != nil {
+		t.Fatalf("Unable to create server: %v", err)
+	}
+	defer compute.DeleteServer(t, computeClient, server)
+
+	volume, err := blockstorage.CreateVolume(t, blockClient)
+	if err != nil {
+		t.Fatalf("Unable to create volume: %v", err)
+	}
+	defer blockstorage.DeleteVolume(t, blockClient, volume)
+
+	err = CreateVolumeAttach(t, blockClient, volume, server)
+	if err != nil {
+		t.Fatalf("Unable to attach volume: %v", err)
+	}
+
+	newVolume, err := volumes.Get(blockClient, volume.ID).Extract()
+	if err != nil {
+		t.Fatal("Unable to get updated volume information: %v", err)
+	}
+
+	DeleteVolumeAttach(t, blockClient, newVolume)
 }
 
-func TestVolumeReserve(t *testing.T) {
-	client, err := newClient(t)
-	th.AssertNoErr(t, err)
+func TestVolumeActionsReserveUnreserve(t *testing.T) {
+	client, err := clients.NewBlockStorageV2Client()
+	if err != nil {
+		t.Fatalf("Unable to create blockstorage client: %v", err)
+	}
 
-	t.Logf("Creating volume")
-	cv, err := volumes.Create(client, &volumes.CreateOpts{
-		Size: 1,
-		Name: "blockv2-volume",
-	}).Extract()
-	th.AssertNoErr(t, err)
+	volume, err := blockstorage.CreateVolume(t, client)
+	if err != nil {
+		t.Fatalf("Unable to create volume: %v", err)
+	}
+	defer blockstorage.DeleteVolume(t, client, volume)
 
-	defer func() {
-		err = volumes.WaitForStatus(client, cv.ID, "available", 60)
-		th.AssertNoErr(t, err)
-
-		t.Logf("Deleting volume")
-		err = volumes.Delete(client, cv.ID).ExtractErr()
-		th.AssertNoErr(t, err)
-	}()
-
-	err = volumes.WaitForStatus(client, cv.ID, "available", 60)
-	th.AssertNoErr(t, err)
-
-	t.Logf("Reserving volume")
-	err = volumeactions.Reserve(client, cv.ID).ExtractErr()
-	th.AssertNoErr(t, err)
-
-	err = volumes.WaitForStatus(client, cv.ID, "attaching", 60)
-	th.AssertNoErr(t, err)
-
-	t.Logf("Unreserving volume")
-	err = volumeactions.Unreserve(client, cv.ID).ExtractErr()
-	th.AssertNoErr(t, err)
-
-	err = volumes.WaitForStatus(client, cv.ID, "available", 60)
-	th.AssertNoErr(t, err)
+	err = CreateVolumeReserve(t, client, volume)
+	if err != nil {
+		t.Fatalf("Unable to create volume reserve: %v", err)
+	}
+	defer DeleteVolumeReserve(t, client, volume)
 }
 
+// Note(jtopjian): I plan to work on this at some point, but it requires
+// setting up a server with iscsi utils.
+/*
 func TestVolumeConns(t *testing.T) {
-	client, err := newClient(t)
-	th.AssertNoErr(t, err)
+    client, err := newClient()
+    th.AssertNoErr(t, err)
 
-	t.Logf("Creating volume")
-	cv, err := volumes.Create(client, &volumes.CreateOpts{
-		Size: 1,
-		Name: "blockv2-volume",
-	}).Extract()
-	th.AssertNoErr(t, err)
+    t.Logf("Creating volume")
+    cv, err := volumes.Create(client, &volumes.CreateOpts{
+        Size: 1,
+        Name: "blockv2-volume",
+    }).Extract()
+    th.AssertNoErr(t, err)
 
-	defer func() {
-		err = volumes.WaitForStatus(client, cv.ID, "available", 60)
-		th.AssertNoErr(t, err)
+    defer func() {
+        err = volumes.WaitForStatus(client, cv.ID, "available", 60)
+        th.AssertNoErr(t, err)
 
-		t.Logf("Deleting volume")
-		err = volumes.Delete(client, cv.ID).ExtractErr()
-		th.AssertNoErr(t, err)
-	}()
+        t.Logf("Deleting volume")
+        err = volumes.Delete(client, cv.ID).ExtractErr()
+        th.AssertNoErr(t, err)
+    }()
 
-	err = volumes.WaitForStatus(client, cv.ID, "available", 60)
-	th.AssertNoErr(t, err)
+    err = volumes.WaitForStatus(client, cv.ID, "available", 60)
+    th.AssertNoErr(t, err)
 
-	connOpts := &volumeactions.ConnectorOpts{
-		IP:        "127.0.0.1",
-		Host:      "stack",
-		Initiator: "iqn.1994-05.com.redhat:17cf566367d2",
-		Multipath: false,
-		Platform:  "x86_64",
-		OSType:    "linux2",
-	}
+    connOpts := &volumeactions.ConnectorOpts{
+        IP:        "127.0.0.1",
+        Host:      "stack",
+        Initiator: "iqn.1994-05.com.redhat:17cf566367d2",
+        Multipath: false,
+        Platform:  "x86_64",
+        OSType:    "linux2",
+    }
 
-	t.Logf("Initializing connection")
-	_, err = volumeactions.InitializeConnection(client, cv.ID, connOpts).Extract()
-	th.AssertNoErr(t, err)
+    t.Logf("Initializing connection")
+    _, err = volumeactions.InitializeConnection(client, cv.ID, connOpts).Extract()
+    th.AssertNoErr(t, err)
 
-	t.Logf("Terminating connection")
-	err = volumeactions.TerminateConnection(client, cv.ID, connOpts).ExtractErr()
-	th.AssertNoErr(t, err)
+    t.Logf("Terminating connection")
+    err = volumeactions.TerminateConnection(client, cv.ID, connOpts).ExtractErr()
+    th.AssertNoErr(t, err)
 }
+*/
diff --git a/acceptance/openstack/blockstorage/v2/volumes_test.go b/acceptance/openstack/blockstorage/v2/volumes_test.go
index 9edf31a..3508bc5 100644
--- a/acceptance/openstack/blockstorage/v2/volumes_test.go
+++ b/acceptance/openstack/blockstorage/v2/volumes_test.go
@@ -3,61 +3,49 @@
 package v2
 
 import (
-	"os"
 	"testing"
 
-	"github.com/gophercloud/gophercloud"
-	"github.com/gophercloud/gophercloud/openstack"
+	"github.com/gophercloud/gophercloud/acceptance/clients"
 	"github.com/gophercloud/gophercloud/openstack/blockstorage/v2/volumes"
-	"github.com/gophercloud/gophercloud/pagination"
-	th "github.com/gophercloud/gophercloud/testhelper"
 )
 
-func newClient(t *testing.T) (*gophercloud.ServiceClient, error) {
-	ao, err := openstack.AuthOptionsFromEnv()
-	th.AssertNoErr(t, err)
-
-	client, err := openstack.AuthenticatedClient(ao)
-	th.AssertNoErr(t, err)
-
-	return openstack.NewBlockStorageV2(client, gophercloud.EndpointOpts{
-		Region: os.Getenv("OS_REGION_NAME"),
-	})
-}
-
-func TestVolumes(t *testing.T) {
-	client, err := newClient(t)
-	th.AssertNoErr(t, err)
-
-	cv, err := volumes.Create(client, &volumes.CreateOpts{
-		Size: 1,
-		Name: "blockv2-volume",
-	}).Extract()
-	th.AssertNoErr(t, err)
-	defer func() {
-		err = volumes.WaitForStatus(client, cv.ID, "available", 60)
-		th.AssertNoErr(t, err)
-		err = volumes.Delete(client, cv.ID).ExtractErr()
-		th.AssertNoErr(t, err)
-	}()
-
-	_, err = volumes.Update(client, cv.ID, &volumes.UpdateOpts{
-		Name: "blockv2-updated-volume",
-	}).Extract()
-	th.AssertNoErr(t, err)
-
-	v, err := volumes.Get(client, cv.ID).Extract()
-	th.AssertNoErr(t, err)
-	t.Logf("Got volume: %+v\n", v)
-
-	if v.Name != "blockv2-updated-volume" {
-		t.Errorf("Unable to update volume: Expected name: blockv2-updated-volume\nActual name: %s", v.Name)
+func TestVolumesList(t *testing.T) {
+	client, err := clients.NewBlockStorageV2Client()
+	if err != nil {
+		t.Fatalf("Unable to create a blockstorage client: %v", err)
 	}
 
-	err = volumes.List(client, &volumes.ListOpts{Name: "blockv2-updated-volume"}).EachPage(func(page pagination.Page) (bool, error) {
-		vols, err := volumes.ExtractVolumes(page)
-		th.CheckEquals(t, 1, len(vols))
-		return true, err
-	})
-	th.AssertNoErr(t, err)
+	allPages, err := volumes.List(client, volumes.ListOpts{}).AllPages()
+	if err != nil {
+		t.Fatalf("Unable to retrieve volumes: %v", err)
+	}
+
+	allVolumes, err := volumes.ExtractVolumes(allPages)
+	if err != nil {
+		t.Fatalf("Unable to extract volumes: %v", err)
+	}
+
+	for _, volume := range allVolumes {
+		PrintVolume(t, &volume)
+	}
+}
+
+func TestVolumesCreateDestroy(t *testing.T) {
+	client, err := clients.NewBlockStorageV2Client()
+	if err != nil {
+		t.Fatalf("Unable to create blockstorage client: %v", err)
+	}
+
+	volume, err := CreateVolume(t, client)
+	if err != nil {
+		t.Fatalf("Unable to create volume: %v", err)
+	}
+	defer DeleteVolume(t, client, volume)
+
+	newVolume, err := volumes.Get(client, volume.ID).Extract()
+	if err != nil {
+		t.Errorf("Unable to retrieve volume: %v", err)
+	}
+
+	PrintVolume(t, newVolume)
 }
