1*d6b92ffaSHans Petter Selasky /*
2*d6b92ffaSHans Petter Selasky * Copyright (c) 2010 Lawrence Livermore National Lab. All rights reserved.
3*d6b92ffaSHans Petter Selasky *
4*d6b92ffaSHans Petter Selasky * This software is available to you under a choice of one of two
5*d6b92ffaSHans Petter Selasky * licenses. You may choose to be licensed under the terms of the GNU
6*d6b92ffaSHans Petter Selasky * General Public License (GPL) Version 2, available from the file
7*d6b92ffaSHans Petter Selasky * COPYING in the main directory of this source tree, or the
8*d6b92ffaSHans Petter Selasky * OpenIB.org BSD license below:
9*d6b92ffaSHans Petter Selasky *
10*d6b92ffaSHans Petter Selasky * Redistribution and use in source and binary forms, with or
11*d6b92ffaSHans Petter Selasky * without modification, are permitted provided that the following
12*d6b92ffaSHans Petter Selasky * conditions are met:
13*d6b92ffaSHans Petter Selasky *
14*d6b92ffaSHans Petter Selasky * - Redistributions of source code must retain the above
15*d6b92ffaSHans Petter Selasky * copyright notice, this list of conditions and the following
16*d6b92ffaSHans Petter Selasky * disclaimer.
17*d6b92ffaSHans Petter Selasky *
18*d6b92ffaSHans Petter Selasky * - Redistributions in binary form must reproduce the above
19*d6b92ffaSHans Petter Selasky * copyright notice, this list of conditions and the following
20*d6b92ffaSHans Petter Selasky * disclaimer in the documentation and/or other materials
21*d6b92ffaSHans Petter Selasky * provided with the distribution.
22*d6b92ffaSHans Petter Selasky *
23*d6b92ffaSHans Petter Selasky * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24*d6b92ffaSHans Petter Selasky * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25*d6b92ffaSHans Petter Selasky * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26*d6b92ffaSHans Petter Selasky * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27*d6b92ffaSHans Petter Selasky * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28*d6b92ffaSHans Petter Selasky * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29*d6b92ffaSHans Petter Selasky * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30*d6b92ffaSHans Petter Selasky * SOFTWARE.
31*d6b92ffaSHans Petter Selasky *
32*d6b92ffaSHans Petter Selasky */
33*d6b92ffaSHans Petter Selasky
34*d6b92ffaSHans Petter Selasky #if HAVE_CONFIG_H
35*d6b92ffaSHans Petter Selasky # include <config.h>
36*d6b92ffaSHans Petter Selasky #endif /* HAVE_CONFIG_H */
37*d6b92ffaSHans Petter Selasky
38*d6b92ffaSHans Petter Selasky #define _GNU_SOURCE
39*d6b92ffaSHans Petter Selasky #include <stdio.h>
40*d6b92ffaSHans Petter Selasky #include <stdlib.h>
41*d6b92ffaSHans Petter Selasky #include <string.h>
42*d6b92ffaSHans Petter Selasky #include <getopt.h>
43*d6b92ffaSHans Petter Selasky #include <inttypes.h>
44*d6b92ffaSHans Petter Selasky
45*d6b92ffaSHans Petter Selasky #include <infiniband/mad.h>
46*d6b92ffaSHans Petter Selasky #include <infiniband/ibnetdisc.h>
47*d6b92ffaSHans Petter Selasky
48*d6b92ffaSHans Petter Selasky #include "ibdiag_common.h"
49*d6b92ffaSHans Petter Selasky
50*d6b92ffaSHans Petter Selasky uint64_t switchguid_before = 0;
51*d6b92ffaSHans Petter Selasky uint64_t switchguid_after = 0;
52*d6b92ffaSHans Petter Selasky int switchguid_flag = 0;
53*d6b92ffaSHans Petter Selasky
54*d6b92ffaSHans Petter Selasky uint64_t caguid_before = 0;
55*d6b92ffaSHans Petter Selasky uint64_t caguid_after = 0;
56*d6b92ffaSHans Petter Selasky int caguid_flag = 0;
57*d6b92ffaSHans Petter Selasky
58*d6b92ffaSHans Petter Selasky uint64_t sysimgguid_before = 0;
59*d6b92ffaSHans Petter Selasky uint64_t sysimgguid_after = 0;
60*d6b92ffaSHans Petter Selasky int sysimgguid_flag = 0;
61*d6b92ffaSHans Petter Selasky
62*d6b92ffaSHans Petter Selasky uint64_t portguid_nodeguid = 0;
63*d6b92ffaSHans Petter Selasky uint64_t portguid_before = 0;
64*d6b92ffaSHans Petter Selasky uint64_t portguid_after = 0;
65*d6b92ffaSHans Petter Selasky int portguid_flag = 0;
66*d6b92ffaSHans Petter Selasky
67*d6b92ffaSHans Petter Selasky struct guids {
68*d6b92ffaSHans Petter Selasky uint64_t searchguid;
69*d6b92ffaSHans Petter Selasky int searchguid_found;
70*d6b92ffaSHans Petter Selasky uint64_t before;
71*d6b92ffaSHans Petter Selasky uint64_t after;
72*d6b92ffaSHans Petter Selasky int found;
73*d6b92ffaSHans Petter Selasky };
74*d6b92ffaSHans Petter Selasky
parse_beforeafter(char * arg,uint64_t * before,uint64_t * after)75*d6b92ffaSHans Petter Selasky static int parse_beforeafter(char *arg, uint64_t *before, uint64_t *after)
76*d6b92ffaSHans Petter Selasky {
77*d6b92ffaSHans Petter Selasky char *ptr;
78*d6b92ffaSHans Petter Selasky char *before_str;
79*d6b92ffaSHans Petter Selasky char *after_str;
80*d6b92ffaSHans Petter Selasky
81*d6b92ffaSHans Petter Selasky ptr = strchr(optarg, ':');
82*d6b92ffaSHans Petter Selasky if (!ptr || !(*(ptr + 1))) {
83*d6b92ffaSHans Petter Selasky fprintf(stderr, "invalid input '%s'\n", arg);
84*d6b92ffaSHans Petter Selasky return -1;
85*d6b92ffaSHans Petter Selasky }
86*d6b92ffaSHans Petter Selasky (*ptr) = '\0';
87*d6b92ffaSHans Petter Selasky before_str = arg;
88*d6b92ffaSHans Petter Selasky after_str = ptr + 1;
89*d6b92ffaSHans Petter Selasky
90*d6b92ffaSHans Petter Selasky (*before) = strtoull(before_str, 0, 0);
91*d6b92ffaSHans Petter Selasky (*after) = strtoull(after_str, 0, 0);
92*d6b92ffaSHans Petter Selasky return 0;
93*d6b92ffaSHans Petter Selasky }
94*d6b92ffaSHans Petter Selasky
parse_guidbeforeafter(char * arg,uint64_t * guid,uint64_t * before,uint64_t * after)95*d6b92ffaSHans Petter Selasky static int parse_guidbeforeafter(char *arg,
96*d6b92ffaSHans Petter Selasky uint64_t *guid,
97*d6b92ffaSHans Petter Selasky uint64_t *before,
98*d6b92ffaSHans Petter Selasky uint64_t *after)
99*d6b92ffaSHans Petter Selasky {
100*d6b92ffaSHans Petter Selasky char *ptr1;
101*d6b92ffaSHans Petter Selasky char *ptr2;
102*d6b92ffaSHans Petter Selasky char *guid_str;
103*d6b92ffaSHans Petter Selasky char *before_str;
104*d6b92ffaSHans Petter Selasky char *after_str;
105*d6b92ffaSHans Petter Selasky
106*d6b92ffaSHans Petter Selasky ptr1 = strchr(optarg, ':');
107*d6b92ffaSHans Petter Selasky if (!ptr1 || !(*(ptr1 + 1))) {
108*d6b92ffaSHans Petter Selasky fprintf(stderr, "invalid input '%s'\n", arg);
109*d6b92ffaSHans Petter Selasky return -1;
110*d6b92ffaSHans Petter Selasky }
111*d6b92ffaSHans Petter Selasky guid_str = arg;
112*d6b92ffaSHans Petter Selasky before_str = ptr1 + 1;
113*d6b92ffaSHans Petter Selasky
114*d6b92ffaSHans Petter Selasky ptr2 = strchr(before_str, ':');
115*d6b92ffaSHans Petter Selasky if (!ptr2 || !(*(ptr2 + 1))) {
116*d6b92ffaSHans Petter Selasky fprintf(stderr, "invalid input '%s'\n", arg);
117*d6b92ffaSHans Petter Selasky return -1;
118*d6b92ffaSHans Petter Selasky }
119*d6b92ffaSHans Petter Selasky (*ptr1) = '\0';
120*d6b92ffaSHans Petter Selasky (*ptr2) = '\0';
121*d6b92ffaSHans Petter Selasky after_str = ptr2 + 1;
122*d6b92ffaSHans Petter Selasky
123*d6b92ffaSHans Petter Selasky (*guid) = strtoull(guid_str, 0, 0);
124*d6b92ffaSHans Petter Selasky (*before) = strtoull(before_str, 0, 0);
125*d6b92ffaSHans Petter Selasky (*after) = strtoull(after_str, 0, 0);
126*d6b92ffaSHans Petter Selasky return 0;
127*d6b92ffaSHans Petter Selasky }
128*d6b92ffaSHans Petter Selasky
process_opt(void * context,int ch,char * optarg)129*d6b92ffaSHans Petter Selasky static int process_opt(void *context, int ch, char *optarg)
130*d6b92ffaSHans Petter Selasky {
131*d6b92ffaSHans Petter Selasky switch (ch) {
132*d6b92ffaSHans Petter Selasky case 1:
133*d6b92ffaSHans Petter Selasky if (parse_beforeafter(optarg,
134*d6b92ffaSHans Petter Selasky &switchguid_before,
135*d6b92ffaSHans Petter Selasky &switchguid_after) < 0)
136*d6b92ffaSHans Petter Selasky return -1;
137*d6b92ffaSHans Petter Selasky switchguid_flag++;
138*d6b92ffaSHans Petter Selasky break;
139*d6b92ffaSHans Petter Selasky case 2:
140*d6b92ffaSHans Petter Selasky if (parse_beforeafter(optarg,
141*d6b92ffaSHans Petter Selasky &caguid_before,
142*d6b92ffaSHans Petter Selasky &caguid_after) < 0)
143*d6b92ffaSHans Petter Selasky return -1;
144*d6b92ffaSHans Petter Selasky caguid_flag++;
145*d6b92ffaSHans Petter Selasky break;
146*d6b92ffaSHans Petter Selasky case 3:
147*d6b92ffaSHans Petter Selasky if (parse_beforeafter(optarg,
148*d6b92ffaSHans Petter Selasky &sysimgguid_before,
149*d6b92ffaSHans Petter Selasky &sysimgguid_after) < 0)
150*d6b92ffaSHans Petter Selasky return -1;
151*d6b92ffaSHans Petter Selasky sysimgguid_flag++;
152*d6b92ffaSHans Petter Selasky break;
153*d6b92ffaSHans Petter Selasky case 4:
154*d6b92ffaSHans Petter Selasky if (parse_guidbeforeafter(optarg,
155*d6b92ffaSHans Petter Selasky &portguid_nodeguid,
156*d6b92ffaSHans Petter Selasky &portguid_before,
157*d6b92ffaSHans Petter Selasky &portguid_after) < 0)
158*d6b92ffaSHans Petter Selasky return -1;
159*d6b92ffaSHans Petter Selasky portguid_flag++;
160*d6b92ffaSHans Petter Selasky break;
161*d6b92ffaSHans Petter Selasky default:
162*d6b92ffaSHans Petter Selasky return -1;
163*d6b92ffaSHans Petter Selasky }
164*d6b92ffaSHans Petter Selasky
165*d6b92ffaSHans Petter Selasky return 0;
166*d6b92ffaSHans Petter Selasky }
167*d6b92ffaSHans Petter Selasky
update_switchportguids(ibnd_node_t * node)168*d6b92ffaSHans Petter Selasky static void update_switchportguids(ibnd_node_t *node)
169*d6b92ffaSHans Petter Selasky {
170*d6b92ffaSHans Petter Selasky ibnd_port_t *port;
171*d6b92ffaSHans Petter Selasky int p;
172*d6b92ffaSHans Petter Selasky
173*d6b92ffaSHans Petter Selasky for (p = 0; p <= node->numports; p++) {
174*d6b92ffaSHans Petter Selasky port = node->ports[p];
175*d6b92ffaSHans Petter Selasky if (port)
176*d6b92ffaSHans Petter Selasky port->guid = node->guid;
177*d6b92ffaSHans Petter Selasky }
178*d6b92ffaSHans Petter Selasky }
179*d6b92ffaSHans Petter Selasky
replace_node_guid(ibnd_node_t * node,void * user_data)180*d6b92ffaSHans Petter Selasky static void replace_node_guid(ibnd_node_t *node, void *user_data)
181*d6b92ffaSHans Petter Selasky {
182*d6b92ffaSHans Petter Selasky struct guids *guids;
183*d6b92ffaSHans Petter Selasky
184*d6b92ffaSHans Petter Selasky guids = (struct guids *)user_data;
185*d6b92ffaSHans Petter Selasky
186*d6b92ffaSHans Petter Selasky if (node->guid == guids->before) {
187*d6b92ffaSHans Petter Selasky
188*d6b92ffaSHans Petter Selasky node->guid = guids->after;
189*d6b92ffaSHans Petter Selasky
190*d6b92ffaSHans Petter Selasky /* port guids are identical to switch guids on
191*d6b92ffaSHans Petter Selasky * switches, so update port guids too
192*d6b92ffaSHans Petter Selasky */
193*d6b92ffaSHans Petter Selasky if (node->type == IB_NODE_SWITCH)
194*d6b92ffaSHans Petter Selasky update_switchportguids(node);
195*d6b92ffaSHans Petter Selasky
196*d6b92ffaSHans Petter Selasky guids->found++;
197*d6b92ffaSHans Petter Selasky }
198*d6b92ffaSHans Petter Selasky }
199*d6b92ffaSHans Petter Selasky
replace_sysimgguid(ibnd_node_t * node,void * user_data)200*d6b92ffaSHans Petter Selasky static void replace_sysimgguid(ibnd_node_t *node, void *user_data)
201*d6b92ffaSHans Petter Selasky {
202*d6b92ffaSHans Petter Selasky struct guids *guids;
203*d6b92ffaSHans Petter Selasky uint64_t sysimgguid;
204*d6b92ffaSHans Petter Selasky
205*d6b92ffaSHans Petter Selasky guids = (struct guids *)user_data;
206*d6b92ffaSHans Petter Selasky
207*d6b92ffaSHans Petter Selasky sysimgguid = mad_get_field64(node->info, 0, IB_NODE_SYSTEM_GUID_F);
208*d6b92ffaSHans Petter Selasky if (sysimgguid == guids->before) {
209*d6b92ffaSHans Petter Selasky mad_set_field64(node->info, 0, IB_NODE_SYSTEM_GUID_F,
210*d6b92ffaSHans Petter Selasky guids->after);
211*d6b92ffaSHans Petter Selasky guids->found++;
212*d6b92ffaSHans Petter Selasky }
213*d6b92ffaSHans Petter Selasky }
214*d6b92ffaSHans Petter Selasky
replace_portguid(ibnd_node_t * node,void * user_data)215*d6b92ffaSHans Petter Selasky static void replace_portguid(ibnd_node_t *node, void *user_data)
216*d6b92ffaSHans Petter Selasky {
217*d6b92ffaSHans Petter Selasky struct guids *guids;
218*d6b92ffaSHans Petter Selasky
219*d6b92ffaSHans Petter Selasky guids = (struct guids *)user_data;
220*d6b92ffaSHans Petter Selasky
221*d6b92ffaSHans Petter Selasky if (node->guid != guids->searchguid)
222*d6b92ffaSHans Petter Selasky return;
223*d6b92ffaSHans Petter Selasky
224*d6b92ffaSHans Petter Selasky guids->searchguid_found++;
225*d6b92ffaSHans Petter Selasky
226*d6b92ffaSHans Petter Selasky if (node->type == IB_NODE_SWITCH) {
227*d6b92ffaSHans Petter Selasky /* port guids are identical to switch guids on
228*d6b92ffaSHans Petter Selasky * switches, so update switch guid too
229*d6b92ffaSHans Petter Selasky */
230*d6b92ffaSHans Petter Selasky if (node->guid == guids->before) {
231*d6b92ffaSHans Petter Selasky node->guid = guids->after;
232*d6b92ffaSHans Petter Selasky update_switchportguids(node);
233*d6b92ffaSHans Petter Selasky guids->found++;
234*d6b92ffaSHans Petter Selasky }
235*d6b92ffaSHans Petter Selasky }
236*d6b92ffaSHans Petter Selasky else {
237*d6b92ffaSHans Petter Selasky ibnd_port_t *port;
238*d6b92ffaSHans Petter Selasky int p;
239*d6b92ffaSHans Petter Selasky
240*d6b92ffaSHans Petter Selasky for (p = 1; p <= node->numports; p++) {
241*d6b92ffaSHans Petter Selasky port = node->ports[p];
242*d6b92ffaSHans Petter Selasky if (port
243*d6b92ffaSHans Petter Selasky && port->guid == guids->before) {
244*d6b92ffaSHans Petter Selasky port->guid = guids->after;
245*d6b92ffaSHans Petter Selasky guids->found++;
246*d6b92ffaSHans Petter Selasky break;
247*d6b92ffaSHans Petter Selasky }
248*d6b92ffaSHans Petter Selasky }
249*d6b92ffaSHans Petter Selasky }
250*d6b92ffaSHans Petter Selasky }
251*d6b92ffaSHans Petter Selasky
main(int argc,char ** argv)252*d6b92ffaSHans Petter Selasky int main(int argc, char **argv)
253*d6b92ffaSHans Petter Selasky {
254*d6b92ffaSHans Petter Selasky ibnd_fabric_t *fabric = NULL;
255*d6b92ffaSHans Petter Selasky char *orig_cache_file = NULL;
256*d6b92ffaSHans Petter Selasky char *new_cache_file = NULL;
257*d6b92ffaSHans Petter Selasky struct guids guids;
258*d6b92ffaSHans Petter Selasky
259*d6b92ffaSHans Petter Selasky const struct ibdiag_opt opts[] = {
260*d6b92ffaSHans Petter Selasky {"switchguid", 1, 1, "BEFOREGUID:AFTERGUID",
261*d6b92ffaSHans Petter Selasky "Specify before and after switchguid to edit"},
262*d6b92ffaSHans Petter Selasky {"caguid", 2, 1, "BEFOREGUID:AFTERGUID",
263*d6b92ffaSHans Petter Selasky "Specify before and after caguid to edit"},
264*d6b92ffaSHans Petter Selasky {"sysimgguid", 3, 1, "BEFOREGUID:AFTERGUID",
265*d6b92ffaSHans Petter Selasky "Specify before and after sysimgguid to edit"},
266*d6b92ffaSHans Petter Selasky {"portguid", 4, 1, "NODEGUID:BEFOREGUID:AFTERGUID",
267*d6b92ffaSHans Petter Selasky "Specify before and after port guid to edit"},
268*d6b92ffaSHans Petter Selasky {0}
269*d6b92ffaSHans Petter Selasky };
270*d6b92ffaSHans Petter Selasky char *usage_args = "<orig.cache> <new.cache>";
271*d6b92ffaSHans Petter Selasky
272*d6b92ffaSHans Petter Selasky ibdiag_process_opts(argc, argv, NULL, "CDdeGKLPstvy",
273*d6b92ffaSHans Petter Selasky opts, process_opt, usage_args,
274*d6b92ffaSHans Petter Selasky NULL);
275*d6b92ffaSHans Petter Selasky
276*d6b92ffaSHans Petter Selasky argc -= optind;
277*d6b92ffaSHans Petter Selasky argv += optind;
278*d6b92ffaSHans Petter Selasky
279*d6b92ffaSHans Petter Selasky orig_cache_file = argv[0];
280*d6b92ffaSHans Petter Selasky new_cache_file = argv[1];
281*d6b92ffaSHans Petter Selasky
282*d6b92ffaSHans Petter Selasky if (!orig_cache_file)
283*d6b92ffaSHans Petter Selasky IBEXIT("original cache file not specified");
284*d6b92ffaSHans Petter Selasky
285*d6b92ffaSHans Petter Selasky if (!new_cache_file)
286*d6b92ffaSHans Petter Selasky IBEXIT("new cache file not specified");
287*d6b92ffaSHans Petter Selasky
288*d6b92ffaSHans Petter Selasky if ((fabric = ibnd_load_fabric(orig_cache_file, 0)) == NULL)
289*d6b92ffaSHans Petter Selasky IBEXIT("loading original cached fabric failed");
290*d6b92ffaSHans Petter Selasky
291*d6b92ffaSHans Petter Selasky if (switchguid_flag) {
292*d6b92ffaSHans Petter Selasky guids.before = switchguid_before;
293*d6b92ffaSHans Petter Selasky guids.after = switchguid_after;
294*d6b92ffaSHans Petter Selasky guids.found = 0;
295*d6b92ffaSHans Petter Selasky ibnd_iter_nodes_type(fabric,
296*d6b92ffaSHans Petter Selasky replace_node_guid,
297*d6b92ffaSHans Petter Selasky IB_NODE_SWITCH,
298*d6b92ffaSHans Petter Selasky &guids);
299*d6b92ffaSHans Petter Selasky
300*d6b92ffaSHans Petter Selasky if (!guids.found)
301*d6b92ffaSHans Petter Selasky IBEXIT("switchguid = %" PRIx64 " not found",
302*d6b92ffaSHans Petter Selasky switchguid_before);
303*d6b92ffaSHans Petter Selasky }
304*d6b92ffaSHans Petter Selasky
305*d6b92ffaSHans Petter Selasky if (caguid_flag) {
306*d6b92ffaSHans Petter Selasky guids.before = caguid_before;
307*d6b92ffaSHans Petter Selasky guids.after = caguid_after;
308*d6b92ffaSHans Petter Selasky guids.found = 0;
309*d6b92ffaSHans Petter Selasky ibnd_iter_nodes_type(fabric,
310*d6b92ffaSHans Petter Selasky replace_node_guid,
311*d6b92ffaSHans Petter Selasky IB_NODE_CA,
312*d6b92ffaSHans Petter Selasky &guids);
313*d6b92ffaSHans Petter Selasky
314*d6b92ffaSHans Petter Selasky if (!guids.found)
315*d6b92ffaSHans Petter Selasky IBEXIT("caguid = %" PRIx64 " not found",
316*d6b92ffaSHans Petter Selasky caguid_before);
317*d6b92ffaSHans Petter Selasky }
318*d6b92ffaSHans Petter Selasky
319*d6b92ffaSHans Petter Selasky if (sysimgguid_flag) {
320*d6b92ffaSHans Petter Selasky guids.before = sysimgguid_before;
321*d6b92ffaSHans Petter Selasky guids.after = sysimgguid_after;
322*d6b92ffaSHans Petter Selasky guids.found = 0;
323*d6b92ffaSHans Petter Selasky ibnd_iter_nodes(fabric,
324*d6b92ffaSHans Petter Selasky replace_sysimgguid,
325*d6b92ffaSHans Petter Selasky &guids);
326*d6b92ffaSHans Petter Selasky
327*d6b92ffaSHans Petter Selasky if (!guids.found)
328*d6b92ffaSHans Petter Selasky IBEXIT("sysimgguid = %" PRIx64 " not found",
329*d6b92ffaSHans Petter Selasky sysimgguid_before);
330*d6b92ffaSHans Petter Selasky }
331*d6b92ffaSHans Petter Selasky
332*d6b92ffaSHans Petter Selasky if (portguid_flag) {
333*d6b92ffaSHans Petter Selasky guids.searchguid = portguid_nodeguid;
334*d6b92ffaSHans Petter Selasky guids.searchguid_found = 0;
335*d6b92ffaSHans Petter Selasky guids.before = portguid_before;
336*d6b92ffaSHans Petter Selasky guids.after = portguid_after;
337*d6b92ffaSHans Petter Selasky guids.found = 0;
338*d6b92ffaSHans Petter Selasky ibnd_iter_nodes(fabric,
339*d6b92ffaSHans Petter Selasky replace_portguid,
340*d6b92ffaSHans Petter Selasky &guids);
341*d6b92ffaSHans Petter Selasky
342*d6b92ffaSHans Petter Selasky if (!guids.searchguid_found)
343*d6b92ffaSHans Petter Selasky IBEXIT("nodeguid = %" PRIx64 " not found",
344*d6b92ffaSHans Petter Selasky portguid_nodeguid);
345*d6b92ffaSHans Petter Selasky
346*d6b92ffaSHans Petter Selasky if (!guids.found)
347*d6b92ffaSHans Petter Selasky IBEXIT("portguid = %" PRIx64 " not found",
348*d6b92ffaSHans Petter Selasky portguid_before);
349*d6b92ffaSHans Petter Selasky }
350*d6b92ffaSHans Petter Selasky
351*d6b92ffaSHans Petter Selasky if (ibnd_cache_fabric(fabric, new_cache_file, 0) < 0)
352*d6b92ffaSHans Petter Selasky IBEXIT("caching new cache data failed");
353*d6b92ffaSHans Petter Selasky
354*d6b92ffaSHans Petter Selasky ibnd_destroy_fabric(fabric);
355*d6b92ffaSHans Petter Selasky exit(0);
356*d6b92ffaSHans Petter Selasky }
357