From c8fce3ff31c1437681f1c2b32864eb2d34b66be5 Mon Sep 17 00:00:00 2001 From: Aaron Hurt Date: Mon, 11 Jul 2016 10:49:43 -0500 Subject: [PATCH] improve logging readability --- .../hypervisor/kvm/storage/KVMStorageProcessor.java | 11 +++++++---- .../hypervisor/kvm/storage/LibvirtStorageAdaptor.java | 6 ++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java index 77cbdd3a79a..29655d10784 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java @@ -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); } } diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java index 5a35973d618..6e8ba30ea4a 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java @@ -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())); } }