Commit Graph

57 Commits (f96849981203ea506ea8fa3f88c173d36cf688aa)

Author SHA1 Message Date
danielqsj 8092904e3c Cleanup PathExists callers 2019-01-08 22:16:11 +08:00
jianglingxia 6159bab94a
Merge branch 'master' into jlx201811031619 2018-11-17 12:53:21 +08:00
jianglingxia 0094e05975 fix golint problem of volume cephfs/iscsi/nfs 2018-11-17 12:50:47 +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
Jan Safranek 362be3a58b Retry attaching multipath iSCSI volumes
Don't mount single path instead of multipath volumes and always wait until
at least 2 paths are available. Try up to 3 times to get all paths. Try 5
times to get at last 2 paths.
2018-10-08 13:00:24 +02:00
Masaki Kimura 3d808540df Fix descriptor lock release logic for block volume unmapDevice
Fixes: #69114
2018-10-03 14:40:54 +00:00
Jan Safranek e5fbb3538f Unmount iSCSI device only if it's mounted. 2018-09-27 10:24:59 +02:00
Ben Swartzlander 39e52ddae5 Add wait loop for multipath devices to appear
It takes a variable amount of time for the multipath daemon
to create /dev/dm-XX in response to new LUNs being discovered.
The old iscsi_util code only discovered the multipath device
if it was created quickly enough, but in a significant number
of cases, kubelet would grab one of the individual paths and
put a filesystem it on before multipathd could construct a
multipath device.

This change waits for the multipath device to get created for
up to 10 seconds, but only if the PV actually had more than
one portal.
2018-08-08 00:44:45 -04:00
Ben Swartzlander 6d23d8edbb Avoid deleted iSCSI LUNs in the kernel
This change ensures that iSCSI block devices are deleted after
unmounting, and implements scanning of individual LUNs rather
than scanning the whole iSCSI bus.

In cases where an iSCSI bus is in use by more than one attachment,
detaching used to leave behind phantom block devices, which could
cause I/O errors, long timeouts, or even corruption in the case
when the underlying LUN number was recycled. This change makes
sure to flush references to the block devices after unmounting.

The original iSCSI code scanned the whole target every time a LUN
was attached. On storage controllers that export multiple LUNs on
the same target IQN, this led to a situation where nodes would
see SCSI disks that they weren't supposed to -- possibly dozens or
hundreds of extra SCSI disks. This caused 3 significant problems:

1) The large number of disks wasted resources on the node and
caused a minor drag on performance.
2) The scanning of all the devices caused a huge number of uevents
from the kernel, causing udev to bog down for multiple minutes in
some cases, triggering timeouts and other transient failures.
3) Because Kubernetes was not tracking all the "extra" LUNs that
got discovered, they would not get cleaned up until the last LUN
on a particular target was detached, causing a logout. This led
to significant complications:

In the time window between when a LUN was unintentially scanned,
and when it was removed due to a logout, if it was deleted on the
backend, a phantom reference remained on the node. In the best
case, the phantom LUN would cause I/O errors and timeouts in the
udev system. In the worst case, the backend could reuse the LUN
number for a new volume, and if that new volume were to be
scheduled to a pod with a phantom reference to the old LUN by the
same number, the initiator could get confused and possibly corrupt
data on that volume.

To avoid these problems, the new implementation only scans for
the specific LUN number it expects to see. It's worth noting that
the default behavior of iscsiadm is to automatically scan the
whole bus on login. That behavior can be disabled by setting
node.session.scan = manual
in iscsid.conf, and for the reasons mentioned above, it is
strongly recommended to set that option. This change still works
regardless of the setting in iscsid.conf, and while automatic
scanning will cause some problems, this change doesn't make the
problems any worse, and can make things better in some cases.
2018-07-24 23:58:19 -04:00
Russ Cox 2bd91dda64 kubernetes: fix printf format errors
These are all flagged by Go 1.11's
more accurate printf checking in go vet,
which runs as part of go test.

