[ofw] [patch] osmtest - creating and deleting the inventory file
Smith, Stan
stan.smith at intel.com
Mon Sep 13 10:26:17 PDT 2010
Hello,
Although this is a nice enhancement, the patch needs to be sent to the IB management maintainer for his approval (Sasha Khapyorsky).
The windows opensm code is based on OFED Linux management source base releases in order to take advantage of all the people working on the code (new features and bug fixes).
When opensm is ported to Windows, a snapshot of the OFED management git tree is ported into the Windows environment with as little change as possible.
Windows code changes are then returned to Sasha for his approval/incorporation back into the OFED management source.
When submitting patches to Sasha, please cc linux-rdma at vger.kernel.org<mailto:linux-rdma at vger.kernel.org>
If you use MS outlook as your mailer, be aware of how outlook will clobber your patch text if not inserted as 'text'; copy-n-paste does not work!
Additionally, you need to set Outlook send characteristics to a very long line length (133+) so Outlook will not add additional <newline> chars.
Finally, attaching a patch file is not acceptable within the Linux community for submitting patches.
stan.
________________________________
From: ofw-bounces at lists.openfabrics.org [mailto:ofw-bounces at lists.openfabrics.org] On Behalf Of Irena Gannon
Sent: Sunday, September 12, 2010 3:07 AM
To: ofw at lists.openfabrics.org
Subject: [ofw] [patch] osmtest - creating and deleting the inventory file
The patch creates an inventory file, if it did not exist before, when creating the DB and deletes this file if it was created during the run.
Index: D:/Windows/MLNX_VPI_2_1_2/ulp/opensm/user/osmtest/osmtest.c
===================================================================
--- D:/Windows/MLNX_VPI_2_1_2/ulp/opensm/user/osmtest/osmtest.c (revision 6412)
+++ D:/Windows/MLNX_VPI_2_1_2/ulp/opensm/user/osmtest/osmtest.c (revision 6455)
@@ -7089,11 +7089,28 @@
fh = fopen(p_osmt->opt.file_name, "r");
if (fh == NULL) {
- OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0130: "
- "Unable to open inventory file (%s)\n",
- p_osmt->opt.file_name);
- status = IB_ERROR;
- goto Exit;
+ OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG, "Inventory file (%s) doesn't exist. "
+ "The file will be created.\n", p_osmt->opt.file_name);
+
+ /*
+ * Creating an inventory file with all nodes, ports and paths
+ */
+ status = osmtest_create_inventory_file(p_osmt);
+ if (status != IB_SUCCESS) {
+ OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0139: "
+ "Inventory file create failed (%s)\n",
+ ib_get_err_str(status));
+ goto Exit;
+ }
+
+ fh = fopen(p_osmt->opt.file_name, "r");
+ if (fh == NULL) {
+ OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0130: "
+ "Unable to open inventory file (%s)\n",
+ p_osmt->opt.file_name);
+ status = IB_ERROR;
+ goto Exit;
+ }
}
/*
Index: D:/Windows/MLNX_VPI_2_1_2/ulp/opensm/user/osmtest/main.c
===================================================================
--- D:/Windows/MLNX_VPI_2_1_2/ulp/opensm/user/osmtest/main.c (revision 6412)
+++ D:/Windows/MLNX_VPI_2_1_2/ulp/opensm/user/osmtest/main.c (revision 6455)
@@ -291,7 +291,7 @@
#else
const char *const short_option = "f:l:m:M:d:g:s:t:i:pcvVh";
#endif
-
+ FILE* inventoryExists = NULL;
/*
* In the array below, the 2nd parameter specified the number
* of arguments as follows:
@@ -344,6 +344,9 @@
opt.flow = OSMT_FLOW_ALL; /* run all validation tests */
strcpy(flow_name, "All Validations");
strcpy(opt.file_name, "osmtest.dat");
+ inventoryExists = (fopen(opt.file_name,"r"));
+ if (inventoryExists)
+ fclose(inventoryExists);
printf("\nCommand Line Arguments\n");
do {
@@ -597,7 +600,7 @@
if (cl_hton64(guid) == cl_hton64(INVALID_GUID)) {
print_all_guids(&osm_test);
complib_exit();
- return (status);
+ goto Exit;
}
/*
@@ -615,7 +618,7 @@
*/
status = osmtest_bind(&osm_test, max_lid, guid);
if (status != IB_SUCCESS)
- exit(status);
+ goto Exit;
status = osmtest_run(&osm_test);
if (status != IB_SUCCESS) {
@@ -628,5 +631,18 @@
complib_exit();
Exit:
+ if (!inventoryExists) //The file did not exist in the begging of the run
+ {
+ inventoryExists = (fopen(opt.file_name,"r"));
+ if (inventoryExists) //If the file exists after the run - we created it
+ {
+ fclose(inventoryExists);
+ if (system("del osmtest.dat"))
+ {
+ printf("Warning: Inventory file cleanup failed\n");
+ }
+ }
+ }
+
return (status);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20100913/1353b86e/attachment.html>
More information about the ofw
mailing list