remove a call path that cause NullPointerException QemuImg.convert expects the arguments not null.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/cfd8056c Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cfd8056c Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cfd8056c Branch: refs/heads/vmsync Commit: cfd8056c142c2ed49252c989b00b00cdbe7850de Parents: 4a563b6 Author: Hiroaki KAWAI <[email protected]> Authored: Tue May 28 20:54:01 2013 +0900 Committer: Hiroaki KAWAI <[email protected]> Committed: Tue May 28 20:54:01 2013 +0900 ---------------------------------------------------------------------- .../kvm/storage/LibvirtStorageAdaptor.java | 16 +++++++------- 1 files changed, 8 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cfd8056c/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 fa2f670..89e22c8 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 @@ -911,20 +911,20 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { Script.runSimpleBashScript("cp -f " + sourcePath + " " + destPath); } else { destFile = new QemuImgFile(destPath, destFormat); + try { + qemu.convert(srcFile, destFile); + } catch (QemuImgException e) { + s_logger.error("Failed to convert " + srcFile.getFileName() + " to " + + destFile.getFileName() + " the error was: " + e.getMessage()); + newDisk = null; + } } } catch (QemuImgException e) { s_logger.error("Failed to fetch the information of file " + srcFile.getFileName() + " the error was: " + e.getMessage()); + newDisk = null; } } - - try { - qemu.convert(srcFile, destFile); - } catch (QemuImgException e) { - s_logger.error("Failed to convert " + srcFile.getFileName() + " to " - + destFile.getFileName() + " the error was: " + e.getMessage()); - } - } else if ((srcPool.getType() != StoragePoolType.RBD) && (destPool.getType() == StoragePoolType.RBD)) { /** * Qemu doesn't support writing to RBD format 2 directly, so we have to write to a temporary RAW file first
