Openstack: register metadata.hostname as node name
This commit is contained in:
		@@ -69,7 +69,7 @@ type DeviceMetadata struct {
 | 
				
			|||||||
// See http://docs.openstack.org/user-guide/cli_config_drive.html
 | 
					// See http://docs.openstack.org/user-guide/cli_config_drive.html
 | 
				
			||||||
type Metadata struct {
 | 
					type Metadata struct {
 | 
				
			||||||
	Uuid             string           `json:"uuid"`
 | 
						Uuid             string           `json:"uuid"`
 | 
				
			||||||
	Name             string           `json:"name"`
 | 
						Hostname         string           `json:"hostname"`
 | 
				
			||||||
	AvailabilityZone string           `json:"availability_zone"`
 | 
						AvailabilityZone string           `json:"availability_zone"`
 | 
				
			||||||
	Devices          []DeviceMetadata `json:"devices,omitempty"`
 | 
						Devices          []DeviceMetadata `json:"devices,omitempty"`
 | 
				
			||||||
	// .. and other fields we don't care about.  Expand as necessary.
 | 
						// .. and other fields we don't care about.  Expand as necessary.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,7 +23,7 @@ import (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
var FakeMetadata = Metadata{
 | 
					var FakeMetadata = Metadata{
 | 
				
			||||||
	Uuid:             "83679162-1378-4288-a2d4-70e13ec132aa",
 | 
						Uuid:             "83679162-1378-4288-a2d4-70e13ec132aa",
 | 
				
			||||||
	Name:             "test",
 | 
						Hostname:         "test",
 | 
				
			||||||
	AvailabilityZone: "nova",
 | 
						AvailabilityZone: "nova",
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -81,8 +81,8 @@ func TestParseMetadata(t *testing.T) {
 | 
				
			|||||||
		t.Fatalf("Should succeed when provided with valid data: %s", err)
 | 
							t.Fatalf("Should succeed when provided with valid data: %s", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if md.Name != "test" {
 | 
						if md.Hostname != "test.novalocal" {
 | 
				
			||||||
		t.Errorf("incorrect name: %s", md.Name)
 | 
							t.Errorf("incorrect hostname: %s", md.Hostname)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if md.Uuid != "83679162-1378-4288-a2d4-70e13ec132aa" {
 | 
						if md.Uuid != "83679162-1378-4288-a2d4-70e13ec132aa" {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -58,7 +58,7 @@ func (i *Instances) CurrentNodeName(hostname string) (types.NodeName, error) {
 | 
				
			|||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return "", err
 | 
							return "", err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return types.NodeName(md.Name), nil
 | 
						return types.NodeName(md.Hostname), nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (i *Instances) AddSSHKeyToAllInstances(user string, keyData []byte) error {
 | 
					func (i *Instances) AddSSHKeyToAllInstances(user string, keyData []byte) error {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user