Adam Litke has submitted this change and it was merged. Change subject: vm: Introduce Vm._getVolumeSize() method ......................................................................
vm: Introduce Vm._getVolumeSize() method There are too many places calling self.cif.irs.getVolumeSize(), then checking for nonzero res["status"]["code"], raising random exception, or converting returned strings to integer. This patch introduce a new method that: - Raise StorageUnavailableError on nonzero status code, so we don't have to check for errors when we cannot handle them, and we cannot forget. - Return VolumeSize namedtuple with integer values, making the calling code less error prone and nicer to work with. This change reveal one call site that was not checking for getVolumeSize() errors, and could fail with KeyError. Now it will fail with StorageUnavailableError which is more helpful for debugging. Change-Id: I2767cb8d7560b0eb1ad950f0844a8e24347139e4 Signed-off-by: Nir Soffer <[email protected]> Reviewed-on: https://gerrit.ovirt.org/37888 Reviewed-by: Adam Litke <[email protected]> --- M vdsm/virt/vm.py 1 file changed, 41 insertions(+), 49 deletions(-) Approvals: Adam Litke: Looks good to me, approved Nir Soffer: Verified -- To view, visit https://gerrit.ovirt.org/37888 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2767cb8d7560b0eb1ad950f0844a8e24347139e4 Gerrit-PatchSet: 10 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer <[email protected]> Gerrit-Reviewer: Adam Litke <[email protected]> Gerrit-Reviewer: Ala Hino <[email protected]> Gerrit-Reviewer: Allon Mureinik <[email protected]> Gerrit-Reviewer: Candace Sheremeta <[email protected]> Gerrit-Reviewer: Dan Kenigsberg <[email protected]> Gerrit-Reviewer: Federico Simoncelli <[email protected]> Gerrit-Reviewer: Francesco Romani <[email protected]> Gerrit-Reviewer: Nir Soffer <[email protected]> Gerrit-Reviewer: [email protected] Gerrit-Reviewer: oVirt Jenkins CI Server _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
