BmapCopy: provide bmap version major and minor numbers
authorArtem Bityutskiy <artem.bityutskiy@intel.com>
Mon, 6 May 2013 10:04:36 +0000 (13:04 +0300)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Mon, 6 May 2013 14:58:51 +0000 (17:58 +0300)
Besides providing the full string version, provide also the major and minor
components of the version as ingegers. This is going to be useful soon.

Change-Id: Id2ae76cd46066ca8b6159e0232a7955de25eb404
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
bmaptools/BmapCopy.py

index 76c28f7..1e9c6f0 100644 (file)
@@ -149,11 +149,12 @@ class BmapCopy:
         self.bmap_version = str(xml.getroot().attrib.get('version'))
 
         # Make sure we support this version
-        major = int(self.bmap_version.split('.', 1)[0])
-        if major > SUPPORTED_BMAP_VERSION:
+        self.bmap_version_major = int(self.bmap_version.split('.', 1)[0])
+        self.bmap_version_minor = int(self.bmap_version.split('.', 1)[1])
+        if self.bmap_version_major > SUPPORTED_BMAP_VERSION:
             raise Error("only bmap format version up to %d is supported, " \
                         "version %d is not supported" \
-                        % (SUPPORTED_BMAP_VERSION, major))
+                        % (SUPPORTED_BMAP_VERSION, self.bmap_version_major))
 
         # Fetch interesting data from the bmap XML file
         self.block_size = int(xml.find("BlockSize").text.strip())
@@ -190,6 +191,8 @@ class BmapCopy:
         self._batch_queue_len = 2
 
         self.bmap_version = None
+        self.bmap_version_major = None
+        self.bmap_version_minor = None
         self.block_size = None
         self.blocks_cnt = None
         self.mapped_cnt = None