mirror of https://github.com/k3s-io/k3s
Delete useless code
parent
4bfe9b1a56
commit
05d3e9c5f3
|
@ -24,7 +24,6 @@ import (
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"github.com/gophercloud/gophercloud"
|
"github.com/gophercloud/gophercloud"
|
||||||
"github.com/gophercloud/gophercloud/openstack/compute/v2/servers"
|
"github.com/gophercloud/gophercloud/openstack/compute/v2/servers"
|
||||||
"github.com/gophercloud/gophercloud/pagination"
|
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
|
@ -49,36 +48,6 @@ func (os *OpenStack) Instances() (cloudprovider.Instances, bool) {
|
||||||
return &Instances{compute}, true
|
return &Instances{compute}, true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *Instances) List(name_filter string) ([]types.NodeName, error) {
|
|
||||||
glog.V(4).Infof("openstack List(%v) called", name_filter)
|
|
||||||
|
|
||||||
opts := servers.ListOpts{
|
|
||||||
Name: name_filter,
|
|
||||||
Status: "ACTIVE",
|
|
||||||
}
|
|
||||||
pager := servers.List(i.compute, opts)
|
|
||||||
|
|
||||||
ret := make([]types.NodeName, 0)
|
|
||||||
err := pager.EachPage(func(page pagination.Page) (bool, error) {
|
|
||||||
sList, err := servers.ExtractServers(page)
|
|
||||||
if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
for i := range sList {
|
|
||||||
ret = append(ret, mapServerToNodeName(&sList[i]))
|
|
||||||
}
|
|
||||||
return true, nil
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
glog.V(3).Infof("Found %v instances matching %v: %v",
|
|
||||||
len(ret), name_filter, ret)
|
|
||||||
|
|
||||||
return ret, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Implementation of Instances.CurrentNodeName
|
// Implementation of Instances.CurrentNodeName
|
||||||
// Note this is *not* necessarily the same as hostname.
|
// Note this is *not* necessarily the same as hostname.
|
||||||
func (i *Instances) CurrentNodeName(hostname string) (types.NodeName, error) {
|
func (i *Instances) CurrentNodeName(hostname string) (types.NodeName, error) {
|
||||||
|
|
Loading…
Reference in New Issue