cloudprovider: add the ProviderName method

This patch adds the ProviderName method used to identify the cloud
provider.

Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
This commit is contained in:
Federico Simoncelli
2015-05-05 10:10:24 -04:00
parent 9b67435cf3
commit 194343267d
9 changed files with 64 additions and 8 deletions

View File

@@ -42,6 +42,8 @@ import (
"github.com/golang/glog"
)
const ProviderName = "openstack"
var ErrNotFound = errors.New("Failed to find object")
var ErrMultipleResults = errors.New("Multiple results where only one expected")
var ErrNoAddressFound = errors.New("No address found for host")
@@ -99,7 +101,7 @@ type Config struct {
}
func init() {
cloudprovider.RegisterCloudProvider("openstack", func(config io.Reader) (cloudprovider.Interface, error) {
cloudprovider.RegisterCloudProvider(ProviderName, func(config io.Reader) (cloudprovider.Interface, error) {
cfg, err := readConfig(config)
if err != nil {
return nil, err
@@ -394,6 +396,11 @@ func (os *OpenStack) Clusters() (cloudprovider.Clusters, bool) {
return nil, false
}
// ProviderName returns the cloud provider ID.
func (os *OpenStack) ProviderName() string {
return ProviderName
}
type LoadBalancer struct {
network *gophercloud.ServiceClient
compute *gophercloud.ServiceClient