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
95b68ae0
Commit
95b68ae0
authored
Apr 07, 2015
by
Justin Santa Barbara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename pdName -> volumeId for AWS persistent volumes
parent
aa605102
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
43 additions
and
46 deletions
+43
-46
types.go
pkg/api/types.go
+2
-5
types.go
pkg/api/v1beta1/types.go
+2
-2
types.go
pkg/api/v1beta2/types.go
+2
-2
types.go
pkg/api/v1beta3/types.go
+2
-2
validation.go
pkg/api/validation/validation.go
+2
-2
predicates.go
pkg/scheduler/predicates.go
+2
-2
predicates_test.go
pkg/scheduler/predicates_test.go
+2
-2
aws_pd.go
pkg/volume/aws_pd/aws_pd.go
+18
-18
aws_pd_test.go
pkg/volume/aws_pd/aws_pd_test.go
+4
-4
aws_util.go
pkg/volume/aws_pd/aws_util.go
+6
-6
pd.go
test/e2e/pd.go
+1
-1
No files found.
pkg/api/types.go
View file @
95b68ae0
...
@@ -401,20 +401,17 @@ type ISCSIVolumeSource struct {
...
@@ -401,20 +401,17 @@ type ISCSIVolumeSource struct {
// The disk must also be in the same AWS zone as the kubelet.
// The disk must also be in the same AWS zone as the kubelet.
// A AWS EBS disk can only be mounted as read/write once.
// A AWS EBS disk can only be mounted as read/write once.
type
AWSPersistentDiskVolumeSource
struct
{
type
AWSPersistentDiskVolumeSource
struct
{
// Unique name of the PD resource. Used to identify the disk in AWS
// Unique id of the persistent disk resource. Used to identify the disk in AWS
PDName
string
`json:"pdName"`
VolumeId
string
`json:"volumeId"`
// Required: Filesystem type to mount.
// Required: Filesystem type to mount.
// Must be a filesystem type supported by the host operating system.
// Must be a filesystem type supported by the host operating system.
// Ex. "ext4", "xfs", "ntfs"
// Ex. "ext4", "xfs", "ntfs"
// TODO: how do we prevent errors in the filesystem from compromising the machine
// TODO: how do we prevent errors in the filesystem from compromising the machine
FSType
string
`json:"fsType,omitempty"`
FSType
string
`json:"fsType,omitempty"`
// Optional: Partition on the disk to mount.
// Optional: Partition on the disk to mount.
// If omitted, kubelet will attempt to mount the device name.
// If omitted, kubelet will attempt to mount the device name.
// Ex. For /dev/sda1, this field is "1", for /dev/sda, this field is 0 or empty.
// Ex. For /dev/sda1, this field is "1", for /dev/sda, this field is 0 or empty.
Partition
int
`json:"partition,omitempty"`
Partition
int
`json:"partition,omitempty"`
// Optional: Defaults to false (read/write). ReadOnly here will force
// Optional: Defaults to false (read/write). ReadOnly here will force
// the ReadOnly setting in VolumeMounts.
// the ReadOnly setting in VolumeMounts.
ReadOnly
bool
`json:"readOnly,omitempty"`
ReadOnly
bool
`json:"readOnly,omitempty"`
...
...
pkg/api/v1beta1/types.go
View file @
95b68ae0
...
@@ -314,8 +314,8 @@ type ISCSIVolumeSource struct {
...
@@ -314,8 +314,8 @@ type ISCSIVolumeSource struct {
// The disk must also be in the same AWS zone as the kubelet.
// The disk must also be in the same AWS zone as the kubelet.
// A AWS PD can only be mounted on a single machine.
// A AWS PD can only be mounted on a single machine.
type
AWSPersistentDiskVolumeSource
struct
{
type
AWSPersistentDiskVolumeSource
struct
{
// Unique
name
of the PD resource. Used to identify the disk in AWS
// Unique
id
of the PD resource. Used to identify the disk in AWS
PDName
string
`json:"pdName
" description:"unique id of the PD resource in AWS"`
VolumeId
string
`json:"volumeId
" description:"unique id of the PD resource in AWS"`
// Required: Filesystem type to mount.
// Required: Filesystem type to mount.
// Must be a filesystem type supported by the host operating system.
// Must be a filesystem type supported by the host operating system.
// Ex. "ext4", "xfs", "ntfs"
// Ex. "ext4", "xfs", "ntfs"
...
...
pkg/api/v1beta2/types.go
View file @
95b68ae0
...
@@ -296,8 +296,8 @@ type GCEPersistentDiskVolumeSource struct {
...
@@ -296,8 +296,8 @@ type GCEPersistentDiskVolumeSource struct {
// The disk must also be in the same AWS zone as the kubelet.
// The disk must also be in the same AWS zone as the kubelet.
// A AWS PD can only be mounted on a single machine.
// A AWS PD can only be mounted on a single machine.
type
AWSPersistentDiskVolumeSource
struct
{
type
AWSPersistentDiskVolumeSource
struct
{
// Unique
name
of the PD resource. Used to identify the disk in AWS
// Unique
id
of the PD resource. Used to identify the disk in AWS
PDName
string
`json:"pdName
" description:"unique id of the PD resource in AWS"`
VolumeId
string
`json:"volumeId
" description:"unique id of the PD resource in AWS"`
// Required: Filesystem type to mount.
// Required: Filesystem type to mount.
// Must be a filesystem type supported by the host operating system.
// Must be a filesystem type supported by the host operating system.
// Ex. "ext4", "xfs", "ntfs"
// Ex. "ext4", "xfs", "ntfs"
...
...
pkg/api/v1beta3/types.go
View file @
95b68ae0
...
@@ -412,8 +412,8 @@ type GCEPersistentDiskVolumeSource struct {
...
@@ -412,8 +412,8 @@ type GCEPersistentDiskVolumeSource struct {
// The disk must also be in the same AWS zone as the kubelet.
// The disk must also be in the same AWS zone as the kubelet.
// A AWS PD can only be mounted on a single machine.
// A AWS PD can only be mounted on a single machine.
type
AWSPersistentDiskVolumeSource
struct
{
type
AWSPersistentDiskVolumeSource
struct
{
// Unique
name
of the PD resource. Used to identify the disk in AWS
// Unique
id
of the PD resource. Used to identify the disk in AWS
PDName
string
`json:"pdName
" description:"unique id of the PD resource in AWS"`
VolumeId
string
`json:"volumeId
" description:"unique id of the PD resource in AWS"`
// Required: Filesystem type to mount.
// Required: Filesystem type to mount.
// Must be a filesystem type supported by the host operating system.
// Must be a filesystem type supported by the host operating system.
// Ex. "ext4", "xfs", "ntfs"
// Ex. "ext4", "xfs", "ntfs"
...
...
pkg/api/validation/validation.go
View file @
95b68ae0
...
@@ -374,8 +374,8 @@ func validateGCEPersistentDiskVolumeSource(PD *api.GCEPersistentDiskVolumeSource
...
@@ -374,8 +374,8 @@ func validateGCEPersistentDiskVolumeSource(PD *api.GCEPersistentDiskVolumeSource
func
validateAWSPersistentDiskVolumeSource
(
PD
*
api
.
AWSPersistentDiskVolumeSource
)
errs
.
ValidationErrorList
{
func
validateAWSPersistentDiskVolumeSource
(
PD
*
api
.
AWSPersistentDiskVolumeSource
)
errs
.
ValidationErrorList
{
allErrs
:=
errs
.
ValidationErrorList
{}
allErrs
:=
errs
.
ValidationErrorList
{}
if
PD
.
PDName
==
""
{
if
PD
.
VolumeId
==
""
{
allErrs
=
append
(
allErrs
,
errs
.
NewFieldRequired
(
"
pdName
"
))
allErrs
=
append
(
allErrs
,
errs
.
NewFieldRequired
(
"
volumeId
"
))
}
}
if
PD
.
FSType
==
""
{
if
PD
.
FSType
==
""
{
allErrs
=
append
(
allErrs
,
errs
.
NewFieldRequired
(
"fsType"
))
allErrs
=
append
(
allErrs
,
errs
.
NewFieldRequired
(
"fsType"
))
...
...
pkg/scheduler/predicates.go
View file @
95b68ae0
...
@@ -62,12 +62,12 @@ func isVolumeConflict(volume api.Volume, pod *api.Pod) bool {
...
@@ -62,12 +62,12 @@ func isVolumeConflict(volume api.Volume, pod *api.Pod) bool {
}
}
}
}
if
volume
.
AWSPersistentDisk
!=
nil
{
if
volume
.
AWSPersistentDisk
!=
nil
{
pdName
:=
volume
.
AWSPersistentDisk
.
PDName
volumeId
:=
volume
.
AWSPersistentDisk
.
VolumeId
manifest
:=
&
(
pod
.
Spec
)
manifest
:=
&
(
pod
.
Spec
)
for
ix
:=
range
manifest
.
Volumes
{
for
ix
:=
range
manifest
.
Volumes
{
if
manifest
.
Volumes
[
ix
]
.
AWSPersistentDisk
!=
nil
&&
if
manifest
.
Volumes
[
ix
]
.
AWSPersistentDisk
!=
nil
&&
manifest
.
Volumes
[
ix
]
.
AWSPersistentDisk
.
PDName
==
pdName
{
manifest
.
Volumes
[
ix
]
.
AWSPersistentDisk
.
VolumeId
==
volumeId
{
return
true
return
true
}
}
}
}
...
...
pkg/scheduler/predicates_test.go
View file @
95b68ae0
...
@@ -327,7 +327,7 @@ func TestAWSDiskConflicts(t *testing.T) {
...
@@ -327,7 +327,7 @@ func TestAWSDiskConflicts(t *testing.T) {
{
{
VolumeSource
:
api
.
VolumeSource
{
VolumeSource
:
api
.
VolumeSource
{
AWSPersistentDisk
:
&
api
.
AWSPersistentDiskVolumeSource
{
AWSPersistentDisk
:
&
api
.
AWSPersistentDiskVolumeSource
{
PDName
:
"foo"
,
VolumeId
:
"foo"
,
},
},
},
},
},
},
...
@@ -338,7 +338,7 @@ func TestAWSDiskConflicts(t *testing.T) {
...
@@ -338,7 +338,7 @@ func TestAWSDiskConflicts(t *testing.T) {
{
{
VolumeSource
:
api
.
VolumeSource
{
VolumeSource
:
api
.
VolumeSource
{
AWSPersistentDisk
:
&
api
.
AWSPersistentDiskVolumeSource
{
AWSPersistentDisk
:
&
api
.
AWSPersistentDiskVolumeSource
{
PDName
:
"bar"
,
VolumeId
:
"bar"
,
},
},
},
},
},
},
...
...
pkg/volume/aws_pd/aws_pd.go
View file @
95b68ae0
...
@@ -77,7 +77,7 @@ func (plugin *awsPersistentDiskPlugin) NewBuilder(spec *api.Volume, podRef *api.
...
@@ -77,7 +77,7 @@ func (plugin *awsPersistentDiskPlugin) NewBuilder(spec *api.Volume, podRef *api.
}
}
func
(
plugin
*
awsPersistentDiskPlugin
)
newBuilderInternal
(
spec
*
api
.
Volume
,
podUID
types
.
UID
,
manager
pdManager
,
mounter
mount
.
Interface
)
(
volume
.
Builder
,
error
)
{
func
(
plugin
*
awsPersistentDiskPlugin
)
newBuilderInternal
(
spec
*
api
.
Volume
,
podUID
types
.
UID
,
manager
pdManager
,
mounter
mount
.
Interface
)
(
volume
.
Builder
,
error
)
{
pdName
:=
spec
.
AWSPersistentDisk
.
PDName
volumeId
:=
spec
.
AWSPersistentDisk
.
VolumeId
fsType
:=
spec
.
AWSPersistentDisk
.
FSType
fsType
:=
spec
.
AWSPersistentDisk
.
FSType
partition
:=
""
partition
:=
""
if
spec
.
AWSPersistentDisk
.
Partition
!=
0
{
if
spec
.
AWSPersistentDisk
.
Partition
!=
0
{
...
@@ -88,7 +88,7 @@ func (plugin *awsPersistentDiskPlugin) newBuilderInternal(spec *api.Volume, podU
...
@@ -88,7 +88,7 @@ func (plugin *awsPersistentDiskPlugin) newBuilderInternal(spec *api.Volume, podU
return
&
awsPersistentDisk
{
return
&
awsPersistentDisk
{
podUID
:
podUID
,
podUID
:
podUID
,
volName
:
spec
.
Name
,
volName
:
spec
.
Name
,
pdName
:
pdName
,
volumeId
:
volumeId
,
fsType
:
fsType
,
fsType
:
fsType
,
partition
:
partition
,
partition
:
partition
,
readOnly
:
readOnly
,
readOnly
:
readOnly
,
...
@@ -128,8 +128,8 @@ type pdManager interface {
...
@@ -128,8 +128,8 @@ type pdManager interface {
type
awsPersistentDisk
struct
{
type
awsPersistentDisk
struct
{
volName
string
volName
string
podUID
types
.
UID
podUID
types
.
UID
// Unique
name
of the PD, used to find the disk resource in the provider.
// Unique
id
of the PD, used to find the disk resource in the provider.
pdName
string
volumeId
string
// Filesystem type, optional.
// Filesystem type, optional.
fsType
string
fsType
string
// Specifies the partition to mount
// Specifies the partition to mount
...
@@ -183,7 +183,7 @@ func (pd *awsPersistentDisk) SetUpAt(dir string) error {
...
@@ -183,7 +183,7 @@ func (pd *awsPersistentDisk) SetUpAt(dir string) error {
return
nil
return
nil
}
}
globalPDPath
:=
makeGlobalPD
Name
(
pd
.
plugin
.
host
,
pd
.
pdName
)
globalPDPath
:=
makeGlobalPD
Path
(
pd
.
plugin
.
host
,
pd
.
volumeId
)
if
err
:=
pd
.
manager
.
AttachAndMountDisk
(
pd
,
globalPDPath
);
err
!=
nil
{
if
err
:=
pd
.
manager
.
AttachAndMountDisk
(
pd
,
globalPDPath
);
err
!=
nil
{
return
err
return
err
}
}
...
@@ -232,14 +232,14 @@ func (pd *awsPersistentDisk) SetUpAt(dir string) error {
...
@@ -232,14 +232,14 @@ func (pd *awsPersistentDisk) SetUpAt(dir string) error {
return
nil
return
nil
}
}
func
makeGlobalPD
Name
(
host
volume
.
VolumeHost
,
devName
string
)
string
{
func
makeGlobalPD
Path
(
host
volume
.
VolumeHost
,
volumeId
string
)
string
{
// Clean up the URI to be more fs-friendly
// Clean up the URI to be more fs-friendly
name
:=
devName
name
:=
volumeId
name
=
strings
.
Replace
(
name
,
"://"
,
"/"
,
-
1
)
name
=
strings
.
Replace
(
name
,
"://"
,
"/"
,
-
1
)
return
path
.
Join
(
host
.
GetPluginDir
(
awsPersistentDiskPluginName
),
"mounts"
,
name
)
return
path
.
Join
(
host
.
GetPluginDir
(
awsPersistentDiskPluginName
),
"mounts"
,
name
)
}
}
func
get
PdName
FromGlobalMount
(
host
volume
.
VolumeHost
,
globalPath
string
)
(
string
,
error
)
{
func
get
VolumeId
FromGlobalMount
(
host
volume
.
VolumeHost
,
globalPath
string
)
(
string
,
error
)
{
basePath
:=
path
.
Join
(
host
.
GetPluginDir
(
awsPersistentDiskPluginName
),
"mounts"
)
basePath
:=
path
.
Join
(
host
.
GetPluginDir
(
awsPersistentDiskPluginName
),
"mounts"
)
rel
,
err
:=
filepath
.
Rel
(
basePath
,
globalPath
)
rel
,
err
:=
filepath
.
Rel
(
basePath
,
globalPath
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -248,13 +248,13 @@ func getPdNameFromGlobalMount(host volume.VolumeHost, globalPath string) (string
...
@@ -248,13 +248,13 @@ func getPdNameFromGlobalMount(host volume.VolumeHost, globalPath string) (string
if
strings
.
Contains
(
rel
,
"../"
)
{
if
strings
.
Contains
(
rel
,
"../"
)
{
return
""
,
fmt
.
Errorf
(
"Unexpected mount path: "
+
globalPath
)
return
""
,
fmt
.
Errorf
(
"Unexpected mount path: "
+
globalPath
)
}
}
// Reverse the :// replacement done in makeGlobalPD
Name
// Reverse the :// replacement done in makeGlobalPD
Path
pdName
:=
rel
volumeId
:=
rel
if
strings
.
HasPrefix
(
pdName
,
"aws/"
)
{
if
strings
.
HasPrefix
(
volumeId
,
"aws/"
)
{
pdName
=
strings
.
Replace
(
pdName
,
"aws/"
,
"aws://"
,
1
)
volumeId
=
strings
.
Replace
(
volumeId
,
"aws/"
,
"aws://"
,
1
)
}
}
glog
.
V
(
2
)
.
Info
(
"Mapping mount dir "
,
globalPath
,
" to
pdName "
,
pdName
)
glog
.
V
(
2
)
.
Info
(
"Mapping mount dir "
,
globalPath
,
" to
volumeId "
,
volumeId
)
return
pdName
,
nil
return
volumeId
,
nil
}
}
func
(
pd
*
awsPersistentDisk
)
GetPath
()
string
{
func
(
pd
*
awsPersistentDisk
)
GetPath
()
string
{
...
@@ -294,14 +294,14 @@ func (pd *awsPersistentDisk) TearDownAt(dir string) error {
...
@@ -294,14 +294,14 @@ func (pd *awsPersistentDisk) TearDownAt(dir string) error {
// If len(refs) is 1, then all bind mounts have been removed, and the
// If len(refs) is 1, then all bind mounts have been removed, and the
// remaining reference is the global mount. It is safe to detach.
// remaining reference is the global mount. It is safe to detach.
if
len
(
refs
)
==
1
{
if
len
(
refs
)
==
1
{
// pd.
pdName
is not initially set for volume-cleaners, so set it here.
// pd.
volumeId
is not initially set for volume-cleaners, so set it here.
pd
.
pdName
,
err
=
getPdName
FromGlobalMount
(
pd
.
plugin
.
host
,
refs
[
0
])
pd
.
volumeId
,
err
=
getVolumeId
FromGlobalMount
(
pd
.
plugin
.
host
,
refs
[
0
])
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
V
(
2
)
.
Info
(
"Could not determine
pdName
from mountpoint "
,
refs
[
0
],
": "
,
err
)
glog
.
V
(
2
)
.
Info
(
"Could not determine
volumeId
from mountpoint "
,
refs
[
0
],
": "
,
err
)
return
err
return
err
}
}
if
err
:=
pd
.
manager
.
DetachDisk
(
pd
);
err
!=
nil
{
if
err
:=
pd
.
manager
.
DetachDisk
(
pd
);
err
!=
nil
{
glog
.
V
(
2
)
.
Info
(
"Error detaching disk "
,
pd
.
pdName
,
": "
,
err
)
glog
.
V
(
2
)
.
Info
(
"Error detaching disk "
,
pd
.
volumeId
,
": "
,
err
)
return
err
return
err
}
}
}
}
...
...
pkg/volume/aws_pd/aws_pd_test.go
View file @
95b68ae0
...
@@ -72,7 +72,7 @@ type fakePDManager struct{}
...
@@ -72,7 +72,7 @@ type fakePDManager struct{}
// TODO(jonesdl) To fully test this, we could create a loopback device
// TODO(jonesdl) To fully test this, we could create a loopback device
// and mount that instead.
// and mount that instead.
func
(
fake
*
fakePDManager
)
AttachAndMountDisk
(
pd
*
awsPersistentDisk
,
globalPDPath
string
)
error
{
func
(
fake
*
fakePDManager
)
AttachAndMountDisk
(
pd
*
awsPersistentDisk
,
globalPDPath
string
)
error
{
globalPath
:=
makeGlobalPD
Name
(
pd
.
plugin
.
host
,
pd
.
pdName
)
globalPath
:=
makeGlobalPD
Path
(
pd
.
plugin
.
host
,
pd
.
volumeId
)
err
:=
os
.
MkdirAll
(
globalPath
,
0750
)
err
:=
os
.
MkdirAll
(
globalPath
,
0750
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
@@ -81,7 +81,7 @@ func (fake *fakePDManager) AttachAndMountDisk(pd *awsPersistentDisk, globalPDPat
...
@@ -81,7 +81,7 @@ func (fake *fakePDManager) AttachAndMountDisk(pd *awsPersistentDisk, globalPDPat
}
}
func
(
fake
*
fakePDManager
)
DetachDisk
(
pd
*
awsPersistentDisk
)
error
{
func
(
fake
*
fakePDManager
)
DetachDisk
(
pd
*
awsPersistentDisk
)
error
{
globalPath
:=
makeGlobalPD
Name
(
pd
.
plugin
.
host
,
pd
.
pdName
)
globalPath
:=
makeGlobalPD
Path
(
pd
.
plugin
.
host
,
pd
.
volumeId
)
err
:=
os
.
RemoveAll
(
globalPath
)
err
:=
os
.
RemoveAll
(
globalPath
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
@@ -101,8 +101,8 @@ func TestPlugin(t *testing.T) {
...
@@ -101,8 +101,8 @@ func TestPlugin(t *testing.T) {
Name
:
"vol1"
,
Name
:
"vol1"
,
VolumeSource
:
api
.
VolumeSource
{
VolumeSource
:
api
.
VolumeSource
{
AWSPersistentDisk
:
&
api
.
AWSPersistentDiskVolumeSource
{
AWSPersistentDisk
:
&
api
.
AWSPersistentDiskVolumeSource
{
PDName
:
"pd"
,
VolumeId
:
"pd"
,
FSType
:
"ext4"
,
FSType
:
"ext4"
,
},
},
},
},
}
}
...
...
pkg/volume/aws_pd/aws_util.go
View file @
95b68ae0
...
@@ -40,7 +40,7 @@ func (util *AWSDiskUtil) AttachAndMountDisk(pd *awsPersistentDisk, globalPDPath
...
@@ -40,7 +40,7 @@ func (util *AWSDiskUtil) AttachAndMountDisk(pd *awsPersistentDisk, globalPDPath
if
pd
.
readOnly
{
if
pd
.
readOnly
{
flags
=
mount
.
FlagReadOnly
flags
=
mount
.
FlagReadOnly
}
}
devicePath
,
err
:=
volumes
.
AttachDisk
(
""
,
pd
.
pdName
,
pd
.
readOnly
)
devicePath
,
err
:=
volumes
.
AttachDisk
(
""
,
pd
.
volumeId
,
pd
.
readOnly
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
@@ -89,7 +89,7 @@ func (util *AWSDiskUtil) AttachAndMountDisk(pd *awsPersistentDisk, globalPDPath
...
@@ -89,7 +89,7 @@ func (util *AWSDiskUtil) AttachAndMountDisk(pd *awsPersistentDisk, globalPDPath
// Unmounts the device and detaches the disk from the kubelet's host machine.
// Unmounts the device and detaches the disk from the kubelet's host machine.
func
(
util
*
AWSDiskUtil
)
DetachDisk
(
pd
*
awsPersistentDisk
)
error
{
func
(
util
*
AWSDiskUtil
)
DetachDisk
(
pd
*
awsPersistentDisk
)
error
{
// Unmount the global PD mount, which should be the only one.
// Unmount the global PD mount, which should be the only one.
globalPDPath
:=
makeGlobalPD
Name
(
pd
.
plugin
.
host
,
pd
.
pdName
)
globalPDPath
:=
makeGlobalPD
Path
(
pd
.
plugin
.
host
,
pd
.
volumeId
)
if
err
:=
pd
.
mounter
.
Unmount
(
globalPDPath
,
0
);
err
!=
nil
{
if
err
:=
pd
.
mounter
.
Unmount
(
globalPDPath
,
0
);
err
!=
nil
{
glog
.
V
(
2
)
.
Info
(
"Error unmount dir "
,
globalPDPath
,
": "
,
err
)
glog
.
V
(
2
)
.
Info
(
"Error unmount dir "
,
globalPDPath
,
": "
,
err
)
return
err
return
err
...
@@ -101,11 +101,11 @@ func (util *AWSDiskUtil) DetachDisk(pd *awsPersistentDisk) error {
...
@@ -101,11 +101,11 @@ func (util *AWSDiskUtil) DetachDisk(pd *awsPersistentDisk) error {
// Detach the disk
// Detach the disk
volumes
,
err
:=
pd
.
getVolumeProvider
()
volumes
,
err
:=
pd
.
getVolumeProvider
()
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
V
(
2
)
.
Info
(
"Error getting volume provider for
pd "
,
pd
.
pdName
,
": "
,
err
)
glog
.
V
(
2
)
.
Info
(
"Error getting volume provider for
volumeId "
,
pd
.
volumeId
,
": "
,
err
)
return
err
return
err
}
}
if
err
:=
volumes
.
DetachDisk
(
""
,
pd
.
pdName
);
err
!=
nil
{
if
err
:=
volumes
.
DetachDisk
(
""
,
pd
.
volumeId
);
err
!=
nil
{
glog
.
V
(
2
)
.
Info
(
"Error detaching disk "
,
pd
.
pdName
,
": "
,
err
)
glog
.
V
(
2
)
.
Info
(
"Error detaching disk "
,
pd
.
volumeId
,
": "
,
err
)
return
err
return
err
}
}
return
nil
return
nil
...
@@ -113,7 +113,7 @@ func (util *AWSDiskUtil) DetachDisk(pd *awsPersistentDisk) error {
...
@@ -113,7 +113,7 @@ func (util *AWSDiskUtil) DetachDisk(pd *awsPersistentDisk) error {
// safe_format_and_mount is a utility script on AWS VMs that probes a persistent disk, and if
// safe_format_and_mount is a utility script on AWS VMs that probes a persistent disk, and if
// necessary formats it before mounting it.
// necessary formats it before mounting it.
// This eliminates the neces
is
ty to format a PD before it is used with a Pod on AWS.
// This eliminates the neces
si
ty to format a PD before it is used with a Pod on AWS.
// TODO: port this script into Go and use it for all Linux platforms
// TODO: port this script into Go and use it for all Linux platforms
type
awsSafeFormatAndMount
struct
{
type
awsSafeFormatAndMount
struct
{
mount
.
Interface
mount
.
Interface
...
...
test/e2e/pd.go
View file @
95b68ae0
...
@@ -274,7 +274,7 @@ func testPDPod(diskName, targetHost string, readOnly bool) *api.Pod {
...
@@ -274,7 +274,7 @@ func testPDPod(diskName, targetHost string, readOnly bool) *api.Pod {
Name
:
"testpd"
,
Name
:
"testpd"
,
VolumeSource
:
api
.
VolumeSource
{
VolumeSource
:
api
.
VolumeSource
{
AWSPersistentDisk
:
&
api
.
AWSPersistentDiskVolumeSource
{
AWSPersistentDisk
:
&
api
.
AWSPersistentDiskVolumeSource
{
PDName
:
diskName
,
VolumeId
:
diskName
,
FSType
:
"ext4"
,
FSType
:
"ext4"
,
ReadOnly
:
readOnly
,
ReadOnly
:
readOnly
,
},
},
...
...
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