Change in vdsm[master]: vm: Introduce Vm._getVolumeSize() method

alitke at redhat.com alitke at redhat.com
Thu Apr 16 20:39:32 UTC 2015


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 <nsoffer at redhat.com>
Reviewed-on: https://gerrit.ovirt.org/37888
Reviewed-by: Adam Litke <alitke at redhat.com>
---
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 <nsoffer at redhat.com>
Gerrit-Reviewer: Adam Litke <alitke at redhat.com>
Gerrit-Reviewer: Ala Hino <ahino at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Candace Sheremeta <cshereme at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server


More information about the vdsm-patches mailing list