Print this page
NEX-5801 Snapshots left over after failed backups
Reviewed by: Rick Mesta <rick.mesta@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Revert "NEX-5801 Snapshots left over after failed backups"
This reverts commit f182fb95f09036db71fbfc6f0a6b90469b761f21.
NEX-5801 Snapshots left over after failed backups
Reviewed by: Rick Mesta <rick.mesta@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
NEX-2911 NDMP logging should use syslog and is too chatty
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/cmd/ndmpd/tlm/tlm_init.c
+++ new/usr/src/cmd/ndmpd/tlm/tlm_init.c
1 1 /*
2 2 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
3 3 */
4 4
5 5 /*
6 6 * BSD 3 Clause License
7 7 *
8 8 * Copyright (c) 2007, The Storage Networking Industry Association.
9 9 *
10 10 * Redistribution and use in source and binary forms, with or without
11 11 * modification, are permitted provided that the following conditions
12 12 * are met:
13 13 * - Redistributions of source code must retain the above copyright
14 14 * notice, this list of conditions and the following disclaimer.
15 15 *
16 16 * - Redistributions in binary form must reproduce the above copyright
17 17 * notice, this list of conditions and the following disclaimer in
18 18 * the documentation and/or other materials provided with the
19 19 * distribution.
20 20 *
21 21 * - Neither the name of The Storage Networking Industry Association (SNIA)
22 22 * nor the names of its contributors may be used to endorse or promote
23 23 * products derived from this software without specific prior written
24 24 * permission.
25 25 *
26 26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 27 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
↓ open down ↓ |
27 lines elided |
↑ open up ↑ |
28 28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 29 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
30 30 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 36 * POSSIBILITY OF SUCH DAMAGE.
37 37 */
38 +/* Copyright 2016 Nexenta Systems, Inc. All rights reserved. */
39 +
38 40 #include <sys/errno.h>
39 41 #include <sys/types.h>
42 +#include <syslog.h>
40 43 #include <stdlib.h>
41 44 #include <unistd.h>
42 45 #include <ctype.h>
43 46 #include <sys/byteorder.h>
44 47 #include <sys/scsi/impl/uscsi.h>
45 48 #include <sys/scsi/scsi.h>
46 49 #include <tlm.h>
47 50 #include <pthread.h>
48 51 #include "tlm_proto.h"
49 52
50 53 /*
51 54 * generic routine to read a SCSI page
52 55 */
53 56 int
54 57 read_scsi_page(scsi_link_t *slink, union scsi_cdb *cdb,
55 58 int command_size, caddr_t data, int size)
56 59 {
57 60 struct uscsi_cmd uscsi_cmd;
58 61 char *dname;
59 62 int dev;
60 63
61 64 if (slink == 0 || slink->sl_sa == 0)
62 65 return (EINVAL);
63 66
64 67 (void) memset(&uscsi_cmd, 0, sizeof (uscsi_cmd));
65 68
66 69 /* Lun is in the 5th bit */
67 70 cdb->scc_lun = slink->sl_lun;
68 71 uscsi_cmd.uscsi_flags |= USCSI_READ | USCSI_ISOLATE;
69 72 uscsi_cmd.uscsi_bufaddr = data;
70 73 uscsi_cmd.uscsi_buflen = size;
71 74 uscsi_cmd.uscsi_timeout = 1000;
72 75 uscsi_cmd.uscsi_cdb = (char *)cdb;
73 76
|
↓ open down ↓ |
24 lines elided |
↑ open up ↑ |
74 77 if (cdb->scc_cmd == SCMD_READ_ELEMENT_STATUS) {
75 78 uscsi_cmd.uscsi_flags |= USCSI_RQENABLE;
76 79 uscsi_cmd.uscsi_rqbuf = data;
77 80 uscsi_cmd.uscsi_rqlen = size;
78 81 }
79 82 uscsi_cmd.uscsi_cdblen = command_size;
80 83
81 84 dname = sasd_slink_name(slink);
82 85 dev = open(dname, O_RDWR | O_NDELAY);
83 86 if (dev == -1) {
84 - NDMP_LOG(LOG_DEBUG, "Open failed for %s err=%d",
87 + syslog(LOG_DEBUG, "Open failed for %s err=%d",
85 88 dname, errno);
86 89 return (errno);
87 90 }
88 91 if (tlm_ioctl(dev, USCSICMD, &uscsi_cmd) < 0) {
89 - NDMP_LOG(LOG_DEBUG, "SCSI cmd %d failed for %s err=%d",
92 + syslog(LOG_DEBUG, "SCSI cmd %d failed for %s err=%d",
90 93 cdb->scc_cmd, dname, errno);
91 94 (void) close(dev);
92 95 return (errno);
93 96 }
94 97 (void) close(dev);
95 98 return (uscsi_cmd.uscsi_status);
96 99 }
97 100
98 101 /*
99 102 * Read the Inquiry Page.
100 103 */
101 104 static int
102 105 read_inquiry_page(scsi_link_t *slink, struct scsi_inquiry *inq)
103 106 {
104 107 union scsi_cdb cdb;
105 108
106 109 (void) memset(&cdb, 0, sizeof (union scsi_cdb));
107 110 cdb.scc_cmd = SCMD_INQUIRY;
108 111 cdb.g0_count0 = sizeof (struct scsi_inquiry);
109 112
110 113 return (read_scsi_page(slink, &cdb, CDB_GROUP0,
111 114 (caddr_t)inq, sizeof (*inq)) ? -1 : 0);
112 115 }
113 116
114 117 /*
115 118 * Read the Product Data Page.
116 119 */
117 120 static int
118 121 read_data_page(scsi_link_t *slink, int pcode, char *snum, int size)
119 122 {
120 123 char cmd[CDB_GROUP0];
121 124
122 125 (void) memset(cmd, 0, sizeof (cmd));
123 126
124 127 cmd[0] = SCMD_INQUIRY;
125 128 cmd[1] = pcode ? 0x01 : 0x00;
126 129 cmd[2] = pcode;
127 130 cmd[4] = size;
128 131
129 132 /* LINTED improper alignment */
130 133 return (read_scsi_page(slink, (union scsi_cdb *)&cmd, CDB_GROUP0,
131 134 (caddr_t)snum, size) == -1 ? -1 : 0);
132 135 }
133 136
134 137
135 138 /*
136 139 * Read the Serial Number Page.
137 140 */
138 141 static int
139 142 read_serial_num_page(scsi_link_t *slink, char *snum, int size)
140 143 {
141 144 scsi_serial_t serial;
142 145 int rv;
143 146
144 147 (void) memset(&serial, 0, sizeof (scsi_serial_t));
145 148 rv = read_data_page(slink, SCSI_SERIAL_PAGE, (caddr_t)&serial,
146 149 sizeof (scsi_serial_t));
147 150 (void) strlcpy(snum, serial.sr_num, size);
148 151
149 152 return (rv == -1 ? -1 : 0);
150 153 }
151 154
152 155
153 156 /*
154 157 * Read the Device Name Page.
155 158 */
156 159 static int
157 160 read_dev_name_page(scsi_link_t *slink, device_ident_header_t *devp, int len)
158 161 {
159 162 (void) memset(devp, 0, len);
160 163
161 164 if (read_data_page(slink, SCSI_DEVICE_IDENT_PAGE, (caddr_t)devp,
162 165 len) == -1)
163 166 return (-1);
164 167
165 168 if (devp->di_page_code != SCSI_DEVICE_IDENT_PAGE)
166 169 return (-1);
167 170
168 171 return (0);
169 172 }
170 173
171 174 /*
172 175 * Formatted print of WWN
173 176 */
174 177 static void
175 178 snprintf_wwn(char *buf, int size, uint8_t *wwn)
176 179 {
177 180 if (wwn == NULL || buf == NULL)
178 181 return;
179 182
180 183 (void) snprintf(buf, size, "0x%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X",
181 184 wwn[0], wwn[1], wwn[2], wwn[3], wwn[4], wwn[5], wwn[6], wwn[7]);
182 185 }
183 186
184 187
185 188 /*
186 189 * Extract and print the world wide name (WWN)
187 190 */
188 191 int
189 192 read_device_wwn(scsi_link_t *slink, char *wwnp, int wsize)
190 193 {
191 194 device_ident_header_t *header;
192 195 name_ident_t *ident;
193 196 uint16_t page_len = sizeof (device_ident_header_t);
194 197 uint16_t act_len;
195 198 int accessed;
196 199 uint8_t *designator_data;
197 200
198 201 (void) memset(wwnp, 0, wsize);
199 202 resize:
200 203 header = malloc(page_len);
201 204 if (header == NULL)
202 205 return (-1);
203 206
204 207 if (read_dev_name_page(slink, header, page_len) == -1) {
205 208 free(header);
206 209 return (-1);
207 210 }
208 211
209 212 act_len = BE_16(header->di_page_length);
210 213 if (act_len > page_len) {
211 214 free(header);
212 215 page_len = act_len;
213 216 goto resize;
214 217 }
215 218
216 219 ident = (name_ident_t *)&header[1];
217 220 accessed = sizeof (device_ident_header_t);
218 221
219 222 while (accessed < act_len) {
220 223
221 224 accessed += sizeof (name_ident_t);
222 225 accessed += ident->ni_ident_length;
223 226 designator_data = (uint8_t *)&ident[1];
224 227 /*
225 228 * Looking for code set 1 (Binary) ident type NAA 64 bit
226 229 * address that is associated with the node (0).
227 230 */
228 231 if ((ident->ni_code_set == 1) &&
229 232 (ident->ni_ident_type == 3)) {
230 233 snprintf_wwn(wwnp, wsize, designator_data);
231 234 /*
232 235 * If assc is zero (Node) this is the one we want.
233 236 * If we find that we're done.
234 237 */
235 238 if (ident->ni_asso == 0)
236 239 break;
237 240 }
238 241 /*
239 242 * If we find a EUI-64 we can use that also.
240 243 */
241 244 if ((ident->ni_code_set == 2) &&
242 245 (ident->ni_ident_type == 1) &&
243 246 (ident->ni_asso == 0) &&
244 247 (isprint(wwnp[0] == 0))) { /* Don't overwrite */
245 248 /*
246 249 * This isn't our first choice but we'll print it
247 250 * in case there is nothing else to use.
248 251 */
249 252 (void) snprintf(wwnp, wsize, "%.*s",
250 253 ident->ni_ident_length, designator_data);
251 254 }
252 255 ident =
253 256 (name_ident_t *)&designator_data[ident->ni_ident_length];
254 257 }
255 258 free(header);
256 259 /*
257 260 * See if we found something.
258 261 * Memset above would leave wwnp not printable.
259 262 */
260 263 if (isprint(wwnp[0]))
261 264 return (0);
262 265 return (-1);
263 266 }
264 267
265 268 /*
|
↓ open down ↓ |
166 lines elided |
↑ open up ↑ |
266 269 * Add the tape library call back function (used while scanning the bus)
267 270 */
268 271 static int
269 272 add_lib(scsi_link_t *slink, struct scsi_inquiry *sd, void *arg)
270 273 {
271 274 int l;
272 275 int *nlp; /* pointer to library counter */
273 276 sasd_drive_t *ssd;
274 277
275 278 if (!slink || !sd) {
276 - NDMP_LOG(LOG_DEBUG, "Invalid argument %x %x %x",
279 + syslog(LOG_DEBUG, "Invalid argument %x %x %x",
277 280 slink, sd, arg);
278 281 return (-TLM_INVALID);
279 282 }
280 283
281 284 if (sd->inq_dtype == DTYPE_CHANGER) {
282 285 /* This is a robot, which means this is also a library */
283 286 nlp = (int *)arg;
284 287 (*nlp)++;
285 288 l = tlm_insert_new_library(slink);
286 289 tlm_enable_barcode(l);
287 290
288 - NDMP_LOG(LOG_DEBUG, "lib %d sid %d lun %d",
291 + syslog(LOG_DEBUG, "lib %d sid %d lun %d",
289 292 l, slink->sl_sid, slink->sl_lun);
290 293
291 294 if ((ssd = sasd_slink_drive(slink)) != NULL) {
292 295 (void) strlcpy(ssd->sd_vendor, sd->inq_vid,
293 296 sizeof (ssd->sd_vendor));
294 297 (void) strlcpy(ssd->sd_id, sd->inq_pid,
295 298 sizeof (ssd->sd_id));
296 299 (void) strlcpy(ssd->sd_rev, sd->inq_revision,
297 300 sizeof (ssd->sd_rev));
298 301 (void) read_serial_num_page(slink, ssd->sd_serial,
299 302 sizeof (ssd->sd_serial));
300 303 (void) read_device_wwn(slink, ssd->sd_wwn,
301 304 sizeof (ssd->sd_wwn));
302 305 }
303 306 }
304 307
305 308 return (TLM_NO_ERRORS);
306 309 }
307 310
|
↓ open down ↓ |
9 lines elided |
↑ open up ↑ |
308 311 /*
309 312 * Create some virutal slots
310 313 */
311 314 static int
312 315 make_virtual_slot(int l, tlm_drive_t *dp)
313 316 {
314 317 int s;
315 318 tlm_slot_t *sp;
316 319
317 320 if (l <= 0 || !dp) {
318 - NDMP_LOG(LOG_DEBUG, "Invalid argument %d, %x", l, dp);
321 + syslog(LOG_DEBUG, "Invalid argument %d, %x", l, dp);
319 322 return (-TLM_INVALID);
320 323 }
321 324
322 325 if ((s = tlm_insert_new_slot(l)) <= 0)
323 326 return (-TLM_NO_MEMORY);
324 327
325 328 if (!(sp = tlm_slot(l, s))) {
326 - NDMP_LOG(LOG_DEBUG, "Internal error: slot not found %d", s);
329 + syslog(LOG_DEBUG, "Internal error: slot not found %d", s);
327 330 return (-TLM_ERROR_INTERNAL);
328 331 }
329 332 /*
330 333 * For virtual slots element number is 0 and they are always full.
331 334 */
332 335 sp->ts_element = 0;
333 336 sp->ts_status_full = TRUE;
334 337 return (TLM_NO_ERRORS);
335 338 }
336 339
337 340 /*
338 341 * Make the tape drive not part of a tape library (stand alone)
339 342 */
340 343 static int
341 344 make_stand_alone_drive(scsi_link_t *slink, int l)
342 345 {
343 346 int d;
344 347 tlm_drive_t *dp;
345 348
346 349 if (!slink || l <= 0) {
347 - NDMP_LOG(LOG_DEBUG, "Invalid argument %x %d", slink, l);
350 + syslog(LOG_DEBUG, "Invalid argument %x %d", slink, l);
348 351 return (-TLM_INVALID);
349 352 }
350 353
351 354 d = tlm_insert_new_drive(l);
352 355 if (!(dp = tlm_drive(l, d))) {
353 - NDMP_LOG(LOG_DEBUG, "Internal error: drive not found %d", d);
356 + syslog(LOG_DEBUG, "Internal error: drive not found %d", d);
354 357 return (-TLM_ERROR_INTERNAL);
355 358 }
356 359
357 360 /* For stand-alone drives, the element number is the drive number. */
358 361 dp->td_element = d;
359 362 dp->td_slink = slink;
360 363 dp->td_scsi_id = slink->sl_sid;
361 364 dp->td_lun = slink->sl_lun;
362 365 dp->td_exists = TRUE;
363 366
364 367 /*
365 368 * Note: There is no way to remove library elements. We cannot clean
366 369 * up if make_virtual_slot() fails.
367 370 */
368 371 (void) make_virtual_slot(l, dp);
369 372 return (d);
370 373 }
371 374
372 375 /*
373 376 * Find the LIBRARY structure that has control of this DRIVE.
374 377 */
375 378 static int
376 379 new_drive(scsi_link_t *slink, int *lib)
377 380 {
378 381 int d;
379 382 tlm_drive_t *dp;
380 383 tlm_library_t *lp;
381 384
382 385 /* Walk through all libraries. */
383 386 for (*lib = 1; *lib <= tlm_library_count(); (*lib)++) {
384 387 if (!(lp = tlm_library(*lib)))
385 388 continue;
386 389 /* Walk through drives that are already found. */
387 390 for (d = 1; d <= lp->tl_drive_count; d++) {
388 391 if (!(dp = tlm_drive(*lib, d)))
389 392 continue;
390 393 if (dp->td_scsi_id == slink->sl_sid &&
391 394 dp->td_lun == slink->sl_lun)
392 395 return (d);
393 396 }
394 397 }
395 398
396 399 /* Not part of any library, this is a newly found tape drive. */
397 400 return (0);
398 401 }
399 402
400 403
401 404 /*
402 405 * Add the tape library call back function (used while scanning the bus)
403 406 */
|
↓ open down ↓ |
40 lines elided |
↑ open up ↑ |
404 407 static int
405 408 add_drv(scsi_link_t *slink, struct scsi_inquiry *sd, void *arg)
406 409 {
407 410 int l, d;
408 411 int *vlp; /* pointer to virtual library number */
409 412 sasd_drive_t *ssd;
410 413 tlm_library_t *library;
411 414 tlm_drive_t *drive;
412 415
413 416 if (!slink || !sd) {
414 - NDMP_LOG(LOG_DEBUG, "Invalid argument %x %x %x",
417 + syslog(LOG_DEBUG, "Invalid argument %x %x %x",
415 418 slink, sd, arg);
416 419 return (-TLM_INVALID);
417 420 }
418 421
419 422 if (sd->inq_dtype == DTYPE_SEQUENTIAL) {
420 423 vlp = (int *)arg;
421 424 d = new_drive(slink, &l);
422 425 if (d == 0) {
423 426 /* This tape drive was not found inside any robot. */
424 427 if (*vlp == 0) {
425 428 /*
426 429 * First, create a virtual library if it's not
427 430 * done yet.
|
↓ open down ↓ |
3 lines elided |
↑ open up ↑ |
428 431 */
429 432 *vlp = tlm_insert_new_library(slink);
430 433 if ((library = tlm_library(*vlp)) != NULL)
431 434 library->tl_capability_robot = FALSE;
432 435 }
433 436 if ((d = make_stand_alone_drive(slink, *vlp)) < 0) {
434 437 /* sorry, we can not clean up the vlib now * */
435 438 return (-TLM_INVALID);
436 439 }
437 440 l = *vlp;
438 - NDMP_LOG(LOG_DEBUG, "vlib(%d, %d) sid %d lun %d",
441 + syslog(LOG_DEBUG, "vlib(%d, %d) sid %d lun %d",
439 442 l, d, slink->sl_sid, slink->sl_lun);
440 443 } else
441 - NDMP_LOG(LOG_DEBUG, "(%d, %d) sid %d lun %d",
444 + syslog(LOG_DEBUG, "(%d, %d) sid %d lun %d",
442 445 l, d, slink->sl_sid, slink->sl_lun);
443 446
444 447 if ((drive = tlm_drive(l, d)) != NULL) {
445 448 drive->td_exists = TRUE;
446 449 drive->td_slink = slink;
447 450 }
448 451 if ((ssd = sasd_slink_drive(slink)) != NULL) {
449 452 (void) strlcpy(ssd->sd_vendor,
450 453 sd->inq_vid, sizeof (ssd->sd_vendor));
451 454 (void) strlcpy(ssd->sd_id, sd->inq_pid,
452 455 sizeof (ssd->sd_id));
453 456 (void) strlcpy(ssd->sd_rev, sd->inq_revision,
454 457 sizeof (ssd->sd_rev));
455 458 (void) read_serial_num_page(slink, ssd->sd_serial,
456 459 sizeof (ssd->sd_serial));
457 460 (void) read_device_wwn(slink, ssd->sd_wwn,
458 461 sizeof (ssd->sd_wwn));
459 462 }
460 463 }
461 464
462 465 return (TLM_NO_ERRORS);
463 466 }
464 467
465 468 /*
466 469 * Scan the specified bus and call the handler function.
467 470 */
468 471 static int
469 472 scan_bus(scsi_adapter_t *sa, int(*hndlr)(), void *args)
470 473 {
471 474 int nerr;
472 475 scsi_link_t *slink;
473 476 struct scsi_inquiry scsi_data;
474 477
475 478 nerr = 0;
476 479 slink = sa->sa_link_head.sl_next;
477 480 for (; slink != &sa->sa_link_head; slink = slink->sl_next) {
478 481 (void) memset(&scsi_data, 0, sizeof (struct scsi_inquiry));
479 482 if (read_inquiry_page(slink, &scsi_data) == -1)
480 483 nerr++;
481 484 else
482 485 if ((*hndlr)(slink, &scsi_data, args) != TLM_NO_ERRORS)
483 486 nerr++;
484 487 }
485 488
486 489 return (nerr);
487 490 }
488 491
489 492 /*
490 493 * Marks the library/slots inaccessible if there are not enough drives
491 494 * available on the library
492 495 */
493 496 static void
494 497 inaccbl_drv_warn(int start, int max)
495 498 {
|
↓ open down ↓ |
44 lines elided |
↑ open up ↑ |
496 499 char *dname;
497 500 int l, d;
498 501 tlm_library_t *lp;
499 502
500 503 for (l = start; l < max; l++) {
501 504 if (!(lp = tlm_library(l)))
502 505 continue;
503 506 if (lp->tl_drive_count <= 0)
504 507 continue;
505 508
506 - NDMP_LOG(LOG_DEBUG,
509 + syslog(LOG_DEBUG,
507 510 "Warning: The following drives are not accessible:");
508 511 for (d = 1; d <= lp->tl_drive_count; d++)
509 512 if (!(dname = tlm_get_tape_name(l, d))) {
510 - NDMP_LOG(LOG_DEBUG,
513 + syslog(LOG_DEBUG,
511 514 "Error getting drive(%d, %d)", l, d);
512 515 } else
513 - NDMP_LOG(LOG_DEBUG, "%s", dname);
516 + syslog(LOG_DEBUG, "%s", dname);
514 517
515 518 /*
516 519 * Note: Make the slots inaccessible to prevent running
517 520 * discovery on these libraries. The better idea is
518 521 * removing these libraries, but we don't have that
519 522 * feature available now.
520 523 */
521 524 lp->tl_slot_count = 0;
522 525 }
523 526 }
524 527
525 528 /*
526 529 * Initialize the tape library data structure, asks the libraries what
527 530 * equipments they have.
528 531 */
529 532 int
530 533 tlm_init(void)
531 534 {
532 535 static int nlibs; /* number of found libraries */
533 536 int i, nsa;
534 537 int l, vlibs, d;
535 538 int rv;
536 539 scsi_adapter_t *sa;
537 540 tlm_library_t *lp;
538 541 tlm_drive_t *dp;
539 542
540 543 /* Search through all SCSI adapters, look for tape robots. */
541 544 nlibs = 0;
542 545
543 546 /*
544 547 * We probe both changers and tape drives here
545 548 * but later on this needs to be removed as the
|
↓ open down ↓ |
22 lines elided |
↑ open up ↑ |
546 549 * probe will happen somewhere else.
547 550 */
548 551 if (probe_scsi() < 0)
549 552 return (-1);
550 553
551 554 nsa = scsi_get_adapter_count();
552 555 for (i = 0; i < nsa; i++)
553 556 if ((sa = scsi_get_adapter(i)))
554 557 (void) scan_bus(sa, add_lib, (void *)&nlibs);
555 558
556 - NDMP_LOG(LOG_DEBUG, "nlibs %d", nlibs);
557 -
558 559 /* Search through all SCSI adapters, look for tape drives. */
559 560 vlibs = 0;
560 561 for (i = 0; i < nsa; i++)
561 562 if ((sa = scsi_get_adapter(i)))
562 563 (void) scan_bus(sa, add_drv, (void *)&vlibs);
563 564
564 - NDMP_LOG(LOG_DEBUG, "vlibs %d", vlibs);
565 -
566 565 if (nlibs > 0 && vlibs > 0)
567 566 inaccbl_drv_warn(nlibs + 1, vlibs + nlibs + 1);
568 567
569 568 for (l = 1; l <= tlm_library_count(); l++) {
570 569 if (!(lp = tlm_library(l))) {
571 - NDMP_LOG(LOG_DEBUG, "can't find lib %d", l);
570 + syslog(LOG_DEBUG, "can't find lib %d", l);
572 571 continue;
573 572 }
574 573
575 574 /*
576 575 * Make sure all libraries have tape drives.
577 576 */
578 577 if (lp->tl_drive_count == 0)
579 578 continue;
580 579
581 580 /*
582 581 * Make sure all tape drives exist. A drive that is not
583 582 * linked into the SCSI chain will be seen by the library
584 583 * but we cannot talk to it.
585 584 */
586 585 for (d = 1; d <= lp->tl_drive_count; d++) {
587 586 dp = tlm_drive(l, d);
588 587 if (dp && !dp->td_exists) {
589 - NDMP_LOG(LOG_DEBUG, "Ghost drive found %d.%d",
588 + syslog(LOG_DEBUG, "Ghost drive found %d.%d",
590 589 l, d);
591 590 lp->tl_ghost_drives = TRUE;
592 591 continue;
593 592 }
594 593 }
595 594 }
596 595
597 596 if (nlibs > 0)
598 597 rv = (vlibs > 0) ? 0 : nlibs;
599 598 else
600 599 rv = vlibs;
601 600
602 601 return (rv);
603 602 }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX