Openstack: register metadata.hostname as node name

pull/6/head
Di Xu 2018-01-19 14:23:07 +08:00
parent 0770ef0600
commit eaac0f5489
3 changed files with 5 additions and 5 deletions

View File

@ -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.

View File

@ -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" {

View File

@ -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 {