Nir Soffer has posted comments on this change.
Change subject: qemuimg: Introduce InvalidOutput exception ......................................................................
Patch Set 3:
(3 comments)
https://gerrit.ovirt.org/#/c/65208/3/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: """ You wan to use class attributes (like java static member):
ecode = 0 stderr = ""
Unlike java, you can access these like an instance attribute:
e = InvalidOutput([], "", "") e.ecode -> 0 e.stderr -> "" Line 72: Line 73: def __init__(self, cmd, stdout, message): Line 74: self.cmd = cmd Line 75: self.ecode = 0
Line 71: """ Line 72: Line 73: def __init__(self, cmd, stdout, message): Line 74: self.cmd = cmd Line 75: self.ecode = 0 This creates an instance variable with constant value for each instance. Line 76: self.stdout = stdout Line 77: self.stderr = "" Line 78: self.message = message Line 79:
Line 73: def __init__(self, cmd, stdout, message): Line 74: self.cmd = cmd Line 75: self.ecode = 0 Line 76: self.stdout = stdout Line 77: self.stderr = "" Same Line 78: self.message = message Line 79: Line 80: def __str__(self): Line 81: return "cmd=%s, stdout=%s, message=%s" % (