提交 666bee39 编写于 作者: B Boris Fiuczynski 提交者: John Ferlan

nodedev: Fabric name must not be required for fc_host capability

fabric_name is one of many fc_host attributes in Linux that is optional
and left to the low-level driver to decide if it is implemented.
The zfcp device driver does not provide a fabric name for an fcp host.

This patch removes the requirement for a fabric name by making it optional.
Signed-off-by: NBoris Fiuczynski <fiuczy@linux.vnet.ibm.com>
上级 d5922692
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
number of vport in use. <code>max_vports</code> shows the number of vport in use. <code>max_vports</code> shows the
maximum vports the HBA supports. "fc_host" implies following maximum vports the HBA supports. "fc_host" implies following
sub-elements: <code>wwnn</code>, <code>wwpn</code>, and sub-elements: <code>wwnn</code>, <code>wwpn</code>, and
<code>fabric_wwn</code>. optionally <code>fabric_wwn</code>.
</dd> </dd>
</dl> </dl>
</dd> </dd>
......
...@@ -18,7 +18,18 @@ ...@@ -18,7 +18,18 @@
<change/> <change/>
</section> </section>
<section title="Bug fixes"> <section title="Bug fixes">
<change/> <change>
<summary>
nodedev: Fabric name must not be required for fc_host capability
</summary>
<description>
fabric_name is one of many fc_host attributes in Linux that is
optional and left to the low-level driver to decide if it is
implemented. For example the zfcp device driver does not provide a
fabric name for an fcp host. The requirement for the existence of
a fabric name has been removed by making it optional.
</description>
</change>
</section> </section>
</release> </release>
<release version="v3.0.0" date="2017-01-17"> <release version="v3.0.0" date="2017-01-17">
......
...@@ -367,9 +367,11 @@ ...@@ -367,9 +367,11 @@
<ref name='wwn'/> <ref name='wwn'/>
</element> </element>
<element name='fabric_wwn'> <optional>
<ref name='wwn'/> <element name='fabric_wwn'>
</element> <ref name='wwn'/>
</element>
</optional>
</define> </define>
<define name='capsvports'> <define name='capsvports'>
......
...@@ -72,13 +72,10 @@ nodeDeviceSysfsGetSCSIHostCaps(virNodeDevCapDataPtr d) ...@@ -72,13 +72,10 @@ nodeDeviceSysfsGetSCSIHostCaps(virNodeDevCapDataPtr d)
VIR_FREE(d->scsi_host.wwnn); VIR_FREE(d->scsi_host.wwnn);
VIR_STEAL_PTR(d->scsi_host.wwnn, tmp); VIR_STEAL_PTR(d->scsi_host.wwnn, tmp);
if (!(tmp = virReadFCHost(NULL, d->scsi_host.host, "fabric_name"))) { if ((tmp = virReadFCHost(NULL, d->scsi_host.host, "fabric_name"))) {
VIR_WARN("Failed to read fabric WWN for host%d", VIR_FREE(d->scsi_host.fabric_wwn);
d->scsi_host.host); VIR_STEAL_PTR(d->scsi_host.fabric_wwn, tmp);
goto cleanup;
} }
VIR_FREE(d->scsi_host.fabric_wwn);
VIR_STEAL_PTR(d->scsi_host.fabric_wwn, tmp);
} }
if (virIsCapableVport(NULL, d->scsi_host.host)) { if (virIsCapableVport(NULL, d->scsi_host.host)) {
......
...@@ -29,13 +29,16 @@ static char *fchost_prefix; ...@@ -29,13 +29,16 @@ static char *fchost_prefix;
#define TEST_FC_HOST_PREFIX fchost_prefix #define TEST_FC_HOST_PREFIX fchost_prefix
#define TEST_FC_HOST_NUM 5 #define TEST_FC_HOST_NUM 5
#define TEST_FC_HOST_NUM_NO_FAB 6
/* Test virIsCapableFCHost */ /* Test virIsCapableFCHost */
static int static int
test1(const void *data ATTRIBUTE_UNUSED) test1(const void *data ATTRIBUTE_UNUSED)
{ {
if (virIsCapableFCHost(TEST_FC_HOST_PREFIX, if (virIsCapableFCHost(TEST_FC_HOST_PREFIX,
TEST_FC_HOST_NUM)) TEST_FC_HOST_NUM) &&
virIsCapableFCHost(TEST_FC_HOST_PREFIX,
TEST_FC_HOST_NUM_NO_FAB))
return 0; return 0;
return -1; return -1;
...@@ -148,6 +151,39 @@ test5(const void *data ATTRIBUTE_UNUSED) ...@@ -148,6 +151,39 @@ test5(const void *data ATTRIBUTE_UNUSED)
return ret; return ret;
} }
/* Test virReadFCHost fabric name optional */
static int
test6(const void *data ATTRIBUTE_UNUSED)
{
const char *expect_wwnn = "2002001b32a9da4e";
const char *expect_wwpn = "2102001b32a9da4e";
char *wwnn = NULL;
char *wwpn = NULL;
int ret = -1;
if (!(wwnn = virReadFCHost(TEST_FC_HOST_PREFIX, TEST_FC_HOST_NUM_NO_FAB,
"node_name")))
return -1;
if (!(wwpn = virReadFCHost(TEST_FC_HOST_PREFIX, TEST_FC_HOST_NUM_NO_FAB,
"port_name")))
goto cleanup;
if (virReadFCHost(TEST_FC_HOST_PREFIX, TEST_FC_HOST_NUM_NO_FAB,
"fabric_name"))
goto cleanup;
if (STRNEQ(expect_wwnn, wwnn) ||
STRNEQ(expect_wwpn, wwpn))
goto cleanup;
ret = 0;
cleanup:
VIR_FREE(wwnn);
VIR_FREE(wwpn);
return ret;
}
static int static int
mymain(void) mymain(void)
{ {
...@@ -169,6 +205,8 @@ mymain(void) ...@@ -169,6 +205,8 @@ mymain(void)
ret = -1; ret = -1;
if (virTestRun("test5", test5, NULL) < 0) if (virTestRun("test5", test5, NULL) < 0)
ret = -1; ret = -1;
if (virTestRun("test6", test6, NULL) < 0)
ret = -1;
cleanup: cleanup:
VIR_FREE(fchost_prefix); VIR_FREE(fchost_prefix);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册