diff --git a/driver/driver.go b/driver/driver.go index 30ddcce72..d2bd048e7 100644 --- a/driver/driver.go +++ b/driver/driver.go @@ -9,8 +9,6 @@ import ( "github.com/vmware/govmomi/object" "time" "github.com/vmware/govmomi/session" - "github.com/vmware/govmomi/vim25/soap" - "github.com/vmware/govmomi/vim25" ) type Driver struct { @@ -35,25 +33,13 @@ func NewDriver(config *ConnectConfig) (*Driver, error) { if err != nil { return nil, err } - credentials := url.UserPassword(config.Username, config.Password) - vcenter_url.User = credentials + vcenter_url.User = url.UserPassword(config.Username, config.Password) - soapClient := soap.NewClient(vcenter_url, config.InsecureConnection) - vimClient, err := vim25.NewClient(ctx, soapClient) - if err != nil { - return nil, err - } - - vimClient.RoundTripper = session.KeepAlive(vimClient.RoundTripper, 10*time.Minute) - client := &govmomi.Client{ - Client: vimClient, - SessionManager: session.NewManager(vimClient), - } - - err = client.SessionManager.Login(ctx, credentials) + client, err := govmomi.NewClient(ctx, vcenter_url, config.InsecureConnection) if err != nil { return nil, err } + client.RoundTripper = session.KeepAlive(client.RoundTripper, 10*time.Minute) finder := find.NewFinder(client.Client, false) datacenter, err := finder.DatacenterOrDefault(ctx, config.Datacenter)