Adding instance actions
diff --git a/openstack/db/v1/instances/fixtures.go b/openstack/db/v1/instances/fixtures.go
index c62be4e..66448a7 100644
--- a/openstack/db/v1/instances/fixtures.go
+++ b/openstack/db/v1/instances/fixtures.go
@@ -174,3 +174,30 @@
 		fmt.Fprintf(w, `{"rootEnabled":true}`)
 	})
 }
+
+func HandleRestartSuccessfully(t *testing.T, id string) {
+	th.Mux.HandleFunc("/instances/"+id+"/action", func(w http.ResponseWriter, r *http.Request) {
+		th.TestMethod(t, r, "POST")
+		th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
+		th.TestJSONRequest(t, r, `{"restart": true}`)
+		w.WriteHeader(http.StatusAccepted)
+	})
+}
+
+func HandleResizeInstanceSuccessfully(t *testing.T, id string) {
+	th.Mux.HandleFunc("/instances/"+id+"/action", func(w http.ResponseWriter, r *http.Request) {
+		th.TestMethod(t, r, "POST")
+		th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
+		th.TestJSONRequest(t, r, `{"resize": {"flavorRef": "2"}}`)
+		w.WriteHeader(http.StatusAccepted)
+	})
+}
+
+func HandleResizeVolSuccessfully(t *testing.T, id string) {
+	th.Mux.HandleFunc("/instances/"+id+"/action", func(w http.ResponseWriter, r *http.Request) {
+		th.TestMethod(t, r, "POST")
+		th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
+		th.TestJSONRequest(t, r, `{"resize": {"volume": {"size": 4}}}`)
+		w.WriteHeader(http.StatusAccepted)
+	})
+}
diff --git a/openstack/db/v1/instances/requests.go b/openstack/db/v1/instances/requests.go
index 8bac170..b272ce3 100644
--- a/openstack/db/v1/instances/requests.go
+++ b/openstack/db/v1/instances/requests.go
@@ -253,3 +253,60 @@
 
 	return res.Body.(map[string]interface{})["rootEnabled"] == true, err
 }
+
+func RestartService(client *gophercloud.ServiceClient, id string) ActionResult {
+	var res ActionResult
+
+	resp, err := perigee.Request("POST", actionURL(client, id), perigee.Options{
+		MoreHeaders: client.AuthenticatedHeaders(),
+		ReqBody:     map[string]bool{"restart": true},
+		OkCodes:     []int{202},
+	})
+
+	res.Header = resp.HttpResponse.Header
+	res.Err = err
+
+	return res
+}
+
+func ResizeInstance(client *gophercloud.ServiceClient, id, flavorRef string) ActionResult {
+	var res ActionResult
+
+	reqBody := map[string]map[string]string{
+		"resize": map[string]string{
+			"flavorRef": flavorRef,
+		},
+	}
+
+	resp, err := perigee.Request("POST", actionURL(client, id), perigee.Options{
+		MoreHeaders: client.AuthenticatedHeaders(),
+		ReqBody:     reqBody,
+		OkCodes:     []int{202},
+	})
+
+	res.Header = resp.HttpResponse.Header
+	res.Err = err
+
+	return res
+}
+
+func ResizeVolume(client *gophercloud.ServiceClient, id string, size int) ActionResult {
+	var res ActionResult
+
+	reqBody := map[string]map[string]map[string]int{
+		"resize": map[string]map[string]int{
+			"volume": map[string]int{"size": size},
+		},
+	}
+
+	resp, err := perigee.Request("POST", actionURL(client, id), perigee.Options{
+		MoreHeaders: client.AuthenticatedHeaders(),
+		ReqBody:     reqBody,
+		OkCodes:     []int{202},
+	})
+
+	res.Header = resp.HttpResponse.Header
+	res.Err = err
+
+	return res
+}
diff --git a/openstack/db/v1/instances/requests_test.go b/openstack/db/v1/instances/requests_test.go
index 0dfcdc6..e079dd0 100644
--- a/openstack/db/v1/instances/requests_test.go
+++ b/openstack/db/v1/instances/requests_test.go
@@ -155,3 +155,36 @@
 	th.AssertNoErr(t, err)
 	th.AssertEquals(t, true, isEnabled)
 }
+
+func TestRestartService(t *testing.T) {
+	th.SetupHTTP()
+	defer th.TeardownHTTP()
+
+	HandleRestartSuccessfully(t, instanceID)
+
+	res := RestartService(fake.ServiceClient(), instanceID)
+
+	th.AssertNoErr(t, res.Err)
+}
+
+func TestResizeInstance(t *testing.T) {
+	th.SetupHTTP()
+	defer th.TeardownHTTP()
+
+	HandleResizeInstanceSuccessfully(t, instanceID)
+
+	res := ResizeInstance(fake.ServiceClient(), instanceID, "2")
+
+	th.AssertNoErr(t, res.Err)
+}
+
+func TestResizeVolume(t *testing.T) {
+	th.SetupHTTP()
+	defer th.TeardownHTTP()
+
+	HandleResizeVolSuccessfully(t, instanceID)
+
+	res := ResizeVolume(fake.ServiceClient(), instanceID, 4)
+
+	th.AssertNoErr(t, res.Err)
+}
diff --git a/openstack/db/v1/instances/results.go b/openstack/db/v1/instances/results.go
index 60f0c04..48b930c 100644
--- a/openstack/db/v1/instances/results.go
+++ b/openstack/db/v1/instances/results.go
@@ -118,3 +118,7 @@
 
 	return &response.User, err
 }
+
+type ActionResult struct {
+	gophercloud.ErrResult
+}
diff --git a/openstack/db/v1/instances/urls.go b/openstack/db/v1/instances/urls.go
index a50da96..28c0bec 100644
--- a/openstack/db/v1/instances/urls.go
+++ b/openstack/db/v1/instances/urls.go
@@ -13,3 +13,7 @@
 func userRootURL(c *gophercloud.ServiceClient, id string) string {
 	return c.ServiceURL("instances", id, "root")
 }
+
+func actionURL(c *gophercloud.ServiceClient, id string) string {
+	return c.ServiceURL("instances", id, "action")
+}