some updated
This commit is contained in:
parent
9a58ab40b0
commit
b0e048ba9d
7 changed files with 105 additions and 34 deletions
|
|
@ -19,16 +19,24 @@ import (
|
|||
cloudprovider "k8s.io/cloud-provider"
|
||||
)
|
||||
|
||||
func getServerByName(ctx context.Context, c *pve.Client, name string) (server *pve.Server, err error) {
|
||||
server, err = c.Pool.FindServerByName(ctx, "", name)
|
||||
func getServerRefByName(ctx context.Context, c *pve.Client, name string) (ref *pve.ServerRef, err error) {
|
||||
ref, err = c.Pool.FindServerByName(ctx, "", name)
|
||||
if err == pve.ErrServerNotFound {
|
||||
return nil, cloudprovider.InstanceNotFound
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func getServerByProviderID(ctx context.Context, c *pve.Client, providerID string) (server *pve.Server, err error) {
|
||||
server, err = c.Server.GetByURL(ctx, providerID)
|
||||
func getServerByName(ctx context.Context, c *pve.Client, name string) (srv *pve.Server, err error) {
|
||||
ref, err := getServerRefByName(ctx, c, name)
|
||||
if err == pve.ErrServerNotFound {
|
||||
return nil, cloudprovider.InstanceNotFound
|
||||
}
|
||||
return c.Server.GetByRef(ctx, ref)
|
||||
}
|
||||
|
||||
func getServerByProviderID(ctx context.Context, c *pve.Client, providerID string) (srv *pve.Server, err error) {
|
||||
srv, err = c.Server.GetByURL(ctx, providerID)
|
||||
if err == pve.ErrServerNotFound {
|
||||
return nil, cloudprovider.InstanceNotFound
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue