379 Commits

Author SHA1 Message Date
Gorka Eguileor
708733e495 Fix FC scan too broad
After some changes to the FC connector we have introduced a regression
on the way we do the scans, and we end up scanning using wildcards even
though we shouldn't.

The targets in the "initiator_target_map" don't mean that they are all
connected, so we must take that into account.

With the current code, if we have the following connections:

HBA host7 ---- SWITCH ---- port W (channel 0, target 2)
          \--- SWITCH ---- port X (channel 0, target 3)

HBA host8 ---- SWITCH ---- port Y (channel 0, target 2)
          \--- SWITCH ---- port Z (channel 0, target 3)

We will end up with the following scans 8 scans for LUN L:

  - - L > host7
  - - L > host7
  0 2 L > host7
  0 3 L > host7

  0 2 L > host8
  0 3 L > host8
  - - L > host8
  - - L > host8

Which correspond to the responses from _get_hba_channel_scsi_target like
this:

               port Y          port Z          port W          port X
  host7 ... ['-','-',L]     ['-','-',L]     ['0','2',L]     ['0','3',L]
  host8 ... ['0','2',L]     ['0','3',L]     ['-','-',L]     ['-','-',L]

And we should only be doing 4 scans:

  0 2 L > host7
  0 3 L > host7
  0 2 L > host8
  0 3 L > host8

Most storage arrays get their target ports automatically detected by the
Linux FC initiator and sysfs gets populated with that information, but
there are some that don't.

We'll do a narrow scan using the channel, target, and LUN for the former
and a wider scan for the latter.

If all paths to a former type of array were down on the system boot the
array could look like it's of the latter type and make us bring us
unwanted volumes into the system by doing a broad scan.

