diff --git a/openstack/compute/v2/servers/fixtures.go b/openstack/compute/v2/servers/fixtures.go
index ed03b5c..e116a27 100644
--- a/openstack/compute/v2/servers/fixtures.go
+++ b/openstack/compute/v2/servers/fixtures.go
@@ -470,8 +470,8 @@
 	})
 }
 
-// HandleMetadataGetSuccessfully sets up the test server to respond to a metadata Get request.
-func HandleMetadataGetSuccessfully(t *testing.T) {
+// HandleMetadatumGetSuccessfully sets up the test server to respond to a metadatum Get request.
+func HandleMetadatumGetSuccessfully(t *testing.T) {
 	th.Mux.HandleFunc("/servers/1234asdf/metadata/foo", func(w http.ResponseWriter, r *http.Request) {
 		th.TestMethod(t, r, "GET")
 		th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
@@ -483,8 +483,8 @@
 	})
 }
 
-// HandleMetadataCreateSuccessfully sets up the test server to respond to a server creation request.
-func HandleMetadataCreateSuccessfully(t *testing.T) {
+// HandleMetadatumCreateSuccessfully sets up the test server to respond to a metadatum Create request.
+func HandleMetadatumCreateSuccessfully(t *testing.T) {
 	th.Mux.HandleFunc("/servers/1234asdf/metadata/foo", func(w http.ResponseWriter, r *http.Request) {
 		th.TestMethod(t, r, "PUT")
 		th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
@@ -500,8 +500,8 @@
 	})
 }
 
-// HandleMetadataDeleteSuccessfully sets up the test server to respond to a metadata Delete request.
-func HandleMetadataDeleteSuccessfully(t *testing.T) {
+// HandleMetadatumDeleteSuccessfully sets up the test server to respond to a metadatum Delete request.
+func HandleMetadatumDeleteSuccessfully(t *testing.T) {
 	th.Mux.HandleFunc("/servers/1234asdf/metadata/foo", func(w http.ResponseWriter, r *http.Request) {
 		th.TestMethod(t, r, "DELETE")
 		th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
@@ -510,8 +510,8 @@
 	})
 }
 
-// HandleMetadatasGetSuccessfully sets up the test server to respond to a metadatas Get request.
-func HandleMetadatasGetSuccessfully(t *testing.T) {
+// HandleMetadataGetSuccessfully sets up the test server to respond to a metadata Get request.
+func HandleMetadataGetSuccessfully(t *testing.T) {
 	th.Mux.HandleFunc("/servers/1234asdf/metadata", func(w http.ResponseWriter, r *http.Request) {
 		th.TestMethod(t, r, "GET")
 		th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
@@ -522,8 +522,8 @@
 	})
 }
 
-// HandleMetadatasCreateSuccessfully sets up the test server to respond to a metadatas Create request.
-func HandleMetadatasCreateSuccessfully(t *testing.T) {
+// HandleMetadataCreateSuccessfully sets up the test server to respond to a metadata Create request.
+func HandleMetadataCreateSuccessfully(t *testing.T) {
 	th.Mux.HandleFunc("/servers/1234asdf/metadata", func(w http.ResponseWriter, r *http.Request) {
 		th.TestMethod(t, r, "PUT")
 		th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
@@ -540,8 +540,8 @@
 	})
 }
 
-// HandleMetadatasUpdateSuccessfully sets up the test server to respond to a metadatas Update request.
-func HandleMetadatasUpdateSuccessfully(t *testing.T) {
+// HandleMetadataUpdateSuccessfully sets up the test server to respond to a metadata Update request.
+func HandleMetadataUpdateSuccessfully(t *testing.T) {
 	th.Mux.HandleFunc("/servers/1234asdf/metadata", func(w http.ResponseWriter, r *http.Request) {
 		th.TestMethod(t, r, "POST")
 		th.TestHeader(t, r, "X-Auth-Token", client.TokenID)
diff --git a/openstack/compute/v2/servers/requests.go b/openstack/compute/v2/servers/requests.go
index 7023bcf..5298391 100644
--- a/openstack/compute/v2/servers/requests.go
+++ b/openstack/compute/v2/servers/requests.go
@@ -594,110 +594,37 @@
 	return result
 }
 
-// CreateMetadatasOptsBuilder allows extensions to add additional parameters to the
+// CreateMetadataOptsBuilder allows extensions to add additional parameters to the
 // Create request.
-type CreateMetadatasOptsBuilder interface {
-	ToMetadatasCreateMap() (map[string]interface{}, error)
+type CreateMetadataOptsBuilder interface {
+	ToMetadataCreateMap() (map[string]interface{}, error)
 }
 
-// MetadatasOpts is a map that contains key-value pairs.
-type MetadatasOpts map[string]string
+// MetadataOpts is a map that contains key-value pairs.
+type MetadataOpts map[string]string
 
-// ToMetadatasCreateMap assembles a body for a Create request based on the contents of a MetadatasOpts.
-func (opts MetadatasOpts) ToMetadatasCreateMap() (map[string]interface{}, error) {
+// ToMetadataCreateMap assembles a body for a Create request based on the contents of a MetadataOpts.
+func (opts MetadataOpts) ToMetadataCreateMap() (map[string]interface{}, error) {
 	return map[string]interface{}{"metadata": opts}, nil
 }
 
-// UpdateMetadatasOptsBuilder allows extensions to add additional parameters to the
-// Create request.
-type UpdateMetadatasOptsBuilder interface {
-	ToMetadatasUpdateMap() (map[string]interface{}, error)
-}
-
-// ToMetadatasUpdateMap assembles a body for an Update request based on the contents of a MetadatasOpts.
-func (opts MetadatasOpts) ToMetadatasUpdateMap() (map[string]interface{}, error) {
+// ToMetadataUpdateMap assembles a body for an Update request based on the contents of a MetadataOpts.
+func (opts MetadataOpts) ToMetadataUpdateMap() (map[string]interface{}, error) {
 	return map[string]interface{}{"metadata": opts}, nil
 }
 
-// CreateMetadatas will create multiple new key-value pairs for the given server ID.
+// CreateMetadata will create multiple new key-value pairs for the given server ID.
 // Note: Using this operation will erase any already-existing metadata and create
 // the new metadata provided. To keep any already-existing metadata, use the
 // UpdateMetadatas or UpdateMetadata function.
-func CreateMetadatas(client *gophercloud.ServiceClient, id string, opts CreateMetadatasOptsBuilder) CreateMetadatasResult {
-	var res CreateMetadatasResult
-	metadatas, err := opts.ToMetadatasCreateMap()
-	if err != nil {
-		res.Err = err
-		return res
-	}
-	_, res.Err = perigee.Request("PUT", metadatasURL(client, id), perigee.Options{
-		ReqBody:     metadatas,
-		Results:     &res.Body,
-		MoreHeaders: client.AuthenticatedHeaders(),
-	})
-	return res
-}
-
-// Metadatas requests all the metadata for the given server ID.
-func Metadatas(client *gophercloud.ServiceClient, id string) GetMetadatasResult {
-	var res GetMetadatasResult
-	_, res.Err = perigee.Request("GET", metadatasURL(client, id), perigee.Options{
-		Results:     &res.Body,
-		MoreHeaders: client.AuthenticatedHeaders(),
-	})
-	return res
-}
-
-// UpdateMetadatas updates (or creates) all the metadata specified by opts for the given server ID.
-// This operation does not affect already-existing metadata that is not specified
-// by opts.
-func UpdateMetadatas(client *gophercloud.ServiceClient, id string, opts UpdateMetadatasOptsBuilder) UpdateMetadatasResult {
-	var res UpdateMetadatasResult
-	metadatas, err := opts.ToMetadatasUpdateMap()
-	if err != nil {
-		res.Err = err
-		return res
-	}
-	_, res.Err = perigee.Request("POST", metadatasURL(client, id), perigee.Options{
-		ReqBody:     metadatas,
-		Results:     &res.Body,
-		MoreHeaders: client.AuthenticatedHeaders(),
-	})
-	return res
-}
-
-// MetadataOptsBuilder allows extensions to add additional parameters to the
-// Create request.
-type MetadataOptsBuilder interface {
-	ToMetadataCreateMap() (map[string]interface{}, string, error)
-}
-
-// MetadataOpts is a map of length one that contains a key-value pair.
-type MetadataOpts map[string]string
-
-// ToMetadataCreateMap assembles a body for a Create request based on the contents of a MetadatasOpts.
-func (opts MetadataOpts) ToMetadataCreateMap() (map[string]interface{}, string, error) {
-	if len(opts) != 1 {
-		return nil, "", errors.New("CreateMetadata operation must have 1 and only 1 key-value pair.")
-	}
-	metadata := map[string]interface{}{"meta": opts}
-	var key string
-	for k := range metadata["meta"].(MetadataOpts) {
-		key = k
-	}
-	return metadata, key, nil
-}
-
-// CreateMetadata will create or update the key-value pair with the given key for the given server ID.
-func CreateMetadata(client *gophercloud.ServiceClient, id string, opts MetadataOptsBuilder) CreateMetadataResult {
+func CreateMetadata(client *gophercloud.ServiceClient, id string, opts CreateMetadataOptsBuilder) CreateMetadataResult {
 	var res CreateMetadataResult
-	metadata, key, err := opts.ToMetadataCreateMap()
+	metadata, err := opts.ToMetadataCreateMap()
 	if err != nil {
 		res.Err = err
 		return res
 	}
-
-	_, res.Err = perigee.Request("PUT", metadataURL(client, id, key), perigee.Options{
+	_, res.Err = perigee.Request("PUT", metadataURL(client, id), perigee.Options{
 		ReqBody:     metadata,
 		Results:     &res.Body,
 		MoreHeaders: client.AuthenticatedHeaders(),
@@ -705,20 +632,93 @@
 	return res
 }
 
-// Metadata requests the key-value pair with the given key for the given server ID.
-func Metadata(client *gophercloud.ServiceClient, id, key string) GetMetadataResult {
+// Metadata requests all the metadata for the given server ID.
+func Metadata(client *gophercloud.ServiceClient, id string) GetMetadataResult {
 	var res GetMetadataResult
-	_, res.Err = perigee.Request("GET", metadataURL(client, id, key), perigee.Options{
+	_, res.Err = perigee.Request("GET", metadataURL(client, id), perigee.Options{
 		Results:     &res.Body,
 		MoreHeaders: client.AuthenticatedHeaders(),
 	})
 	return res
 }
 
-// DeleteMetadata will delete the key-value pair with the given key for the given server ID.
-func DeleteMetadata(client *gophercloud.ServiceClient, id, key string) DeleteMetadataResult {
-	var res DeleteMetadataResult
-	_, res.Err = perigee.Request("DELETE", metadataURL(client, id, key), perigee.Options{
+// UpdateMetadataOptsBuilder allows extensions to add additional parameters to the
+// Create request.
+type UpdateMetadataOptsBuilder interface {
+	ToMetadataUpdateMap() (map[string]interface{}, error)
+}
+
+// UpdateMetadata updates (or creates) all the metadata specified by opts for the given server ID.
+// This operation does not affect already-existing metadata that is not specified
+// by opts.
+func UpdateMetadata(client *gophercloud.ServiceClient, id string, opts UpdateMetadataOptsBuilder) UpdateMetadataResult {
+	var res UpdateMetadataResult
+	metadata, err := opts.ToMetadataUpdateMap()
+	if err != nil {
+		res.Err = err
+		return res
+	}
+	_, res.Err = perigee.Request("POST", metadataURL(client, id), perigee.Options{
+		ReqBody:     metadata,
+		Results:     &res.Body,
+		MoreHeaders: client.AuthenticatedHeaders(),
+	})
+	return res
+}
+
+// MetadatumOptsBuilder allows extensions to add additional parameters to the
+// Create request.
+type MetadatumOptsBuilder interface {
+	ToMetadatumCreateMap() (map[string]interface{}, string, error)
+}
+
+// MetadatumOpts is a map of length one that contains a key-value pair.
+type MetadatumOpts map[string]string
+
+// ToMetadatumCreateMap assembles a body for a Create request based on the contents of a MetadataumOpts.
+func (opts MetadatumOpts) ToMetadatumCreateMap() (map[string]interface{}, string, error) {
+	if len(opts) != 1 {
+		return nil, "", errors.New("CreateMetadatum operation must have 1 and only 1 key-value pair.")
+	}
+	metadatum := map[string]interface{}{"meta": opts}
+	var key string
+	for k := range metadatum["meta"].(MetadatumOpts) {
+		key = k
+	}
+	return metadatum, key, nil
+}
+
+// CreateMetadatum will create or update the key-value pair with the given key for the given server ID.
+func CreateMetadatum(client *gophercloud.ServiceClient, id string, opts MetadatumOptsBuilder) CreateMetadatumResult {
+	var res CreateMetadatumResult
+	metadatum, key, err := opts.ToMetadatumCreateMap()
+	if err != nil {
+		res.Err = err
+		return res
+	}
+
+	_, res.Err = perigee.Request("PUT", metadatumURL(client, id, key), perigee.Options{
+		ReqBody:     metadatum,
+		Results:     &res.Body,
+		MoreHeaders: client.AuthenticatedHeaders(),
+	})
+	return res
+}
+
+// Metadatum requests the key-value pair with the given key for the given server ID.
+func Metadatum(client *gophercloud.ServiceClient, id, key string) GetMetadatumResult {
+	var res GetMetadatumResult
+	_, res.Err = perigee.Request("GET", metadatumURL(client, id, key), perigee.Options{
+		Results:     &res.Body,
+		MoreHeaders: client.AuthenticatedHeaders(),
+	})
+	return res
+}
+
+// DeleteMetadatum will delete the key-value pair with the given key for the given server ID.
+func DeleteMetadatum(client *gophercloud.ServiceClient, id, key string) DeleteMetadatumResult {
+	var res DeleteMetadatumResult
+	_, res.Err = perigee.Request("DELETE", metadatumURL(client, id, key), perigee.Options{
 		Results:     &res.Body,
 		MoreHeaders: client.AuthenticatedHeaders(),
 	})
diff --git a/openstack/compute/v2/servers/requests_test.go b/openstack/compute/v2/servers/requests_test.go
index 34b0c57..0343700 100644
--- a/openstack/compute/v2/servers/requests_test.go
+++ b/openstack/compute/v2/servers/requests_test.go
@@ -189,14 +189,48 @@
 	th.AssertEquals(t, "1234567890", adminPass)
 }
 
+func TestGetMetadatum(t *testing.T) {
+	th.SetupHTTP()
+	defer th.TeardownHTTP()
+
+	HandleMetadatumGetSuccessfully(t)
+
+	expected := map[string]string{"foo": "bar"}
+	actual, err := Metadatum(client.ServiceClient(), "1234asdf", "foo").Extract()
+	th.AssertNoErr(t, err)
+	th.AssertDeepEquals(t, expected, actual)
+}
+
+func TestCreateMetadatum(t *testing.T) {
+	th.SetupHTTP()
+	defer th.TeardownHTTP()
+
+	HandleMetadatumCreateSuccessfully(t)
+
+	expected := map[string]string{"foo": "bar"}
+	actual, err := CreateMetadatum(client.ServiceClient(), "1234asdf", MetadatumOpts{"foo": "bar"}).Extract()
+	th.AssertNoErr(t, err)
+	th.AssertDeepEquals(t, expected, actual)
+}
+
+func TestDeleteMetadatum(t *testing.T) {
+	th.SetupHTTP()
+	defer th.TeardownHTTP()
+
+	HandleMetadatumDeleteSuccessfully(t)
+
+	err := DeleteMetadatum(client.ServiceClient(), "1234asdf", "foo").ExtractErr()
+	th.AssertNoErr(t, err)
+}
+
 func TestGetMetadata(t *testing.T) {
 	th.SetupHTTP()
 	defer th.TeardownHTTP()
 
 	HandleMetadataGetSuccessfully(t)
 
-	expected := map[string]string{"foo": "bar"}
-	actual, err := Metadata(client.ServiceClient(), "1234asdf", "foo").Extract()
+	expected := map[string]string{"foo": "bar", "this": "that"}
+	actual, err := Metadata(client.ServiceClient(), "1234asdf").Extract()
 	th.AssertNoErr(t, err)
 	th.AssertDeepEquals(t, expected, actual)
 }
@@ -207,42 +241,8 @@
 
 	HandleMetadataCreateSuccessfully(t)
 
-	expected := map[string]string{"foo": "bar"}
-	actual, err := CreateMetadata(client.ServiceClient(), "1234asdf", MetadataOpts{"foo": "bar"}).Extract()
-	th.AssertNoErr(t, err)
-	th.AssertDeepEquals(t, expected, actual)
-}
-
-func TestDeleteMetadata(t *testing.T) {
-	th.SetupHTTP()
-	defer th.TeardownHTTP()
-
-	HandleMetadataDeleteSuccessfully(t)
-
-	err := DeleteMetadata(client.ServiceClient(), "1234asdf", "foo").ExtractErr()
-	th.AssertNoErr(t, err)
-}
-
-func TestGetMetadatas(t *testing.T) {
-	th.SetupHTTP()
-	defer th.TeardownHTTP()
-
-	HandleMetadatasGetSuccessfully(t)
-
 	expected := map[string]string{"foo": "bar", "this": "that"}
-	actual, err := Metadatas(client.ServiceClient(), "1234asdf").Extract()
-	th.AssertNoErr(t, err)
-	th.AssertDeepEquals(t, expected, actual)
-}
-
-func TestCreateMetadatas(t *testing.T) {
-	th.SetupHTTP()
-	defer th.TeardownHTTP()
-
-	HandleMetadatasCreateSuccessfully(t)
-
-	expected := map[string]string{"foo": "bar", "this": "that"}
-	actual, err := CreateMetadatas(client.ServiceClient(), "1234asdf", MetadatasOpts{
+	actual, err := CreateMetadata(client.ServiceClient(), "1234asdf", MetadataOpts{
 		"foo":  "bar",
 		"this": "that",
 	}).Extract()
@@ -250,14 +250,14 @@
 	th.AssertDeepEquals(t, expected, actual)
 }
 
-func TestUpdateMetadatas(t *testing.T) {
+func TestUpdateMetadata(t *testing.T) {
 	th.SetupHTTP()
 	defer th.TeardownHTTP()
 
-	HandleMetadatasUpdateSuccessfully(t)
+	HandleMetadataUpdateSuccessfully(t)
 
 	expected := map[string]string{"foo": "baz", "this": "those"}
-	actual, err := UpdateMetadatas(client.ServiceClient(), "1234asdf", MetadatasOpts{
+	actual, err := UpdateMetadata(client.ServiceClient(), "1234asdf", MetadataOpts{
 		"foo":  "baz",
 		"this": "those",
 	}).Extract()
diff --git a/openstack/compute/v2/servers/results.go b/openstack/compute/v2/servers/results.go
index 10c003a..d758fd3 100644
--- a/openstack/compute/v2/servers/results.go
+++ b/openstack/compute/v2/servers/results.go
@@ -168,27 +168,7 @@
 	return response.Servers, err
 }
 
-// MetadatasResult contains the result of a call for (potentially) multiple key-value pairs.
-type MetadatasResult struct {
-	gophercloud.Result
-}
-
-// GetMetadatasResult temporarily contains the response from a metadatas Get call.
-type GetMetadatasResult struct {
-	MetadatasResult
-}
-
-// CreateMetadatasResult temporarily contains the response from a metadatas Create call.
-type CreateMetadatasResult struct {
-	MetadatasResult
-}
-
-// UpdateMetadatasResult temporarily contains the response from a metadatas Update call.
-type UpdateMetadatasResult struct {
-	MetadatasResult
-}
-
-// MetadataResult contains the result of a call for individual a single key-value pair.
+// MetadataResult contains the result of a call for (potentially) multiple key-value pairs.
 type MetadataResult struct {
 	gophercloud.Result
 }
@@ -203,23 +183,29 @@
 	MetadataResult
 }
 
-// DeleteMetadataResult temporarily contains the response from a metadata Delete call.
-type DeleteMetadataResult struct {
-	gophercloud.ErrResult
+// UpdateMetadataResult temporarily contains the response from a metadata Update call.
+type UpdateMetadataResult struct {
+	MetadataResult
 }
 
-// Extract interprets any MetadatasResult as a Metadatas, if possible.
-func (r MetadatasResult) Extract() (map[string]string, error) {
-	if r.Err != nil {
-		return nil, r.Err
-	}
+// MetadatumResult contains the result of a call for individual a single key-value pair.
+type MetadatumResult struct {
+	gophercloud.Result
+}
 
-	var response struct {
-		Metadatas map[string]string `mapstructure:"metadata"`
-	}
+// GetMetadatumResult temporarily contains the response from a metadatum Get call.
+type GetMetadatumResult struct {
+	MetadatumResult
+}
 
-	err := mapstructure.Decode(r.Body, &response)
-	return response.Metadatas, err
+// CreateMetadatumResult temporarily contains the response from a metadatum Create call.
+type CreateMetadatumResult struct {
+	MetadatumResult
+}
+
+// DeleteMetadatumResult temporarily contains the response from a metadatum Delete call.
+type DeleteMetadatumResult struct {
+	gophercloud.ErrResult
 }
 
 // Extract interprets any MetadataResult as a Metadata, if possible.
@@ -229,9 +215,23 @@
 	}
 
 	var response struct {
-		Metadata map[string]string `mapstructure:"meta"`
+		Metadata map[string]string `mapstructure:"metadata"`
 	}
 
 	err := mapstructure.Decode(r.Body, &response)
 	return response.Metadata, err
 }
+
+// Extract interprets any MetadatumResult as a Metadatum, if possible.
+func (r MetadatumResult) Extract() (map[string]string, error) {
+	if r.Err != nil {
+		return nil, r.Err
+	}
+
+	var response struct {
+		Metadatum map[string]string `mapstructure:"meta"`
+	}
+
+	err := mapstructure.Decode(r.Body, &response)
+	return response.Metadatum, err
+}
diff --git a/openstack/compute/v2/servers/urls.go b/openstack/compute/v2/servers/urls.go
index a5e6576..4bc6586 100644
--- a/openstack/compute/v2/servers/urls.go
+++ b/openstack/compute/v2/servers/urls.go
@@ -30,10 +30,10 @@
 	return client.ServiceURL("servers", id, "action")
 }
 
-func metadataURL(client *gophercloud.ServiceClient, id, key string) string {
+func metadatumURL(client *gophercloud.ServiceClient, id, key string) string {
 	return client.ServiceURL("servers", id, "metadata", key)
 }
 
-func metadatasURL(client *gophercloud.ServiceClient, id string) string {
+func metadataURL(client *gophercloud.ServiceClient, id string) string {
 	return client.ServiceURL("servers", id, "metadata")
 }
diff --git a/openstack/compute/v2/servers/urls_test.go b/openstack/compute/v2/servers/urls_test.go
index 1cdb210..17a1d28 100644
--- a/openstack/compute/v2/servers/urls_test.go
+++ b/openstack/compute/v2/servers/urls_test.go
@@ -55,14 +55,14 @@
 	th.CheckEquals(t, expected, actual)
 }
 
-func TestMetadataURL(t *testing.T) {
-	actual := metadataURL(endpointClient(), "foo", "bar")
+func TestMetadatumURL(t *testing.T) {
+	actual := metadatumURL(endpointClient(), "foo", "bar")
 	expected := endpoint + "servers/foo/metadata/bar"
 	th.CheckEquals(t, expected, actual)
 }
 
-func TestMetadatasURL(t *testing.T) {
-	actual := metadatasURL(endpointClient(), "foo")
+func TestMetadataURL(t *testing.T) {
+	actual := metadataURL(endpointClient(), "foo")
 	expected := endpoint + "servers/foo/metadata"
 	th.CheckEquals(t, expected, actual)
 }
