Commit Graph

84 Commits

Author SHA1 Message Date
zouyee
bae72ee8d2 using string instead of byte
Signed-off-by: Zou Nengren <zouyee1989@gmail.com>
2019-12-24 09:23:02 +08:00
Travis Rhoden
0c5c3d8bb9
Remove pkg/util/mount (moved out of tree)
This patch removes pkg/util/mount completely, and replaces it with the
mount package now located at k8s.io/utils/mount. The code found at
k8s.io/utils/mount was moved there from pkg/util/mount, so the code is
identical, just no longer in-tree to k/k.
2019-11-15 08:29:12 -07:00
Travis Rhoden
367f879131
Retire mount.Exec for k8s.io/utils/exec
This patch removes mount.Exec entirely and instead uses the common
utility from k8s.io/utils/exec.

The fake exec implementation found in k8s.io/utils/exec differs a bit
than mount.Exec, with the ability to pre-script expected calls to
Command.CombinedOutput(), so tests that previously relied on a callback
mechanism to produce specific output have been updated to use that
mechanism.
2019-11-13 14:09:57 -07:00
Kubernetes Prow Robot
0a08798b9a
Merge pull request #75588 from smileusd/rbd_info
fix rbd info when return warning information
2019-10-15 16:32:09 -07:00
Kubernetes Prow Robot
2e4d02e9ab
Merge pull request #82909 from hwdef/del-unused-var1
fix(pkg): delete unused var or const
2019-09-24 13:37:26 -07:00
Ted Yu
2f3e563749 Remove unreachable error check in RBDUtil#cleanOldRBDFile 2019-09-21 19:14:24 -07:00
hwdef
386f981116 fix(pkg): delete unused var or const 2019-09-21 17:13:13 +08:00
smileusd
e5304209ed fix rbd info when return warning information 2019-09-18 16:50:01 +08:00
Guangming Wang
c718ba6871
cleanup: fix typos in rbd_util.go
Signed-off-by: Guangming Wang <guangming.wang@daocloud.io>
2019-08-15 22:39:15 +08:00
Jeremy Xu
d8fc13791a Avoid RbdDiskManager's DetachDisk never execute again 2019-07-16 18:13:38 +08:00
qingsenLi
62dea14351 fix klog format error 2019-05-27 18:05:09 +08:00
Travis Rhoden
78d109e201 Always use filepath.Join instead of path.Join
This patch cleans up pkg/util/mount/* and pkg/util/volume/* to always
use filepath.Join instead of path.Join. filepath.Join is preferred
because path.Join can have issues on Windows.
2019-04-29 09:56:05 -06:00
Travis Rhoden
12b7f1450c Move MountsInGlobalPDPath from mount pkg to volume
Since pkg/util/mount is going to move out of k/k, this exported constant
that is Kubernetes specific needed to move somewhere else. Made sense to
move it to pkg/volume/util.

Update GetDeviceNameFromMount in the mount interface to now take a
pluginMountDir argument, which is volume plugin dir with the global
mount path appended to it already.
2019-04-29 09:56:00 -06:00
Andrew Kim
a62ee8b0a9 clean up volume rounding functions and move to k8s.io/cloud-provider/volume 2019-02-09 01:16:55 -05:00
Andrew Kim
84191eb99b replace pkg/util/file with k8s.io/utils/path 2019-01-29 15:20:13 -05:00
danielqsj
8092904e3c Cleanup PathExists callers 2019-01-08 22:16:11 +08:00
mlmhl
34a2f23dc1 use json format to get rbd image size 2018-12-29 19:45:13 +08:00
Davanum Srinivas
954996e231
Move from glog to klog
- Move from the old github.com/golang/glog to k8s.io/klog
- klog as explicit InitFlags() so we add them as necessary
- we update the other repositories that we vendor that made a similar
change from glog to klog
  * github.com/kubernetes/repo-infra
  * k8s.io/gengo/
  * k8s.io/kube-openapi/
  * github.com/google/cadvisor
- Entirely remove all references to glog
- Fix some tests by explicit InitFlags in their init() methods

Change-Id: I92db545ff36fcec83afe98f550c9e630098b3135
2018-11-10 07:50:31 -05:00
Jacob Hilker
4eb6f16b54
Random typo fix 2018-09-26 16:18:04 -04:00
NickrenREN
0df3e167ac only when accessmodes equals to ROX, we don't need check rbd status of being used 2018-08-28 18:43:38 +08:00
Di Xu
b3dfe0c652 nodes: improve handling of erroneous host names 2018-08-01 14:57:25 +08:00
Matthew Wong
093e231289 Avoid overflowing int64 in RoundUpSize and return error if overflow int 2018-07-23 13:48:45 -04:00
Tardis Xu
56289ef3f8 Fix issue 64119. 2018-05-24 23:48:19 +08:00
Tardis Xu
6d3b41cd85 Fix issue #63183 that pods on different nodes mount Ceph RBD PVC stuck on ContainerCreating. 2018-05-09 16:04:24 +08:00
Lukasz Piatkowski
645d0d8e81 fix typo that redefines variable and breaks code 2018-04-05 13:49:02 +00:00
Kubernetes Submit Queue
ffe3bb2567
Merge pull request #60189 from jeffrey4l/log_warning
Automatic merge from submit-queue (batch tested with PRs 60189, 59542, 59931, 60621, 60353). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Log warning message when failed to remove rbd lock

It is hard to debug without any error message when lock is not removed
successfully.
2018-03-20 00:42:06 -07:00
wackxu
f737ad62ed update import 2018-02-27 20:23:35 +08:00
Ian Chakeres
110447844d Use rbd-nbd if present for rbd volume map and unmap operations, if rbd fails. 2018-02-26 07:06:07 -08:00
Jeffrey Zhang
afbe47a382 Log warning message when failed to remove rbd lock
It is hard to debug without any error message when lock is not removed
successfully.
2018-02-22 17:53:02 +08:00
mlmhl
2ccf22a5d0 fix rbd ConstructVolumeSpec bug 2018-01-09 10:27:05 +08:00
Serguei Bezverkhi
335c5d959f Adding support for Block Volume to rbd plugin 2018-01-05 23:56:37 -05:00
Yecheng Fu
b196301b67 RBD Plugin: Fix comments and remove unnecessary locking code. 2018-01-03 12:43:30 +08:00
Yecheng Fu
08d1c0b412 RBD Plugin: Pass monitors addresses in a comma-separated list instead of
trying one by one.

In production, monitors may crash (or have a network problem), if we try
monitors one by one, rbd command will hang a long time (e.g. `rbd map -m
<unconnectable_host_ip>` on linux 4.4 timed out in 6 minutes) when
trying a unconnectable monitor. This is unacceptable.

Actually, we can simply pass a comma-separed list monitor addresses
to `rbd` command utility. Kernel rbd/libceph modules will pick
monitor randomly and try one by one, `rbd` command utility succeed soon
if there is a good one in monitors list.
2017-12-21 21:02:25 +08:00
NickrenREN
6f7a1983ef Support ceph rbd resize 2017-11-22 19:48:02 +08:00
Kubernetes Submit Queue
a7e76475ef
Merge pull request #54556 from cofyc/fix_cmd_not_found
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

RBD Plugin: Fix bug in checking command not found error.

**What this PR does / why we need it**:

Fix bug in error checking logic. 

`Error()` method of command not found error returned from `command.Run/Output` is not "executable file not found in $PATH". Actually, it's `exec: "<command>": executable file not found in $PATH`.

I followed the logic in https://github.com/kubernetes/kubernetes/blob/v1.9.0-alpha.1/pkg/kubectl/cmd/util/editor/editor.go#L129 to detect command not found error.


**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #

**Special notes for your reviewer**:

https://play.golang.org/p/yZJxtouUQL

**Release note**:

```release-note
NONE
```
2017-11-18 07:32:22 -08:00
Sergey Lanzman
3474747465 Move regexp.MustCompile to global variable 2017-11-16 22:03:12 +02:00
Yecheng Fu
ff639e80e8 RBD Plugin: Fix bug in checking command not found error. 2017-11-16 16:52:57 +08:00
Mayank Kumar
dbadf6d9b3 include rbd command output in errors, simplify ifelse logic 2017-11-14 11:47:29 -08:00
Jan Safranek
c718fc2ca7 Don't cache exec and mounter in RBD volume plugin
Volume plugin can get a different exec and mounter implementation with every
call, it must not be cached.
2017-10-27 13:14:35 +02:00
Yecheng Fu
f2af1af82f RBD Plugin: No need to acquire advisory lock any more!
With central attachdetach controller, we don't need to lock the image
any more. But for backward compatibility, we should:

1) Check if the image is still used by nodes running old kubelet in
attaching.
2) Clean old rbd.json file and remove lock if found in detaching.
2017-10-25 18:31:57 +08:00
Yecheng Fu
ba0d275f3b RBD Plugin: Implement Attacher/Detacher interfaces.
1) Modify rbdPlugin to implement volume.AttachableVolumePlugin
   interface.
2) Add rbdAttacher/rbdDetacher structs to implement
   volume.Attacher/Detacher interfaces.
3) Add mount.SafeFormatAndMount/mount.Exec fields to rbdPlugin, and
   setup them in rbdPlugin.Init for later uses.
   Attacher/Mounter/Unmounter/Detacher reference rbdPlugin to use mounter
   and exec. This simplifies code.
4) Add testcase struct to abstract RBD Plugin test case, etc.
5) Add newRBD constructor to unify rbd struct initialization.
2017-10-25 17:43:17 +08:00
Kubernetes Submit Queue
5f030f4568 Merge pull request #54454 from cofyc/rbd_status
Automatic merge from submit-queue (batch tested with PRs 54229, 54380, 54302, 54454). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

RBD Plugin: rbdStatus only check output of successful `rbd status` run

**What this PR does / why we need it**:

Current RBDUtil.rbdStatus implementation never return error in any cases, even if command not found or `rbd status` never succeed. This PR change it to only check output of successful `rbd status` run, and return error on other cases.

Because there are maybe network problem or ceph cluster unresponsive conditions which will cause `rbd status` command to fail. We cannot assume there is no watchers on given image. It's better to return error, and let the caller to decide what to do.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #


**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-10-24 08:35:14 -07:00
Yecheng Fu
bcacfff798 RBD Plugin: rbdStatus only check output of successful rbd status run 2017-10-24 13:11:57 +08:00
Serguei Bezverkhi
1411c2698e Refactor RBD volume 2017-10-23 16:59:34 -04:00
Kubernetes Submit Queue
d3dc9cd9ba Merge pull request #51114 from jsafrane/exec-rbd
Automatic merge from submit-queue (batch tested with PRs 51114, 51233, 51024, 51053, 51197)

rbd: Use VolumeHost.GetExec() to execute stuff in volume plugins

**What this PR does / why we need it**:

This PR updates rbd volume plugin to use `VolumeHost.GetExec()` to execute utilities like mkfs and lsblk instead of simple `os/exec`. This prepares the volume plugin to run these utilities in containers instead of running them on the host + makes the volume plugin more independent and less hardcoded.

See proposal in https://github.com/kubernetes/community/pull/589.

Note that this PR does **not** change place where the utilities are executed - `VolumeHost.GetExec()` still leads directly to `os/exec`. It will be changed when the aforementioned proposal is merged and implemented.

@kubernetes/sig-storage-pr-reviews 

**Release note**:
```release-note
NONE
```
2017-08-25 06:22:09 -07:00
Yecheng Fu
c648505f76 RBD Plugin: Log RBD Attach/Mount/Unmout actions at logging level 3 2017-08-24 15:43:15 +00:00
Jan Safranek
73b101c14b rbd: Use VolumeHost.GetExec() to execute stuff in volume plugins 2017-08-22 15:49:21 +02:00
ymqytw
3dfc8bf7f3 update import 2017-07-20 11:03:49 -07:00
zhangningmin
01b6fc78cd Improve the warning message if the rbd command is not found. 2017-07-18 09:33:24 +08:00
Kubernetes Submit Queue
e554dd6d3d Merge pull request #45805 from weiwei04/ceph-imageformat-2
Automatic merge from submit-queue

storageclass ceph add imageformat parameter

**What this PR does / why we need it**:
Add a imageformat parameter for StorageClass(ceph rbd)

k8s hard coded ceph imageformat 1, according to [ceph manual](http://docs.ceph.com/docs/master/man/8/rbd/), imageformat 1 was deprecated, we should add an extra ceph parameter to set ceph rbd imageformat. Ceph rbd imageformat can only be 1 or 2, set the default value to 1.

**Release note**:
```release-note
Allow StorageClass Ceph RBD to specify image format and image features.
```
2017-06-23 16:43:37 -07:00