Adding support for replicas
diff --git a/rackspace/db/v1/instances/requests_test.go b/rackspace/db/v1/instances/requests_test.go
index 66d58fd..2cafa22 100644
--- a/rackspace/db/v1/instances/requests_test.go
+++ b/rackspace/db/v1/instances/requests_test.go
@@ -3,12 +3,32 @@
 import (
 	"testing"
 
+	"github.com/rackspace/gophercloud"
+	os "github.com/rackspace/gophercloud/openstack/db/v1/instances"
 	"github.com/rackspace/gophercloud/pagination"
 	"github.com/rackspace/gophercloud/rackspace/db/v1/backups"
 	th "github.com/rackspace/gophercloud/testhelper"
 	fake "github.com/rackspace/gophercloud/testhelper/client"
 )
 
+var expectedReplica = &Instance{
+	Status:  "BUILD",
+	Updated: "2014-10-14T18:42:15",
+	Name:    "t2s1_ALT_GUEST",
+	Links: []gophercloud.Link{
+		gophercloud.Link{Rel: "self", Href: "https://ord.databases.api.rackspacecloud.com/v1.0/5919009/instances/8367c312-7c40-4a66-aab1-5767478914fc"},
+		gophercloud.Link{Rel: "bookmark", Href: "https://ord.databases.api.rackspacecloud.com/instances/8367c312-7c40-4a66-aab1-5767478914fc"},
+	},
+	Created:   "2014-10-14T18:42:15",
+	ID:        "8367c312-7c40-4a66-aab1-5767478914fc",
+	Volume:    os.Volume{Size: 1},
+	Flavor:    os.Flavor{ID: "9"},
+	Datastore: Datastore{Version: "5.6", Type: "mysql"},
+	ReplicaOf: &Instance{
+		ID: "6bdca2fc-418e-40bd-a595-62abda61862d",
+	},
+}
+
 func TestGetConfig(t *testing.T) {
 	th.SetupHTTP()
 	defer th.TeardownHTTP()
@@ -114,3 +134,113 @@
 		t.Errorf("Expected 1 page, got %d", count)
 	}
 }
+
+func TestCreateReplica(t *testing.T) {
+	th.SetupHTTP()
+	defer th.TeardownHTTP()
+
+	HandleCreateReplicaSuccessfully(t)
+
+	opts := CreateOpts{
+		Name:      "t2s1_ALT_GUEST",
+		FlavorRef: "9",
+		Size:      1,
+		ReplicaOf: "6bdca2fc-418e-40bd-a595-62abda61862d",
+	}
+
+	replica, err := Create(fake.ServiceClient(), opts).Extract()
+	th.AssertNoErr(t, err)
+
+	th.AssertDeepEquals(t, expectedReplica, replica)
+}
+
+func TestListReplicas(t *testing.T) {
+	th.SetupHTTP()
+	defer th.TeardownHTTP()
+
+	HandleListReplicasSuccessfully(t)
+
+	pages := 0
+	err := List(fake.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) {
+		pages++
+
+		actual, err := ExtractInstances(page)
+		if err != nil {
+			return false, err
+		}
+
+		expected := []Instance{
+			Instance{
+				Status: "ACTIVE",
+				Name:   "t1s1_ALT_GUEST",
+				Links: []gophercloud.Link{
+					gophercloud.Link{Rel: "self", Href: "https://ord.databases.api.rackspacecloud.com/v1.0/1234/instances/3c691f06-bf9a-4618-b7ec-2817ce0cf254"},
+					gophercloud.Link{Rel: "bookmark", Href: "https://ord.databases.api.rackspacecloud.com/instances/3c691f06-bf9a-4618-b7ec-2817ce0cf254"},
+				},
+				ID:        "3c691f06-bf9a-4618-b7ec-2817ce0cf254",
+				IP:        []string{"10.0.0.3"},
+				Volume:    os.Volume{Size: 1},
+				Flavor:    os.Flavor{ID: "9"},
+				Datastore: Datastore{Version: "5.6", Type: "mysql"},
+				ReplicaOf: &Instance{
+					ID: "8b499b45-52d6-402d-b398-f9d8f279c69a",
+				},
+			},
+		}
+
+		th.CheckDeepEquals(t, expected, actual)
+
+		return true, nil
+	})
+
+	th.AssertNoErr(t, err)
+
+	if pages != 1 {
+		t.Errorf("Expected 1 page, saw %d", pages)
+	}
+}
+
+func TestGetReplica(t *testing.T) {
+	th.SetupHTTP()
+	defer th.TeardownHTTP()
+
+	HandleGetReplicaSuccessfully(t, instanceID)
+
+	replica, err := Get(fake.ServiceClient(), instanceID).Extract()
+	th.AssertNoErr(t, err)
+
+	expectedReplica := &Instance{
+		Status:  "ACTIVE",
+		Updated: "2014-09-26T19:15:57",
+		Name:    "t1_ALT_GUEST",
+		Created: "2014-09-26T19:15:50",
+		IP: []string{
+			"10.0.0.2",
+		},
+		Replicas: []Instance{
+			Instance{ID: "3c691f06-bf9a-4618-b7ec-2817ce0cf254"},
+		},
+		ID: "8b499b45-52d6-402d-b398-f9d8f279c69a",
+		Volume: os.Volume{
+			Used: 0.54,
+			Size: 1,
+		},
+		Flavor: os.Flavor{ID: "9"},
+		Datastore: Datastore{
+			Version: "5.6",
+			Type:    "mysql",
+		},
+	}
+
+	th.AssertDeepEquals(t, replica, expectedReplica)
+}
+
+func TestDetachReplica(t *testing.T) {
+	th.SetupHTTP()
+	defer th.TeardownHTTP()
+
+	HandleDetachReplicaSuccessfully(t, "{replicaID}")
+
+	err := DetachReplica(fake.ServiceClient(), "{replicaID}").ExtractErr()
+	th.AssertNoErr(t, err)
+}