Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
e7f74d83
Commit
e7f74d83
authored
May 05, 2018
by
Doug MacEachern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename VSphereConnection.GoVmomiClient -> Client
parent
64601373
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
18 additions
and
18 deletions
+18
-18
nodemanager.go
pkg/cloudprovider/providers/vsphere/nodemanager.go
+1
-1
connection.go
pkg/cloudprovider/providers/vsphere/vclib/connection.go
+9
-9
datacenter.go
pkg/cloudprovider/providers/vsphere/vclib/datacenter.go
+2
-2
datacenter_test.go
pkg/cloudprovider/providers/vsphere/vclib/datacenter_test.go
+1
-1
datastore_test.go
pkg/cloudprovider/providers/vsphere/vclib/datastore_test.go
+1
-1
folder_test.go
pkg/cloudprovider/providers/vsphere/vclib/folder_test.go
+1
-1
utils_test.go
pkg/cloudprovider/providers/vsphere/vclib/utils_test.go
+1
-1
virtualmachine_test.go
...udprovider/providers/vsphere/vclib/virtualmachine_test.go
+1
-1
vsphere.go
pkg/cloudprovider/providers/vsphere/vsphere.go
+1
-1
No files found.
pkg/cloudprovider/providers/vsphere/nodemanager.go
View file @
e7f74d83
...
@@ -360,7 +360,7 @@ func (nm *NodeManager) renewNodeInfo(nodeInfo *NodeInfo, reconnect bool) (*NodeI
...
@@ -360,7 +360,7 @@ func (nm *NodeManager) renewNodeInfo(nodeInfo *NodeInfo, reconnect bool) (*NodeI
return
nil
,
err
return
nil
,
err
}
}
}
}
vm
:=
nodeInfo
.
vm
.
RenewVM
(
vsphereInstance
.
conn
.
GoVmomi
Client
)
vm
:=
nodeInfo
.
vm
.
RenewVM
(
vsphereInstance
.
conn
.
Client
)
return
&
NodeInfo
{
vm
:
&
vm
,
dataCenter
:
vm
.
Datacenter
,
vcServer
:
nodeInfo
.
vcServer
},
nil
return
&
NodeInfo
{
vm
:
&
vm
,
dataCenter
:
vm
.
Datacenter
,
vcServer
:
nodeInfo
.
vcServer
},
nil
}
}
...
...
pkg/cloudprovider/providers/vsphere/vclib/connection.go
View file @
e7f74d83
...
@@ -30,7 +30,7 @@ import (
...
@@ -30,7 +30,7 @@ import (
// VSphereConnection contains information for connecting to vCenter
// VSphereConnection contains information for connecting to vCenter
type
VSphereConnection
struct
{
type
VSphereConnection
struct
{
GoVmomiClient
*
vim25
.
Client
Client
*
vim25
.
Client
Username
string
Username
string
Password
string
Password
string
Hostname
string
Hostname
string
...
@@ -43,23 +43,23 @@ var (
...
@@ -43,23 +43,23 @@ var (
clientLock
sync
.
Mutex
clientLock
sync
.
Mutex
)
)
// Connect makes connection to vCenter and sets VSphereConnection.
GoVmomi
Client.
// Connect makes connection to vCenter and sets VSphereConnection.Client.
// If connection.
GoVmomi
Client is already set, it obtains the existing user session.
// If connection.Client is already set, it obtains the existing user session.
// if user session is not valid, connection.
GoVmomi
Client will be set to the new client.
// if user session is not valid, connection.Client will be set to the new client.
func
(
connection
*
VSphereConnection
)
Connect
(
ctx
context
.
Context
)
error
{
func
(
connection
*
VSphereConnection
)
Connect
(
ctx
context
.
Context
)
error
{
var
err
error
var
err
error
clientLock
.
Lock
()
clientLock
.
Lock
()
defer
clientLock
.
Unlock
()
defer
clientLock
.
Unlock
()
if
connection
.
GoVmomi
Client
==
nil
{
if
connection
.
Client
==
nil
{
connection
.
GoVmomi
Client
,
err
=
connection
.
NewClient
(
ctx
)
connection
.
Client
,
err
=
connection
.
NewClient
(
ctx
)
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Errorf
(
"Failed to create govmomi client. err: %+v"
,
err
)
glog
.
Errorf
(
"Failed to create govmomi client. err: %+v"
,
err
)
return
err
return
err
}
}
return
nil
return
nil
}
}
m
:=
session
.
NewManager
(
connection
.
GoVmomi
Client
)
m
:=
session
.
NewManager
(
connection
.
Client
)
userSession
,
err
:=
m
.
UserSession
(
ctx
)
userSession
,
err
:=
m
.
UserSession
(
ctx
)
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Errorf
(
"Error while obtaining user session. err: %+v"
,
err
)
glog
.
Errorf
(
"Error while obtaining user session. err: %+v"
,
err
)
...
@@ -70,7 +70,7 @@ func (connection *VSphereConnection) Connect(ctx context.Context) error {
...
@@ -70,7 +70,7 @@ func (connection *VSphereConnection) Connect(ctx context.Context) error {
}
}
glog
.
Warningf
(
"Creating new client session since the existing session is not valid or not authenticated"
)
glog
.
Warningf
(
"Creating new client session since the existing session is not valid or not authenticated"
)
connection
.
GoVmomi
Client
,
err
=
connection
.
NewClient
(
ctx
)
connection
.
Client
,
err
=
connection
.
NewClient
(
ctx
)
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Errorf
(
"Failed to create govmomi client. err: %+v"
,
err
)
glog
.
Errorf
(
"Failed to create govmomi client. err: %+v"
,
err
)
return
err
return
err
...
@@ -80,7 +80,7 @@ func (connection *VSphereConnection) Connect(ctx context.Context) error {
...
@@ -80,7 +80,7 @@ func (connection *VSphereConnection) Connect(ctx context.Context) error {
// Logout calls SessionManager.Logout for the given connection.
// Logout calls SessionManager.Logout for the given connection.
func
(
connection
*
VSphereConnection
)
Logout
(
ctx
context
.
Context
)
{
func
(
connection
*
VSphereConnection
)
Logout
(
ctx
context
.
Context
)
{
m
:=
session
.
NewManager
(
connection
.
GoVmomi
Client
)
m
:=
session
.
NewManager
(
connection
.
Client
)
if
err
:=
m
.
Logout
(
ctx
);
err
!=
nil
{
if
err
:=
m
.
Logout
(
ctx
);
err
!=
nil
{
glog
.
Errorf
(
"Logout failed: %s"
,
err
)
glog
.
Errorf
(
"Logout failed: %s"
,
err
)
}
}
...
...
pkg/cloudprovider/providers/vsphere/vclib/datacenter.go
View file @
e7f74d83
...
@@ -39,7 +39,7 @@ type Datacenter struct {
...
@@ -39,7 +39,7 @@ type Datacenter struct {
// GetDatacenter returns the DataCenter Object for the given datacenterPath
// GetDatacenter returns the DataCenter Object for the given datacenterPath
// If datacenter is located in a folder, include full path to datacenter else just provide the datacenter name
// If datacenter is located in a folder, include full path to datacenter else just provide the datacenter name
func
GetDatacenter
(
ctx
context
.
Context
,
connection
*
VSphereConnection
,
datacenterPath
string
)
(
*
Datacenter
,
error
)
{
func
GetDatacenter
(
ctx
context
.
Context
,
connection
*
VSphereConnection
,
datacenterPath
string
)
(
*
Datacenter
,
error
)
{
finder
:=
find
.
NewFinder
(
connection
.
GoVmomi
Client
,
false
)
finder
:=
find
.
NewFinder
(
connection
.
Client
,
false
)
datacenter
,
err
:=
finder
.
Datacenter
(
ctx
,
datacenterPath
)
datacenter
,
err
:=
finder
.
Datacenter
(
ctx
,
datacenterPath
)
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Errorf
(
"Failed to find the datacenter: %s. err: %+v"
,
datacenterPath
,
err
)
glog
.
Errorf
(
"Failed to find the datacenter: %s. err: %+v"
,
datacenterPath
,
err
)
...
@@ -52,7 +52,7 @@ func GetDatacenter(ctx context.Context, connection *VSphereConnection, datacente
...
@@ -52,7 +52,7 @@ func GetDatacenter(ctx context.Context, connection *VSphereConnection, datacente
// GetAllDatacenter returns all the DataCenter Objects
// GetAllDatacenter returns all the DataCenter Objects
func
GetAllDatacenter
(
ctx
context
.
Context
,
connection
*
VSphereConnection
)
([]
*
Datacenter
,
error
)
{
func
GetAllDatacenter
(
ctx
context
.
Context
,
connection
*
VSphereConnection
)
([]
*
Datacenter
,
error
)
{
var
dc
[]
*
Datacenter
var
dc
[]
*
Datacenter
finder
:=
find
.
NewFinder
(
connection
.
GoVmomi
Client
,
false
)
finder
:=
find
.
NewFinder
(
connection
.
Client
,
false
)
datacenters
,
err
:=
finder
.
DatacenterList
(
ctx
,
"*"
)
datacenters
,
err
:=
finder
.
DatacenterList
(
ctx
,
"*"
)
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Errorf
(
"Failed to find the datacenter. err: %+v"
,
err
)
glog
.
Errorf
(
"Failed to find the datacenter. err: %+v"
,
err
)
...
...
pkg/cloudprovider/providers/vsphere/vclib/datacenter_test.go
View file @
e7f74d83
...
@@ -47,7 +47,7 @@ func TestDatacenter(t *testing.T) {
...
@@ -47,7 +47,7 @@ func TestDatacenter(t *testing.T) {
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
vc
:=
&
VSphereConnection
{
GoVmomi
Client
:
c
.
Client
}
vc
:=
&
VSphereConnection
{
Client
:
c
.
Client
}
_
,
err
=
GetDatacenter
(
ctx
,
vc
,
testNameNotFound
)
_
,
err
=
GetDatacenter
(
ctx
,
vc
,
testNameNotFound
)
if
err
==
nil
{
if
err
==
nil
{
...
...
pkg/cloudprovider/providers/vsphere/vclib/datastore_test.go
View file @
e7f74d83
...
@@ -45,7 +45,7 @@ func TestDatastore(t *testing.T) {
...
@@ -45,7 +45,7 @@ func TestDatastore(t *testing.T) {
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
vc
:=
&
VSphereConnection
{
GoVmomi
Client
:
c
.
Client
}
vc
:=
&
VSphereConnection
{
Client
:
c
.
Client
}
dc
,
err
:=
GetDatacenter
(
ctx
,
vc
,
testDefaultDatacenter
)
dc
,
err
:=
GetDatacenter
(
ctx
,
vc
,
testDefaultDatacenter
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
pkg/cloudprovider/providers/vsphere/vclib/folder_test.go
View file @
e7f74d83
...
@@ -47,7 +47,7 @@ func TestFolder(t *testing.T) {
...
@@ -47,7 +47,7 @@ func TestFolder(t *testing.T) {
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
vc
:=
&
VSphereConnection
{
GoVmomi
Client
:
c
.
Client
}
vc
:=
&
VSphereConnection
{
Client
:
c
.
Client
}
dc
,
err
:=
GetDatacenter
(
ctx
,
vc
,
testDefaultDatacenter
)
dc
,
err
:=
GetDatacenter
(
ctx
,
vc
,
testDefaultDatacenter
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
pkg/cloudprovider/providers/vsphere/vclib/utils_test.go
View file @
e7f74d83
...
@@ -46,7 +46,7 @@ func TestUtils(t *testing.T) {
...
@@ -46,7 +46,7 @@ func TestUtils(t *testing.T) {
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
vc
:=
&
VSphereConnection
{
GoVmomi
Client
:
c
.
Client
}
vc
:=
&
VSphereConnection
{
Client
:
c
.
Client
}
dc
,
err
:=
GetDatacenter
(
ctx
,
vc
,
testDefaultDatacenter
)
dc
,
err
:=
GetDatacenter
(
ctx
,
vc
,
testDefaultDatacenter
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
pkg/cloudprovider/providers/vsphere/vclib/virtualmachine_test.go
View file @
e7f74d83
...
@@ -43,7 +43,7 @@ func TestVirtualMachine(t *testing.T) {
...
@@ -43,7 +43,7 @@ func TestVirtualMachine(t *testing.T) {
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
vc
:=
&
VSphereConnection
{
GoVmomi
Client
:
c
.
Client
}
vc
:=
&
VSphereConnection
{
Client
:
c
.
Client
}
dc
,
err
:=
GetDatacenter
(
ctx
,
vc
,
testDefaultDatacenter
)
dc
,
err
:=
GetDatacenter
(
ctx
,
vc
,
testDefaultDatacenter
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
pkg/cloudprovider/providers/vsphere/vsphere.go
View file @
e7f74d83
...
@@ -410,7 +410,7 @@ func newControllerNode(cfg VSphereConfig) (*VSphere, error) {
...
@@ -410,7 +410,7 @@ func newControllerNode(cfg VSphereConfig) (*VSphere, error) {
func
logout
(
vs
*
VSphere
)
{
func
logout
(
vs
*
VSphere
)
{
for
_
,
vsphereIns
:=
range
vs
.
vsphereInstanceMap
{
for
_
,
vsphereIns
:=
range
vs
.
vsphereInstanceMap
{
if
vsphereIns
.
conn
.
GoVmomi
Client
!=
nil
{
if
vsphereIns
.
conn
.
Client
!=
nil
{
vsphereIns
.
conn
.
Logout
(
context
.
TODO
())
vsphereIns
.
conn
.
Logout
(
context
.
TODO
())
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment