improve logging readability
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c8fce3ff Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c8fce3ff Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c8fce3ff Branch: refs/heads/4.9-bountycastle-daan Commit: c8fce3ff31c1437681f1c2b32864eb2d34b66be5 Parents: 4449144 Author: Aaron Hurt <[email protected]> Authored: Mon Jul 11 10:49:43 2016 -0500 Committer: Aaron Hurt <[email protected]> Committed: Mon Jul 11 12:05:06 2016 -0500 ---------------------------------------------------------------------- .../hypervisor/kvm/storage/KVMStorageProcessor.java | 11 +++++++---- .../hypervisor/kvm/storage/LibvirtStorageAdaptor.java | 6 ++++++ 2 files changed, 13 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c8fce3ff/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java ---------------------------------------------------------------------- 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 77cbdd3..29655d1 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); } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c8fce3ff/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java ---------------------------------------------------------------------- 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 5a35973..6e8ba30 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())); } }