Lubomir I. Ivanov <neolit123@gmail.com>
applied ammend for:
  pkg/cloudprovider/provivers/vsphere/nodemanager.go
2018-07-11 00:10:15 +03:00
Jan Safranek 906fd7529e Fix iSCSI and RBD UnmountDevice with mount containers.
Google's configure-helper.sh script bind-mounts /var/lib/kubelet somewhere
into /home/kubernetes and thus every mount that Kubernetes does is visible
twice in /proc/mounts.

iSCSI and RBD should not rely on counting on entries in /proc/mounts and
unmount device when Kubernetes thinks it's unusued. Kubernetes tracks
the mounts by itself and most of other volume plugins rely on it safely.
2018-05-09 09:52:37 +02:00
wackxu f737ad62ed update import 2018-02-27 20:23:35 +08:00
Di Xu 48388fec7e fix all the typos across the project 2018-02-11 11:04:14 +08:00
Serguei Bezverkhi 40e0c38988 Cleaning up loopback removal process 2018-02-02 10:33:25 -05:00
Mitsuhiro Tanino 6fa583381e Update comments for getting and removing loopback device at iSCSI,FC,RBD
This PR add comments for the background why plugin gets loopback
device and removes loopback device even if operation_generator has
same functionality.
2018-01-17 10:22:39 -05:00
Mitsuhiro Tanino a6d979dd88 Block volumes Support: iSCSI plugin update
This patch adds block volume support to iSCSI volume plugin.
2018-01-10 11:38:36 -05:00
Sean McGinnis 9f97d61de4
Fixed space/tab indentation
Some lines had spaces for indentation instead of tabs.
2017-12-20 23:48:15 -06:00
Sean McGinnis 69a2deea9c iscsi: set node.startup to manual
If the default iSCSI node.startup is set to automatic, if there is a node failure,
any pods on that node will get rescheduled to another node. If the failed node is
later brought back up it will then try to log back in to any iSCSI sessions it had
prior to the failure, which may no longer exist or may be now in-use by the other
nodes.

It appears most platforms keep the open-iscsi default of node.startup-automatic.
But in case this system-wide setting has been changed, and just to be explicit, this
sets node.startup values for kubernetes controlled volumes to manual.

Closes issue #21305
2017-12-20 15:37:22 -06:00
Sergey Lanzman 3474747465 Move regexp.MustCompile to global variable 2017-11-16 22:03:12 +02:00
mtanino 629718ef0b Refactoring and improvements for iSCSI and FC
This PR makes following changes.

- Simplify volume tearDown path for iSCSI and FC using
  util.UnmountPath().
- Log lastErr during iscsi connection
  If iscsid fails to connect second portal, currently
  the error is ignored silently. The lastErr should be
  logged to find the root cause of problem.
- Remove iscsi plugin directory after iscsi connection
  is successfully closed.
2017-09-18 21:33:11 -04:00
Jan Safranek 540752d0a1 Fix iSCSI WaitForAttach not mounting a volume
WaitForAttach failed consistently with this error:
Heuristic determination of mount point failed:stat /var/lib/kubelet/plugins/kubernetes.io/iscsi/iface-default/10.128.0.3:3260-iqn.2003-01.org.linux-iscsi.f21.x8664:sn.4b0aae584f7c-lun-0: no such file or directory

