infiniband: Fix the bug of wrongly checking whether the device exists

When the `p_key` is specified, the virtual infiniband device should be
created automatically. And activating the connection on the virtual
infiniband device should not require the users to create virtual
infiniband device manually upfront. The previous implementation is
wrong which validating the presence of virtual infiniband device
upfront, as a result, the users have to create the virtual infiniband
device manually in the target system in order to activate the
connection on the virtual infiniband device through the role. This is
an actual bug, the exception raised when the users do not
pre-configured such a virtual infiniband device. To address the
problem, only checking the existence of the device when the `p_key` is
not specified.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
This commit is contained in:
Wen Liang 2022-05-16 06:41:34 -04:00 committed by Fernando Fernández Mancera
parent 84222cb610
commit 6dca796863

View file

@ -2012,7 +2012,7 @@ class Cmd(object):
"interface exists" % (connection["interface_name"]),
)
elif connection["type"] == "infiniband":
if connection["infiniband"]["p_key"] != -1:
if connection["infiniband"]["p_key"] == -1:
self.log_fatal(
idx,
"profile specifies interface_name '%s' but no such "