improve logging readability

This commit is contained in:
Aaron Hurt 2016-07-11 10:49:43 -05:00
parent 44491448e3
commit c8fce3ff31
2 changed files with 13 additions and 4 deletions

View File

@ -1329,7 +1329,8 @@ public class KVMStorageProcessor implements StorageProcessor {
s_logger.info("Snapshot " + snap_full_name + " successfully removed from " +
primaryPool.getType().toString() + " pool.");
} catch (RbdException e) {
s_logger.error(e.toString() + " - " + ErrorCode.getErrorMessage(e.getReturnValue()));
s_logger.error("Failed to remove snapshot " + snap_full_name + ", with exception: " + e.toString() +
", RBD error: " + ErrorCode.getErrorMessage(e.getReturnValue()));
} finally {
rbd.close(image);
r.ioCtxDestroy(io);
@ -1340,13 +1341,15 @@ public class KVMStorageProcessor implements StorageProcessor {
}
return new Answer(cmd, true, "Snapshot " + snap_full_name + " removed successfully.");
} catch (RadosException e) {
s_logger.error(e.toString() + " - " + ErrorCode.getErrorMessage(e.getReturnValue()));
s_logger.error("Failed to remove snapshot " + snap_full_name + ", with exception: " + e.toString() +
", RBD error: " + ErrorCode.getErrorMessage(e.getReturnValue()));
return new Answer(cmd, false, "Failed to remove snapshot " + snap_full_name);
} catch (RbdException e) {
s_logger.error(e.toString() + " - " + ErrorCode.getErrorMessage(e.getReturnValue()));
s_logger.error("Failed to remove snapshot " + snap_full_name + ", with exception: " + e.toString() +
", RBD error: " + ErrorCode.getErrorMessage(e.getReturnValue()));
return new Answer(cmd, false, "Failed to remove snapshot " + snap_full_name);
} catch (Exception e) {
s_logger.error(e.toString());
s_logger.error("Failed to remove snapshot " + snap_full_name + ", with exception: " + e.toString());
return new Answer(cmd, false, "Failed to remove snapshot " + snap_full_name);
}
}

View File

@ -878,6 +878,8 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
s_logger.info("Succesfully unprotected and removed any remaining snapshots (" + snaps.size() + ") of "
+ pool.getSourceDir() + "/" + uuid + " Continuing to remove the RBD image");
} catch (RbdException e) {
s_logger.error("Failed to remove snapshot with exception: " + e.toString() +
", RBD error: " + ErrorCode.getErrorMessage(e.getReturnValue()));
throw new CloudRuntimeException(e.toString() + " - " + ErrorCode.getErrorMessage(e.getReturnValue()));
} finally {
s_logger.debug("Closing image and destroying context");
@ -885,8 +887,12 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
r.ioCtxDestroy(io);
}
} catch (RadosException e) {
s_logger.error("Failed to remove snapshot with exception: " + e.toString() +
", RBD error: " + ErrorCode.getErrorMessage(e.getReturnValue()));
throw new CloudRuntimeException(e.toString() + " - " + ErrorCode.getErrorMessage(e.getReturnValue()));
} catch (RbdException e) {
s_logger.error("Failed to remove snapshot with exception: " + e.toString() +
", RBD error: " + ErrorCode.getErrorMessage(e.getReturnValue()));
throw new CloudRuntimeException(e.toString() + " - " + ErrorCode.getErrorMessage(e.getReturnValue()));
}
}