We should ignore "no such file or directory" eror, the directory is created
just few lines below.
2017-08-30 15:34:49 +02:00
allencloud c8c7139d21 refactor codes in volume iscsi to improve readability
Signed-off-by: allencloud <allen.sun@daocloud.io>
2017-08-27 12:05:21 +08:00
mtanino e21b68b4ca Support iscsi volume attach and detach
Fixes #48953
2017-08-26 17:23:47 -04:00
Lars Lehtonen 47ee11437d
Fix swallowed error in iscsi package 2017-08-25 20:57:58 -07:00
Jan Safranek bc6ad1ad9f iscsi: Use VolumeHost.GetExec() to execute stuff in volume plugins 2017-08-23 14:56:51 +02:00
Mitsuhiro Tanino a6e523f2e7 iSCSI volume plugin: iSCSI initiatorname support
This PR adds iSCSI initiatorname parameter to ISCSIVolumeSource
to enable automatic configuration of initiator name per volume.
This would allow for more fine grained configuration, and remove
the need to configure the initiator name on the host by
administrator.

fixes: #47311
2017-08-21 11:26:56 -04:00
Mitsuhiro Tanino 285ac8935f iSCSi plugin: Remove redundant nil check 2017-06-15 18:00:29 -04:00
mtanino b1f06aaed5 iSCSI plugin: Update devicepath with filepath.Glob result
If iscsiTransport is not tcp, iSCSI plugin tries to
find devicepath using filepath.Glob but never updates
devicepath with the filepath.Glob result.

This patch fixes the problem.

Fixes #47253
2017-06-09 22:54:25 -04:00
mtanino 82ce37d973 bkpPortal should be initialized beforehand
This patch is a follow up patch for the PR#46239.
The bkpPortal in DetachDisk() path should be initialized
before using it.
2017-06-05 10:22:57 -04:00
mtanino aebaee39d5 Log out from multiple portals with iscsi storage plugin
When using iscsi storage with multiple target portal (TP)
addresses and multipathing the volume manager logs on to
the IQN for all portal addresses, but when a pod gets
destroyed the volume manager only logs out for the primary
TP and sessions for another TPs are always remained.

This patch adds methods to store and load iscsi disk
configrations, then uses the stored config at DetachDisk
path.

Fix #45394
2017-05-31 16:53:47 -04:00
Huamin Chen 8eb6d6cfa7 update iSCSI README with CHAP instruction
Signed-off-by: Huamin Chen <hchen@redhat.com>
2017-04-07 16:38:29 +00:00
Huamin Chen 9298217126 Add iSCSI CHAP authentication
Signed-off-by: Huamin Chen <hchen@redhat.com>
2017-04-07 16:38:29 +00:00
yupengzte 363f321f32 should replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...)
Signed-off-by: yupengzte <yu.peng36@zte.com.cn>
2017-03-06 09:14:48 +08:00
Cristian Pop b23b475498 Implemented suggestions for #39202 fix to facilitate kubelet upgrade. The detachDisk behavior is now preserved for pods that were created before the kubelet upgrade. 2017-02-14 22:50:26 +02:00
Cristian Pop b0d285c706 Fix for Premature iSCSI logout #39202. 2017-02-14 11:34:03 +02:00
Humble Chirammal 332e26dc8c Add portals field to iscsi volume source to achieve multipathing.
Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
2017-02-06 17:06:33 +05:30
forrestchen 1d9f754565 no need to sleep for last retry
Signed-off-by: forrestchen <forrestchen@tencent.com>
2016-12-21 17:52:01 +08:00
Anish Bhatt 531a961a96 Check iscsi iface file for transport name 2016-07-25 18:15:25 -07:00
David McMahon ef0c9f0c5b Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
tobad357 1811ded396 This is an update that allows the iscsi volume to check if a iscsi device belongs to a mpio device
If it does belong to the device then we make sure we mount the mpio device instead of
the raw device.

Heuristics
Login into /dev/disk/by-path/iqn-example.com.2999 -> /dev/sde
Check if sde existsin in /sys/block/[dm-X]/slaves/xx
If it does mount /dev/[dm-x] which will look like /dev/mapper/mpiodevicename in mount

