Nir Soffer has posted comments on this change.
Change subject: qemuimg: Introduce InvalidOutput exception ......................................................................
Patch Set 1:
(1 comment)
https://gerrit.ovirt.org/#/c/65208/1/lib/vdsm/qemuimg.py File lib/vdsm/qemuimg.py:
Line 67: Line 68: class InvalidOutput(QImgError): Line 69: """ Line 70: Raised when the command output is not valid. Line 71: """ We can do this ugly hack to make sure that no client fail to get ecode and stderr attributes from this subclass:
ecode = 0 stderr = ""
A better design would probably be to inherit from qemuimg.Error, and have two different sub classes, inheriting nothing from the base class.
class Error(Exception): """ Base class for qemuimg errors """
CommandFailed(Error): def __init__(self, msg, cmd, rc, out, err): ...
InvalidOutput(Error): def __init__(self, msg, cmd, out): ...
This require changing callers to check for qemuimg.Error. Line 72: Line 73: def __init__(self, cmd, stdout, message): Line 74: self.cmd = cmd Line 75: self.stdout = stdout