Revision 2f1278d8

b/lib/utils/version.py
137 137

  
138 138
  """
139 139
  return version[0] == current[0] and version[1] == current[1] - 1
140

  
141

  
142
def IsCorrectConfigVersion(targetversion, configversion):
143
  """Decide whether configuration version is compatible with the target.
144

  
145
  @param targetversion: The version to upgrade to as (major, minor, revision)
146
  @type targetversion: tuple
147
  @param configversion: The version of the current configuration
148
  @type configversion: tuple
149
  @rtype: bool
150
  @return: True, if the configversion fits with the target version.
151

  
152
  """
153
  return (configversion[0] == targetversion[0] and
154
          configversion[1] == targetversion[1])
b/test/py/ganeti.utils.version_unittest.py
65 65
        self.assertFalse(version.ShouldCfgdowngrade((2,10,0), current=(3,10,0)))
66 66

  
67 67

  
68
class IsCorrectConfigVersionTest(unittest.TestCase):
69
    def testIsCorrectConfigVersion(self):
70
        self.assertTrue(version.IsCorrectConfigVersion((2,10,1), (2,10,0)))
71
        self.assertFalse(version.IsCorrectConfigVersion((2,11,0), (2,10,0)))
72
        self.assertFalse(version.IsCorrectConfigVersion((3,10,0), (2,10,0)))
73

  
74

  
68 75
if __name__ == "__main__":
69 76
  testutils.GanetiTestProgram()

Also available in: Unified diff