Commit eaac0f54 authored by Di Xu's avatar Di Xu

Openstack: register metadata.hostname as node name

parent 0770ef06
......@@ -69,7 +69,7 @@ type DeviceMetadata struct {
// See http://docs.openstack.org/user-guide/cli_config_drive.html
type Metadata struct {
Uuid string `json:"uuid"`
Name string `json:"name"`
Hostname string `json:"hostname"`
AvailabilityZone string `json:"availability_zone"`
Devices []DeviceMetadata `json:"devices,omitempty"`
// .. and other fields we don't care about. Expand as necessary.
......
......@@ -23,7 +23,7 @@ import (
var FakeMetadata = Metadata{
Uuid: "83679162-1378-4288-a2d4-70e13ec132aa",
Name: "test",
Hostname: "test",
AvailabilityZone: "nova",
}
......@@ -81,8 +81,8 @@ func TestParseMetadata(t *testing.T) {
t.Fatalf("Should succeed when provided with valid data: %s", err)
}
if md.Name != "test" {
t.Errorf("incorrect name: %s", md.Name)
if md.Hostname != "test.novalocal" {
t.Errorf("incorrect hostname: %s", md.Hostname)
}
if md.Uuid != "83679162-1378-4288-a2d4-70e13ec132aa" {
......
......@@ -58,7 +58,7 @@ func (i *Instances) CurrentNodeName(hostname string) (types.NodeName, error) {
if err != nil {
return "", err
}
return types.NodeName(md.Name), nil
return types.NodeName(md.Hostname), nil
}
func (i *Instances) AddSSHKeyToAllInstances(user string, keyData []byte) error {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment