Commit Graph

71 Commits (bad9f6341a093c371f71e26aa27c0f695be1ba86)

Author SHA1 Message Date
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
Chao Xu f4989a45a5 run root-rewrite-v1-..., compile 2017-06-22 10:25:57 -07:00
Yecheng Fu 4e5e9ca0cd Only `layering` RBD image format 2 feature should be supported for now. 2017-06-16 18:07:03 +00:00
Yecheng Fu 0c7cdf773b Add `imageFeatures` parameter for RBD volume plugin, which is used to
customize RBD image format 2 features.
Update RBD docs in examples/persistent-volume-provisioning/README.md.
2017-06-16 18:07:03 +00:00
Wei Wei 2632bdd5e0 storageclass ceph add imageformat parameter 2017-06-16 18:07:03 +00:00
Steve Leon ab77633c95 Warn, instead of failing, if 'modprobe rbd' fails
Modprobe is a kernel operation that should only be done once to load the
RBD module. The admin could've done this on the Kubernetes nodes. The
RBD plugin can still try to load the module but it shouldnt fail the
workflow if it doesnt succeed.

Partially addresses #45190
2017-05-17 22:53:21 -07:00
Huamin Chen 71406aa4a6 force rbd image unlock if the image is not used
Signed-off-by: Huamin Chen <hchen@redhat.com>
2017-02-16 15:55:55 -05:00
Kubernetes Submit Queue 49fe0bea97 Merge pull request #37380 from jsafrane/rbd-errors
Automatic merge from submit-queue (batch tested with PRs 39092, 39126, 37380, 37093, 39237)

Improve error reporting in Ceph RBD provisioner.

- We should report an error when user references a secret that cannot be found
- We should report output of rbd create/delete commands, logging "exit code 1"
  is not enough.


Before:
```
Events:
  FirstSeen     LastSeen        Count   From                            SubobjectPath   Type            Reason                  Message
  ---------     --------        -----   ----                            -------------   --------        ------                  -------
  33m           33m             1       {persistentvolume-controller }                  Warning         ProvisioningFailed      Failed to provision volume with StorageClass "cephrbdprovisioner": rbd: create volume failed, err: exit status 1
```

After:

```
Events:
  FirstSeen     LastSeen        Count   From                            SubobjectPath   Type            Reason                  Message
  ---------     --------        -----   ----                            -------------   --------        ------                  -------
  33m           33m             1       {persistentvolume-controller }                  Warning         ProvisioningFailed      Failed to provision volume with StorageClass "cephrbdprovisioner": failed to create rbd image: exit status 1, command output: rbd: couldn't connect to the cluster
```


@rootfs, PTAL
2017-01-03 09:45:22 -08:00
forrestchen 1d9f754565 no need to sleep for last retry
Signed-off-by: forrestchen <forrestchen@tencent.com>
2016-12-21 17:52:01 +08:00
Jan Safranek 9484de5d09 Improve error reporting in Ceph RBD provisioner.
- We should report an error when user references a secret that cannot be found
- We should report output of rbd create/delete commands, logging "exit code 1"
  is not enough.


Before:
```
Events:
  FirstSeen     LastSeen        Count   From                            SubobjectPath   Type            Reason                  Message
  ---------     --------        -----   ----                            -------------   --------        ------                  -------
  33m           33m             1       {persistentvolume-controller }                  Warning         ProvisioningFailed      Failed to provision volume with StorageClass "cephrbdprovisioner": rbd: create volume failed, err: exit status 1
```

After:

```
Events:
  FirstSeen     LastSeen        Count   From                            SubobjectPath   Type            Reason                  Message
  ---------     --------        -----   ----                            -------------   --------        ------                  -------
  33m           33m             1       {persistentvolume-controller }                  Warning         ProvisioningFailed      Failed to provision volume with StorageClass "cephrbdprovisioner": failed to create rbd image: exit status 1, command output: rbd: couldn't connect to the cluster
```
2016-11-28 12:08:09 +01:00
Chao Xu bb675d395f dependencies: pkg/volume 2016-11-23 15:53:09 -08:00
Jan Safranek 101602ab11 Pass whole PVC to provisioner plugin
Gluster provisioner is interested in pvc.Namespace and I don't want to add
at as a new field in VolumeOptions - it would contain almost whole PVC.

Let's pass direct reference to PVC instead and let the provisioner to pick
information it is interested in.
2016-10-12 12:22:01 +02:00
Jedrzej Nowak f0988b95e7 Typos and englishify pkg/volume 2016-10-03 22:39:33 +02:00
Huamin Chen 0c3b2f44a4 review feedbacks
Signed-off-by: Huamin Chen <hchen@redhat.com>
2016-08-25 15:32:26 -04:00