To prevent this from happening Cinder drivers can use the
"enable_wildcard_scan" key in the connection information to let us know
they don't want us to do broad scans even if no target ports are found
(because they know the cause is there's no connection).

Close-Bug: #1849504
Related-Bug: #1765000
Related-Bug: #1828440
Change-Id: I5dbefaff43fb902b15117b443fc92f7b6a6ad8c9
2019-11-11 15:47:59 +01:00
Walter A. Boring IV
0f057aee6e Rename nvme to nvmeof
The nvme connector in os-brick is actually for nvme over fabrics, so
to avoid future confusion we have renamed the nvme connector object
to NVMeOF to better reflect it's capability.  This patch keeps the
backwards compatibility of the mapping of the initiator.NVME to
the renamed nvmeof object.

Change-Id: I97b41139f2e67ab42e2aa8075c51ef939b3cde18
2019-09-03 09:39:35 -04:00
Zuul
db29f3c6b4 Merge "Fix param in s390x platform" 2019-08-28 20:11:44 +00:00
Zuul
b7c40aa39b Merge "Delete redundant code" 2019-08-28 20:06:31 +00:00
jichenjc
6cb3427437 Fix param in s390x platform
641337bec2 (diff-fc0623f8e70d3f7227e540c84c0546c5L78)

made some changes but it's for x86 only, we need s390x change as well

Change-Id: Ibc804ee7de66b64b6ace0809280551f7f637fd11
2019-08-27 02:02:05 +00:00
Zuul
1c02d525bb Merge "Check path alive before get scsi wwn" 2019-08-12 23:44:04 +00:00
Chris M
81f26f822d Fix bad argument to iscsiadm in iSCSI discovery
Fix a call to _iscsiadm_update() in which a list was being passed as
the target_iqn connection property.  This property is used directly as
an argument to the iscsiadm -T option, so it must be a plain string.

Change-Id: I9c2ff1de1f89fb49dd6c5a90679d5c4238d5476a
Closes-bug: 1838820
2019-08-06 19:19:29 +00:00
yenai
acf44b0c51 Delete redundant code
Method _discover_mpath_device isn't overwrited in FibreChannelConnector,
just use it by self._discover_mpath_device.

Change-Id: I3d5a6e0010e56d256da17e4b20be3db0569c6702
2019-07-26 11:19:34 +08:00
Gorka Eguileor
1c07f221f2 iSCSI single path: Don't fail if there's no WWN
This patch relaxes the single-pathed connections and allows them to
complete even when we cannot detect the WWN on the sysfs, just like
multipath connections do.

Closes-Bug: #1834443
Change-Id: Iae5a304329a2b172bc6b7f310623fad18956ae45
2019-06-28 10:00:52 +02:00
zengjia
3b8d5b7886 Check path alive before get scsi wwn
In FC environment, when disconnect volume,
if the first path in the loop is failed,
it will lead get scsi wwn to failure.
So I think we need to add path validity check
before get scsi wwn

Change-Id: I9d3a9dac13dcd585330e7b891c61b2626e5aabec
Closes-Bug: 1831621
2019-06-14 19:48:52 +08:00
Zuul
0afbf125b3 Merge "FC: Ignore some HBAs from map for single WWNN" 2019-06-12 15:41:25 +00:00
Lee Yarwood
9cf135c686 linuxscsi: Stop waiting for multipath devices during extend_volume
Previously linuxscsi.extend_volume would always attempt to wait for
multipath devices to appear regardless of multipath actually being used
by the connector.

This change corrects this by passing down the existing use_multipath
attribute from the iSCSI and FC connectors into linuxscsi.extend_volume.
The same attribute is introduced to the NVMe connector to also allow it
to skip this search for multipath devices.

Change-Id: I29d65ae036957f3a63cba93dd330b14e3361a1b9
Closes-bug: #1832247
2019-06-11 10:20:51 +01:00
Gorka Eguileor
70899a9aa3 FC: Ignore some HBAs from map for single WWNN
Current FC OS-Brick code only checks for single WWNN to exclude some
HBAs from scanning when we don't receive an initiator_target_map from
the backend.

There are storage arrays,like XtremIO, that due to their architecture
and design have all target ports automatically mapped to LUNs and are
returning the initiator_target_map, but some of those ports may not be
connected to our HBAs, so we end up with another case of bug #1765000.

This patch makes sure that we always check if the target implements
single WWNN, not only when we don't receive the initiator_target_map.

With this we decrease the likelihood of ending with unexpected devices
in our system, because now we will ignore unconnected HBAs (even if
reported in the initiator_target_map) if we are working with single WWNN
target.

Related-Bug: #1765000
Closes-Bug: #1828440
Change-Id: I02c208142f5b342f894666831449243863eccbfe
2019-05-09 18:55:52 +02:00
Sean McGinnis
d71c267b9d
Fix invalid escape sequence warnings
Starting with py36, DeprecationWarnings are raised for special
characters in strings that are not being used as valid escape sequences.
This addresses a couple instances we had for string replacement by
changing the replacement strings to be raw strings.

Change-Id: I93291e978aacaf3f639f32174605528f0038f13a
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2019-04-09 16:20:13 -05:00
Yury Kulazhenkov
05b6c9f9fa Fix ScaleIO KeyError after upgrade
A long time ago the driver was changed to store volume_id
in the nova database and use that. Previously it would use the
volume_name and make a call to get the volume_id.

Both should be supported, but as the code path currently throws
a KeyError it will never reach the backwards compatible code.
This makes sure that the driver works even after an upgrade from Mitaka.

Depends-On: https://review.openstack.org/#/c/643130/
Change-Id: Iab6a3ca6bf92dc5606c7723dc6c62bf07fa1d934
Closes-Bug: #1648629
2019-03-14 05:41:24 +00:00
Walter A. Boring IV
3cfdf89837 Revert "rename ScaleIO connector to VxFlex OS"
This reverts commit a7f7abc5b8d0e230bb9b586422df0438358b42d1.

The Cinder ScaleIO driver has been rebranded to VxFlexOS, which is fine.
What shouldn't have happened is that the rebranding made it's way
into os-brick, resulting in a new connector protocol and mapping.
The new VxFlexOS driver in cinder should just use the existing
scaleio connector protocol, as it's not customer/user facing, and
ensures backwards and forwards compatibility.

Change-Id: Ia1e119c16091bbf6ff79e0acea8c1a7c656d6dd1
2019-03-12 18:41:45 +00:00
Walter A. Boring IV
ba2168d8fe Revert "Fix VxFlexOs KeyError after upgrade"
This reverts commit 6b60614afaf88819ce92a2d0ed269035a3c8b261.

The Cinder ScaleIO driver has been rebranded to VxFlexOS, which is fine.
What shouldn't have happened is that the rebranding made it's way
into os-brick, resulting in a new connector protocol and mapping.
The new VxFlexOS driver in cinder should just use the existing
scaleio connector protocol, as it's not customer/user facing, and
ensures backwards and forwards compatibility.

Change-Id: Icf7063eb47368cb7b0ffb2e3f5e30903797c7b34
2019-03-12 18:38:26 +00:00
Avishay Traeger
6adbce5ef7 Revert "Verify WWN of connected iSCSI devices if passed"
This reverts commit 14be08d0b53836963a530e2990a6db73901cbdac.

Change-Id: I1c99cdff5074180a09c315954c743b2bb0565f53
Related-Bug: #1819577
2019-03-12 12:03:57 +02:00
Zuul
a22d316f79 Merge "Fix VxFlexOs KeyError after upgrade" 2019-03-11 12:22:04 +00:00
Tejdeep Kautharam
a2b72a967f Remove trailing newline character in UUID
Trailing newline character is present in UUID returned by
_get_system_uuid method. This causes problems when the returned UUID
is not checked for newline. Remove trailing newline before returning
UUID.

Change-Id: Ibe37a14f67ce7452f088d7913a76c6233202ccea
Closes-Bug: #1819062
2019-03-07 17:06:18 -08:00
Erik Olof Gunnar Andersson
6b60614afa Fix VxFlexOs KeyError after upgrade
A long time ago the driver was changed to store volume_id in the
nova database and use that. Previously it would use the volume_name
and make a call to get the volume_id.

Both should be supported, but as the code path currently
throws a KeyError it will never reach the backwardscompatible
code.

This makes sure that the driver works even after an upgrade
from Mitaka.

Change-Id: Ic389e1a8f0f43ef410eee89202fef19d554fce90
Closes-Bug: #1648629
2019-03-04 21:33:52 -08:00
Zuul
eaff50d9a0 Merge "Fix get keyring content failed when ceph auth disabled" 2019-02-26 18:55:38 +00:00
Zuul
04c6c0cc29 Merge "rename ScaleIO connector to VxFlex OS" 2019-02-26 18:49:14 +00:00
Rui Yuan Dou
a6dff156d7 Fix get keyring content failed when ceph auth disabled
When ceph auth diasbled, both 'user' and 'keyring' will be 'None',
and the method _check_or_get_keyring_contents must return strings
for ceph conf file writelines() generation.

Change-Id: Ieafd40ace4f50c1a966c9097c5de270c68b0666b
Closes-Bug: #1817271
2019-02-26 09:07:48 +08:00
Zuul
318a5cf33d Merge "Py3: Fix invalid escape sequencees" 2019-02-25 19:59:42 +00:00
Yury Kulazhenkov
a7f7abc5b8 rename ScaleIO connector to VxFlex OS
Dell EMC ScaleIO has been rebranded to VxFlex OS.
To follow this changes "scaleio" protocol renamed to "vxflexos",
"ScaleIOConnector" class renamed to "VxFlexOsConnector".
Old names will continue to work but will be removed in the Train
release.

Change-Id: I3bb1c985c64007c6960b6fa6f4cd893760a9a342
2019-02-25 11:12:03 +03:00
Eric Harney
8938733ba8 Py3: Fix invalid escape sequencees
These throw warnings on Python 3.6.

Change-Id: If46e59792423b384bbb2d46c05ac0b57df06254b
2019-02-21 14:36:29 -05:00
Gorka Eguileor
037f9fe667 Fix FC case sensitive scanning
For FC connections there are multiple places where we check the
initiator target map provided by the backend against the port names of
the HBAs on the system.

Currently this check is case sensitive, but some backends are returning
the port names in the initiator target map upper cased, which usually
results in attach failures.

Some of the reasons for the attach failures is that os-brick will not
issue scan requests.

Example from a 3PAR backend from a specific system:

  Connector properties:
    {
     'wwpns': ['10001409dcd71ff6', '10001409dcd71ff7'],
     'wwnns': ['20001409dcd71ff6', '20001409dcd71ff7'],
     ...
    }

  Connection properties:
    {
     'initiator_target_map': {
       '10001409DCD71FF6': ['20320002AC01E166', '21420002AC01E166'],
       '10001409DCD71FF7': ['20410002AC01E166', '21410002AC01E166']
     }
     ...
    }

This patch converts to lower case the
initiator_target_map and the target_wwn/target_wwns.

Closes-Bug: #1775677
Change-Id: I12b9535d8a9969356394e406a1ed5ac4a5f1f959
2019-02-21 10:27:50 +01:00
Zuul
6d88dbc7f2 Merge "Update hacking version" 2019-02-20 17:06:14 +00:00
Zuul
ae0a489b13 Merge "Handle None value 'inititator_target_map'" 2019-02-20 16:45:47 +00:00
Zuul
953cd147a1 Merge "VMware: Detach backing vmdk during disconnect" 2019-02-20 16:33:45 +00:00
Zuul
d9d278b6f9 Merge "iSCSI: log exception if portals not found" 2019-02-15 18:25:29 +00:00
Zuul
97c02d2bb8 Merge "Don't warn on missing dmidecode" 2019-02-15 18:02:17 +00:00
Sam Wan
53877a95bc
Handle None value 'inititator_target_map'
Should check not only if 'initiator_target_map' is in conn_props but
also its value is not None.

Change-Id: I7ca0bf5fac20a370097f1c39ce005a1b23814459
Closes-Bug: #1746218
2019-02-07 13:17:32 -06:00
Gorka Eguileor
08c8ef4ccf Don't warn on missing dmidecode
Missing dmidecode is only relevant for RSD backend, but the warning will
appear on all systems since this is logged on the get_connector_properties.

We don't really need dmidecode to get the UUID, we can just go and read
the contents of /sys/class/dmi/id/product_uuid

To better support systems that don't have dmidecode in the system, we
will check sysfs first, and then try dmidecode (in case it covers some
additional cases), and log it as a debug level message if dmidecode is
not present.

Closes-Bug: #1811822
Change-Id: Ibfaed6503bd91ad64987deecdc2e9a1471441005
2019-02-07 09:50:01 +01:00
Avishay Traeger
f3ad8c08fe iSCSI: log exception if portals not found
If an exception occurs in _get_ips_iqns_luns(), a
TargetPortalsNotFound exception is raised, but nothing is logged. It
would be useful for debugging to know what led to the exception.

Change-Id: I2ed7f9641acc9d8d506c368a44d789950a4f25dd
Closes-Bug: 1814512
2019-02-04 11:28:33 +02:00
Vipin Balachandran
9cf03af278 VMware: Detach backing vmdk during disconnect
During restore, the backing vmdk is overwritten using backup
data. If the restored vmdk has a different uuid or size than the
original one, it will not be reflected in vSphere. Due to this
stale metadata, there is no way we can fix the uuid or backing
vmdk size if it changes after restore. The recommended way is to
detach the backing vmdk from the backend volume (shadow VM),
delete it and attach the restored vmdk. This will ensure update
of current vmdk size and uuid in vSphere.

Change-Id: Ib3d5c115f9076c19c3e33eaf6cccf630439a4c26
Partial-bug: 1814346
Partial-bug: 1814347
2019-02-01 15:05:07 -08:00
Avishay Traeger
14be08d0b5 Verify WWN of connected iSCSI devices if passed
If a WWN has been provided in connection_properties, verify that the
found devices have that expected WWN. Fail the attachment if not. This
prevents cases where a device already exists on the host from an old
attachment that wasn't fully cleaned up, and the new attachment got
the same LUN. Using this old device could lead to data corruption.

Change-Id: I45a2221c0518213dc8132831c0bde9db4734da2b
Closes-Bug: 1813609
2019-01-30 08:49:52 +02:00
ZhijunWei
e6ddc92efb Update hacking version
Use latest release 1.1.0 and compatible changes w.r.t pep8

Change-Id: I44910cd34930799dc04166a4e57498c84210f14d
2019-01-18 21:30:00 -05:00
Zuul
322554c386 Merge "Remove unused connection properties" 2019-01-11 00:52:36 +00:00
Yingxin
a0cb8779ce Add retry to nvme connect in nvme connector
It is noticed that there could be some delays for a successful `nvme
connect` after "initialize_connection()" is completed in Cinder RSD
driver.

So add retries here, while keep the original logic intact.

Change-Id: I049f1d701c99612959d8262342aa63a043a97db0
2019-01-09 12:52:44 +08:00
Zuul
d7ebf977bb Merge "Support RSD scenario of nvme connector" 2019-01-05 00:09:07 +00:00
Yingxin
891abdff2f Support RSD scenario of nvme connector
* When execute `nvme connect`, "host-nqn" is needed in RSD environment.
  So add it as an optional parameter.

* It is observed that the first `nvme list` can miss the newly connected
  nvme device, right after a success call of `nvme connect`. The
  solution is to add the retry&sleep logic back.

* Sometimes there can be more than 10 nvme devices, e.g.
  "/dev/nvme10n10". Need to update the device re pattern.

* In RSD environment, the connector needs additional information like
  "system uuid", to let cinder-volume know the nova-cpu service is
  running on which RSD node.

* Add a new protocol "NVMEOF" mapping to allow both Cinder and Nova to
  identify and use the nvme connector.

Implements: blueprint nvme-volume-driver
Change-Id: I26e3dc140b2cf30a97665679fdc4d2f897cd4872
2018-12-24 13:51:20 +08:00
Zuul
7fde113dff Merge "Windows SMBFS: fix using share subdirs" 2018-12-19 18:04:58 +00:00
Rui Yuan Dou
881c958272 Fix create ceph conf failed when cephx disable
Change-Id: Ia7f5a7b90d8fd9812aa2b244bec06a076ca39fdd
Closes-Bug: #1808322
2018-12-13 19:48:22 +08:00
Lucian Petrut
d5c3f3a7f6 Windows SMBFS: fix using share subdirs
When using Scale-Out File Server SMB shares, we have to use the local
share paths instead of the UNC paths if the host is part of the
cluster.

There's an os-win method that allows fetching the shared path but
it expects the share name, while we're passing subdirs as well,
for which reason it fails.

We'll have to make sure we're passing the share name only, appending
the subdir afterwards.

Closes-Bug: #1805341

Change-Id: I47d7e7afefe050cd4b25435cfcfc3e8963bd04bc
2018-11-27 10:19:07 +02:00
Zuul
dd7a7e60ef Merge "Context manager to handle shared_targets" 2018-11-06 08:20:06 +00:00
Gorka Eguileor
71a1e22418 Context manager to handle shared_targets
We introduced "shared_targets" and "service_uuid" fields in volumes to
allow volume consumers to protect themselves from unintended leftover
devices when handling iSCSI connections with shared targets.

The way they protect themselves from the automatic scans that happen on
detach/map race conditions is by locking and only allowing one attach or
one detach operation for each server to happen at a given time.

When using an up to date Open iSCSI initiator we don't need to use
locks, as it has the possibility to disable automatic LUN scans (which
are the real cause of the leftover devices), and OS-Brick already
supports this feature.

This is currently not the case, since Nova is blindly locking whenever
"shared_targets" is set to True.

Thanks to the context manager introduced in this patch we can improve
our separation of concerns (Nova doesn't have to care when we have to
lock), and we can fine tune the locking to only lock when the iSCSI
initiator doesn't support disabling automatic scans.

The context manager "guard_connection" lives in
"os_brick.initiator.utils" and needs a cinder volume.  The volume can be
passed as a dictionary or OVO instance.

Change-Id: I4970363301d5d1f4e7d0f07e09b34d15ee6884c3
Related-Bug: #1800515
2018-10-30 16:55:01 +01:00
Zuul
5d0b08d145 Merge "Retry executing command "nvme list" when fail" 2018-10-27 05:24:35 +00:00
Zuul
7a1259333e Merge "Improve VolumePathsNotFound message details" 2018-10-26 17:02:01 +00:00