From 8167df2965dfb1fede907676c39c0e24c4d8d56c Mon Sep 17 00:00:00 2001 From: Angus Lees Date: Tue, 30 Aug 2016 12:34:47 +1000 Subject: [PATCH] openstack: Return instance name in CurrentNodeName Previously the OpenStack provider just returned the hostname in CurrentNodeName. With this change, we return the local OpenStack instance name, as the API intended. --- .../providers/openstack/openstack_instances.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/cloudprovider/providers/openstack/openstack_instances.go b/pkg/cloudprovider/providers/openstack/openstack_instances.go index dcd70cf9224..71d1d3309be 100644 --- a/pkg/cloudprovider/providers/openstack/openstack_instances.go +++ b/pkg/cloudprovider/providers/openstack/openstack_instances.go @@ -113,8 +113,13 @@ func (i *Instances) List(name_filter string) ([]types.NodeName, error) { } // Implementation of Instances.CurrentNodeName +// Note this is *not* necessarily the same as hostname. func (i *Instances) CurrentNodeName(hostname string) (types.NodeName, error) { - return types.NodeName(hostname), nil + md, err := getMetadata() + if err != nil { + return "", err + } + return types.NodeName(md.Name), nil } func (i *Instances) AddSSHKeyToAllInstances(user string, keyData []byte) error {