examples/iscsi has more details
2016-04-20 09:42:11 +08:00
saadali 79012f6d53 Rename volume.Builder to Mounter and volume.Cleaner to Unmounter 2016-03-25 11:29:58 -07:00
Anish Bhatt 6e46fa1fd4 Add support for open-iscsi transports.
This enables use of software or hardware transports viz. be2iscsi,
bnx2i, cxgb3i, cxgb4i, qla4xx, iser and ocs. The default transport
(tcp) happens to be called "default".

Use of non-default transports changes the disk path to the following format:
/dev/disk/by-path/pci-<pci_id>-ip-<portal>-iscsi-<iqn>-lun-<lun_id>
2015-12-08 17:28:06 -08:00
k8s-merge-robot 13b0fd3cda Merge pull request #16942 from swagiaal/distinguish-format-and-mount
Auto commit by PR queue bot
2015-12-03 10:51:26 -08:00
Sami Wagiaalla 66c905d63e Distinguish normal mount from format and mount in SafeFormatAndMount 2015-12-02 11:16:00 -05:00
Anish Bhatt 18c82f743c Support iqn as well as eui format for iSCSI entity names.
Supported formats are :
iqn.<date code>.<reversed domain>[:<optional suffix>]

eui.<eui-64 identifier>
2015-11-24 00:13:59 -08:00
Huamin Chen 9ca96abd46 iscsi: use global path to retrieve iscsi portal and iqn
Signed-off-by: Huamin Chen <hchen@redhat.com>
2015-10-14 09:48:07 -04:00
Anish Bhatt 6d9e9561e8 Fix extraneous entries in iscsi path format
Code comments currently claim the default iscsi mount path as

kubernetes.io/pod/iscsi/<portal>-iqn-<iqn>-lun-<id>, however actual
path being used is
kubernetes.io/iscsi/iscsi/<portal>-iqn-<iqn>-lun-<id>

This leads to ultimate path being similar to this :

kubernetes.io/iscsi/iscsi/...iqn-iqn...-lun-N

Both iscsi and iqn are repated twice for no reason, since "iqn" is
required by spec to be part of an iqn. This is also  wrong on
multiple leves as actual allowed naming formats are :

iqn.2001-04.com.example:storage:diskarrays-sn-a8675309
eui.02004567A425678D
(RFC 3720 3.2.6.3)

and in the second case "iqn-eui" in the path would be misleading.

Change this to a more reasonable path of
kubernetes.io/iscsi/<portal>-<iqn>-lun-<id>

which also aligns up with how the /dev/by-path and sysfs entries
are created for iscsi devices on linux

  * -- *

Update iSCSI README and sample json file

There seems to have been quite a skew in recent updates to these
files adding in wrong info or info that no longer lines up the
sample config with the README.

Fixed the following issues :
* Fix discrepancy in samples json using initiator iqn from previous
  linked example as target iqn (which was just wrong)
* Generate sample output and README from the same json config provided.
* Remove recommendation to edit initiator name, this is not required
  (open-iscsi warns against editing this manually and provides a utility
   for the same)
* Update docker inspect command to one that works.
* Use separate LUNs for separate mount points instead of re-using.
2015-10-13 10:08:52 -07:00
Eric Paris f125ad88ce Rename IsMountPoint to IsLikelyNotMountPoint
IsLikelyNotMountPoint determines if a directory is not a mountpoint.
It is fast but not necessarily ALWAYS correct. If the path is in fact
a bind mount from one part of a mount to another it will not be detected.
mkdir /tmp/a /tmp/b; mount --bin /tmp/a /tmp/b; IsLikelyNotMountPoint("/tmp/b")
will return true. When in fact /tmp/b is a mount point. So this patch
renames the function and switches it from a positive to a negative (I
could think of a good positive name). This should make future users of
this function aware that it isn't quite perfect, but probably good
enough.
2015-08-14 18:45:43 -04:00
Mike Danese 17defc7383 run gofmt on everything we touched 2015-08-05 17:52:56 -07:00
Mike Danese 8e33cbfa28 rewrite go imports 2015-08-05 17:30:03 -07:00