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
c52413b8
Commit
c52413b8
authored
Dec 06, 2017
by
prashima
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes issue#392.
parent
bb722373
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
virtualmachine.go
pkg/cloudprovider/providers/vsphere/vclib/virtualmachine.go
+11
-1
vsphere.go
pkg/cloudprovider/providers/vsphere/vsphere.go
+2
-0
No files found.
pkg/cloudprovider/providers/vsphere/vclib/virtualmachine.go
View file @
c52413b8
...
@@ -19,6 +19,7 @@ package vclib
...
@@ -19,6 +19,7 @@ package vclib
import
(
import
(
"context"
"context"
"fmt"
"fmt"
"strings"
"time"
"time"
"github.com/golang/glog"
"github.com/golang/glog"
...
@@ -362,12 +363,14 @@ func (vm *VirtualMachine) getVirtualDeviceByPath(ctx context.Context, diskPath s
...
@@ -362,12 +363,14 @@ func (vm *VirtualMachine) getVirtualDeviceByPath(ctx context.Context, diskPath s
glog
.
Errorf
(
"Failed to get the devices for VM: %q. err: %+v"
,
vm
.
InventoryPath
,
err
)
glog
.
Errorf
(
"Failed to get the devices for VM: %q. err: %+v"
,
vm
.
InventoryPath
,
err
)
return
nil
,
err
return
nil
,
err
}
}
// filter vm devices to retrieve device for the given vmdk file identified by disk path
// filter vm devices to retrieve device for the given vmdk file identified by disk path
for
_
,
device
:=
range
vmDevices
{
for
_
,
device
:=
range
vmDevices
{
if
vmDevices
.
TypeName
(
device
)
==
"VirtualDisk"
{
if
vmDevices
.
TypeName
(
device
)
==
"VirtualDisk"
{
virtualDevice
:=
device
.
GetVirtualDevice
()
virtualDevice
:=
device
.
GetVirtualDevice
()
if
backing
,
ok
:=
virtualDevice
.
Backing
.
(
*
types
.
VirtualDiskFlatVer2BackingInfo
);
ok
{
if
backing
,
ok
:=
virtualDevice
.
Backing
.
(
*
types
.
VirtualDiskFlatVer2BackingInfo
);
ok
{
if
backing
.
FileName
==
diskPath
{
if
matchVirtualDiskAndVolPath
(
backing
.
FileName
,
diskPath
)
{
glog
.
V
(
LogLevel
)
.
Infof
(
"Found VirtualDisk backing with filename %q for diskPath %q"
,
backing
.
FileName
,
diskPath
)
return
device
,
nil
return
device
,
nil
}
}
}
}
...
@@ -376,6 +379,13 @@ func (vm *VirtualMachine) getVirtualDeviceByPath(ctx context.Context, diskPath s
...
@@ -376,6 +379,13 @@ func (vm *VirtualMachine) getVirtualDeviceByPath(ctx context.Context, diskPath s
return
nil
,
nil
return
nil
,
nil
}
}
func
matchVirtualDiskAndVolPath
(
diskPath
,
volPath
string
)
bool
{
fileExt
:=
".vmdk"
diskPath
=
strings
.
TrimSuffix
(
diskPath
,
fileExt
)
volPath
=
strings
.
TrimSuffix
(
volPath
,
fileExt
)
return
diskPath
==
volPath
}
// deleteController removes latest added SCSI controller from VM.
// deleteController removes latest added SCSI controller from VM.
func
(
vm
*
VirtualMachine
)
deleteController
(
ctx
context
.
Context
,
controllerDevice
types
.
BaseVirtualDevice
,
vmDevices
object
.
VirtualDeviceList
)
error
{
func
(
vm
*
VirtualMachine
)
deleteController
(
ctx
context
.
Context
,
controllerDevice
types
.
BaseVirtualDevice
,
vmDevices
object
.
VirtualDeviceList
)
error
{
controllerDeviceList
:=
vmDevices
.
SelectByType
(
controllerDevice
)
controllerDeviceList
:=
vmDevices
.
SelectByType
(
controllerDevice
)
...
...
pkg/cloudprovider/providers/vsphere/vsphere.go
View file @
c52413b8
...
@@ -835,6 +835,7 @@ func (vs *VSphere) DiskIsAttached(volPath string, nodeName k8stypes.NodeName) (b
...
@@ -835,6 +835,7 @@ func (vs *VSphere) DiskIsAttached(volPath string, nodeName k8stypes.NodeName) (b
glog
.
Errorf
(
"Failed to get VM object for node: %q. err: +%v"
,
vSphereInstance
,
err
)
glog
.
Errorf
(
"Failed to get VM object for node: %q. err: +%v"
,
vSphereInstance
,
err
)
return
false
,
err
return
false
,
err
}
}
volPath
=
vclib
.
RemoveStorageClusterORFolderNameFromVDiskPath
(
volPath
)
volPath
=
vclib
.
RemoveStorageClusterORFolderNameFromVDiskPath
(
volPath
)
attached
,
err
:=
vm
.
IsDiskAttached
(
ctx
,
volPath
)
attached
,
err
:=
vm
.
IsDiskAttached
(
ctx
,
volPath
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -842,6 +843,7 @@ func (vs *VSphere) DiskIsAttached(volPath string, nodeName k8stypes.NodeName) (b
...
@@ -842,6 +843,7 @@ func (vs *VSphere) DiskIsAttached(volPath string, nodeName k8stypes.NodeName) (b
volPath
,
volPath
,
vSphereInstance
)
vSphereInstance
)
}
}
glog
.
V
(
4
)
.
Infof
(
"DiskIsAttached result: %q and error: %q, for volume: %q"
,
attached
,
err
,
volPath
)
return
attached
,
err
return
attached
,
err
}
}
requestTime
:=
time
.
Now
()
requestTime
:=
time
.
Now
()
...
...
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