nvmeof: Use subnqn to disconnect a volume

nvme-cli no longer allows to use a path to nvme block device
(e.g. /dev/nvme0n1) as an argument to nvme disconnect command.
For more details, please see:
https://github.com/linux-nvme/nvme-cli/issues/563

To address this issue, change the command that is executed to
disconnect a volume from:

$ nvme disconnect -d <device>

to:

$ nvme disconnect -n <subnqn>

Change-Id: I51a30825da5e7378ebc1d6f4a12645d73d7feb19
Closes-Bug: #1843431
Signed-off-by: Szczerbik, Przemyslaw <przemyslawx.szczerbik@intel.com>
This commit is contained in:
Szczerbik, Przemyslaw
2019-09-24 10:45:57 +01:00
committed by Jay Bryant
parent cc17adb70f
commit 6ea276c22e

View File

@@ -190,19 +190,20 @@ class NVMeOFConnector(base.BaseLinuxConnector):
device_path = connection_properties['device_path'] or ''
current_nvme_devices = self._get_nvme_devices()
if device_path not in current_nvme_devices:
LOG.warning("Trying to disconnect device %(device_path)s that "
"is not connected.", {'device_path': device_path})
LOG.warning("Trying to disconnect device %(device_path)s with "
"subnqn %(conn_nqn)s that is not connected.",
{'device_path': device_path, 'conn_nqn': conn_nqn})
return
LOG.debug(
"Trying to disconnect from NVMe nqn "
"%(conn_nqn)s with device_path %(device_path)s",
{'conn_nqn': conn_nqn, 'device_path': device_path})
"Trying to disconnect from device %(device_path)s with "
"subnqn %(conn_nqn)s",
{'device_path': device_path, 'conn_nqn': conn_nqn})
cmd = [
'nvme',
'disconnect',
'-d',
device_path]
'-n',
conn_nqn]
try:
self._execute(
*cmd,