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

*** 33,44 **** --- 33,47 ---- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ + /* Copyright 2016 Nexenta Systems, Inc. All rights reserved. */ + #include <sys/errno.h> #include <sys/types.h> + #include <syslog.h> #include <stdlib.h> #include <unistd.h> #include <ctype.h> #include <sys/byteorder.h> #include <sys/scsi/impl/uscsi.h>
*** 79,94 **** uscsi_cmd.uscsi_cdblen = command_size; dname = sasd_slink_name(slink); dev = open(dname, O_RDWR | O_NDELAY); if (dev == -1) { ! NDMP_LOG(LOG_DEBUG, "Open failed for %s err=%d", dname, errno); return (errno); } if (tlm_ioctl(dev, USCSICMD, &uscsi_cmd) < 0) { ! NDMP_LOG(LOG_DEBUG, "SCSI cmd %d failed for %s err=%d", cdb->scc_cmd, dname, errno); (void) close(dev); return (errno); } (void) close(dev); --- 82,97 ---- uscsi_cmd.uscsi_cdblen = command_size; dname = sasd_slink_name(slink); dev = open(dname, O_RDWR | O_NDELAY); if (dev == -1) { ! syslog(LOG_DEBUG, "Open failed for %s err=%d", dname, errno); return (errno); } if (tlm_ioctl(dev, USCSICMD, &uscsi_cmd) < 0) { ! syslog(LOG_DEBUG, "SCSI cmd %d failed for %s err=%d", cdb->scc_cmd, dname, errno); (void) close(dev); return (errno); } (void) close(dev);
*** 271,281 **** int l; int *nlp; /* pointer to library counter */ sasd_drive_t *ssd; if (!slink || !sd) { ! NDMP_LOG(LOG_DEBUG, "Invalid argument %x %x %x", slink, sd, arg); return (-TLM_INVALID); } if (sd->inq_dtype == DTYPE_CHANGER) { --- 274,284 ---- int l; int *nlp; /* pointer to library counter */ sasd_drive_t *ssd; if (!slink || !sd) { ! syslog(LOG_DEBUG, "Invalid argument %x %x %x", slink, sd, arg); return (-TLM_INVALID); } if (sd->inq_dtype == DTYPE_CHANGER) {
*** 283,293 **** nlp = (int *)arg; (*nlp)++; l = tlm_insert_new_library(slink); tlm_enable_barcode(l); ! NDMP_LOG(LOG_DEBUG, "lib %d sid %d lun %d", l, slink->sl_sid, slink->sl_lun); if ((ssd = sasd_slink_drive(slink)) != NULL) { (void) strlcpy(ssd->sd_vendor, sd->inq_vid, sizeof (ssd->sd_vendor)); --- 286,296 ---- nlp = (int *)arg; (*nlp)++; l = tlm_insert_new_library(slink); tlm_enable_barcode(l); ! syslog(LOG_DEBUG, "lib %d sid %d lun %d", l, slink->sl_sid, slink->sl_lun); if ((ssd = sasd_slink_drive(slink)) != NULL) { (void) strlcpy(ssd->sd_vendor, sd->inq_vid, sizeof (ssd->sd_vendor));
*** 313,331 **** { int s; tlm_slot_t *sp; if (l <= 0 || !dp) { ! NDMP_LOG(LOG_DEBUG, "Invalid argument %d, %x", l, dp); return (-TLM_INVALID); } if ((s = tlm_insert_new_slot(l)) <= 0) return (-TLM_NO_MEMORY); if (!(sp = tlm_slot(l, s))) { ! NDMP_LOG(LOG_DEBUG, "Internal error: slot not found %d", s); return (-TLM_ERROR_INTERNAL); } /* * For virtual slots element number is 0 and they are always full. */ --- 316,334 ---- { int s; tlm_slot_t *sp; if (l <= 0 || !dp) { ! syslog(LOG_DEBUG, "Invalid argument %d, %x", l, dp); return (-TLM_INVALID); } if ((s = tlm_insert_new_slot(l)) <= 0) return (-TLM_NO_MEMORY); if (!(sp = tlm_slot(l, s))) { ! syslog(LOG_DEBUG, "Internal error: slot not found %d", s); return (-TLM_ERROR_INTERNAL); } /* * For virtual slots element number is 0 and they are always full. */
*** 342,358 **** { int d; tlm_drive_t *dp; if (!slink || l <= 0) { ! NDMP_LOG(LOG_DEBUG, "Invalid argument %x %d", slink, l); return (-TLM_INVALID); } d = tlm_insert_new_drive(l); if (!(dp = tlm_drive(l, d))) { ! NDMP_LOG(LOG_DEBUG, "Internal error: drive not found %d", d); return (-TLM_ERROR_INTERNAL); } /* For stand-alone drives, the element number is the drive number. */ dp->td_element = d; --- 345,361 ---- { int d; tlm_drive_t *dp; if (!slink || l <= 0) { ! syslog(LOG_DEBUG, "Invalid argument %x %d", slink, l); return (-TLM_INVALID); } d = tlm_insert_new_drive(l); if (!(dp = tlm_drive(l, d))) { ! syslog(LOG_DEBUG, "Internal error: drive not found %d", d); return (-TLM_ERROR_INTERNAL); } /* For stand-alone drives, the element number is the drive number. */ dp->td_element = d;
*** 409,419 **** sasd_drive_t *ssd; tlm_library_t *library; tlm_drive_t *drive; if (!slink || !sd) { ! NDMP_LOG(LOG_DEBUG, "Invalid argument %x %x %x", slink, sd, arg); return (-TLM_INVALID); } if (sd->inq_dtype == DTYPE_SEQUENTIAL) { --- 412,422 ---- sasd_drive_t *ssd; tlm_library_t *library; tlm_drive_t *drive; if (!slink || !sd) { ! syslog(LOG_DEBUG, "Invalid argument %x %x %x", slink, sd, arg); return (-TLM_INVALID); } if (sd->inq_dtype == DTYPE_SEQUENTIAL) {
*** 433,446 **** if ((d = make_stand_alone_drive(slink, *vlp)) < 0) { /* sorry, we can not clean up the vlib now * */ return (-TLM_INVALID); } l = *vlp; ! NDMP_LOG(LOG_DEBUG, "vlib(%d, %d) sid %d lun %d", l, d, slink->sl_sid, slink->sl_lun); } else ! NDMP_LOG(LOG_DEBUG, "(%d, %d) sid %d lun %d", l, d, slink->sl_sid, slink->sl_lun); if ((drive = tlm_drive(l, d)) != NULL) { drive->td_exists = TRUE; drive->td_slink = slink; --- 436,449 ---- if ((d = make_stand_alone_drive(slink, *vlp)) < 0) { /* sorry, we can not clean up the vlib now * */ return (-TLM_INVALID); } l = *vlp; ! syslog(LOG_DEBUG, "vlib(%d, %d) sid %d lun %d", l, d, slink->sl_sid, slink->sl_lun); } else ! syslog(LOG_DEBUG, "(%d, %d) sid %d lun %d", l, d, slink->sl_sid, slink->sl_lun); if ((drive = tlm_drive(l, d)) != NULL) { drive->td_exists = TRUE; drive->td_slink = slink;
*** 501,518 **** if (!(lp = tlm_library(l))) continue; if (lp->tl_drive_count <= 0) continue; ! NDMP_LOG(LOG_DEBUG, "Warning: The following drives are not accessible:"); for (d = 1; d <= lp->tl_drive_count; d++) if (!(dname = tlm_get_tape_name(l, d))) { ! NDMP_LOG(LOG_DEBUG, "Error getting drive(%d, %d)", l, d); } else ! NDMP_LOG(LOG_DEBUG, "%s", dname); /* * Note: Make the slots inaccessible to prevent running * discovery on these libraries. The better idea is * removing these libraries, but we don't have that --- 504,521 ---- if (!(lp = tlm_library(l))) continue; if (lp->tl_drive_count <= 0) continue; ! syslog(LOG_DEBUG, "Warning: The following drives are not accessible:"); for (d = 1; d <= lp->tl_drive_count; d++) if (!(dname = tlm_get_tape_name(l, d))) { ! syslog(LOG_DEBUG, "Error getting drive(%d, %d)", l, d); } else ! syslog(LOG_DEBUG, "%s", dname); /* * Note: Make the slots inaccessible to prevent running * discovery on these libraries. The better idea is * removing these libraries, but we don't have that
*** 551,576 **** nsa = scsi_get_adapter_count(); for (i = 0; i < nsa; i++) if ((sa = scsi_get_adapter(i))) (void) scan_bus(sa, add_lib, (void *)&nlibs); - NDMP_LOG(LOG_DEBUG, "nlibs %d", nlibs); - /* Search through all SCSI adapters, look for tape drives. */ vlibs = 0; for (i = 0; i < nsa; i++) if ((sa = scsi_get_adapter(i))) (void) scan_bus(sa, add_drv, (void *)&vlibs); - NDMP_LOG(LOG_DEBUG, "vlibs %d", vlibs); - if (nlibs > 0 && vlibs > 0) inaccbl_drv_warn(nlibs + 1, vlibs + nlibs + 1); for (l = 1; l <= tlm_library_count(); l++) { if (!(lp = tlm_library(l))) { ! NDMP_LOG(LOG_DEBUG, "can't find lib %d", l); continue; } /* * Make sure all libraries have tape drives. --- 554,575 ---- nsa = scsi_get_adapter_count(); for (i = 0; i < nsa; i++) if ((sa = scsi_get_adapter(i))) (void) scan_bus(sa, add_lib, (void *)&nlibs); /* Search through all SCSI adapters, look for tape drives. */ vlibs = 0; for (i = 0; i < nsa; i++) if ((sa = scsi_get_adapter(i))) (void) scan_bus(sa, add_drv, (void *)&vlibs); if (nlibs > 0 && vlibs > 0) inaccbl_drv_warn(nlibs + 1, vlibs + nlibs + 1); for (l = 1; l <= tlm_library_count(); l++) { if (!(lp = tlm_library(l))) { ! syslog(LOG_DEBUG, "can't find lib %d", l); continue; } /* * Make sure all libraries have tape drives.
*** 584,594 **** * but we cannot talk to it. */ for (d = 1; d <= lp->tl_drive_count; d++) { dp = tlm_drive(l, d); if (dp && !dp->td_exists) { ! NDMP_LOG(LOG_DEBUG, "Ghost drive found %d.%d", l, d); lp->tl_ghost_drives = TRUE; continue; } } --- 583,593 ---- * but we cannot talk to it. */ for (d = 1; d <= lp->tl_drive_count; d++) { dp = tlm_drive(l, d); if (dp && !dp->td_exists) { ! syslog(LOG_DEBUG, "Ghost drive found %d.%d", l, d); lp->tl_ghost_drives = TRUE; continue; } }