)]}'
{"nova/virt/xenapi/image/vdi_stream.py":[{"author":{"_account_id":6735,"name":"Bob Ball","email":"bob.ball@citrix.com","username":"bob-ball"},"change_message_id":"c0d121ccb9827e523b893ebb0de14d43a8947782","unresolved":false,"context_lines":[{"line_number":101,"context_line":"        self.instance \u003d instance"},{"line_number":102,"context_line":"        self.task_ref \u003d task_ref"},{"line_number":103,"context_line":"        self.stream \u003d stream"},{"line_number":104,"context_line":"        self.vdis \u003d {}"},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"    def start(self):"},{"line_number":107,"context_line":"        with tarfile.open(mode\u003d\"r|gz\", fileobj\u003dself.stream) as tar:"}],"source_content_type":"text/x-python","patch_set":1,"id":"da6ed579_046e43c9","line":104,"updated":"2016-01-18 15:41:26.000000000","message":"I\u0027d prefer to see something generic for caching the stream, e.g. having a stream_cache variable, then when we read the headers, we put the contents into stream cache, then replay stream cache before the rest of the stream.\n\n# Cache the stream where we have to peek forwards, so it can be replayed\nself.stream_cache\u003dNone","commit_id":"aeb5810536e1ac65fe66aba012ef2467852a12e6"},{"author":{"_account_id":17920,"name":"Jianghua Wang","email":"jianghua.wang@citrix.com","username":"wjhfresh"},"change_message_id":"11efaea85f2a9b8e65c7fea16b4a357d6fef834e","unresolved":false,"context_lines":[{"line_number":101,"context_line":"        self.instance \u003d instance"},{"line_number":102,"context_line":"        self.task_ref \u003d task_ref"},{"line_number":103,"context_line":"        self.stream \u003d stream"},{"line_number":104,"context_line":"        self.vdis \u003d {}"},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"    def start(self):"},{"line_number":107,"context_line":"        with tarfile.open(mode\u003d\"r|gz\", fileobj\u003dself.stream) as tar:"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba63e191_af5bcb53","line":104,"in_reply_to":"da6ed579_046e43c9","updated":"2016-01-19 02:44:37.000000000","message":"agree. it\u0027s a good idea.","commit_id":"aeb5810536e1ac65fe66aba012ef2467852a12e6"},{"author":{"_account_id":6735,"name":"Bob Ball","email":"bob.ball@citrix.com","username":"bob-ball"},"change_message_id":"c0d121ccb9827e523b893ebb0de14d43a8947782","unresolved":false,"context_lines":[{"line_number":109,"context_line":"                file_size \u003d vhd.size"},{"line_number":110,"context_line":"                LOG.debug(\"file_name:file_size is %(n)s:%(s)d\","},{"line_number":111,"context_line":"                          {\u0027n\u0027: vhd.name, \u0027s\u0027: vhd.size})"},{"line_number":112,"context_line":"                data \u003d tar.extractfile(vhd)"},{"line_number":113,"context_line":"                (header, virtual_size) \u003d self._get_header(data)"},{"line_number":114,"context_line":"                sr_ref, vdi_ref \u003d self._createVDI("},{"line_number":115,"context_line":"                    self.session, self.instance, virtual_size)"}],"source_content_type":"text/x-python","patch_set":1,"id":"da6ed579_e46d2f9a","line":112,"updated":"2016-01-18 15:41:26.000000000","message":"Does this extract the whole file into memory?  I\u0027m really hoping that it does not, since we must stream this rather than read into memory/disk","commit_id":"aeb5810536e1ac65fe66aba012ef2467852a12e6"},{"author":{"_account_id":17920,"name":"Jianghua Wang","email":"jianghua.wang@citrix.com","username":"wjhfresh"},"change_message_id":"11efaea85f2a9b8e65c7fea16b4a357d6fef834e","unresolved":false,"context_lines":[{"line_number":109,"context_line":"                file_size \u003d vhd.size"},{"line_number":110,"context_line":"                LOG.debug(\"file_name:file_size is %(n)s:%(s)d\","},{"line_number":111,"context_line":"                          {\u0027n\u0027: vhd.name, \u0027s\u0027: vhd.size})"},{"line_number":112,"context_line":"                data \u003d tar.extractfile(vhd)"},{"line_number":113,"context_line":"                (header, virtual_size) \u003d self._get_header(data)"},{"line_number":114,"context_line":"                sr_ref, vdi_ref \u003d self._createVDI("},{"line_number":115,"context_line":"                    self.session, self.instance, virtual_size)"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba63e191_811a5b16","line":112,"in_reply_to":"da6ed579_e46d2f9a","updated":"2016-01-19 02:44:37.000000000","message":"I believe it does not. Per tarfile source code, it only returns the  fileobj which is constructed from tarfile\u0027s fileobj and tarinfo.size. tarfile.fileobj supply the data stream and tarinfo.size tells where is the end of a tar file. So it doesn\u0027t do any exact operation. I will rename this variable from data to tarfile_obj to avoid the miss-understanding.","commit_id":"aeb5810536e1ac65fe66aba012ef2467852a12e6"},{"author":{"_account_id":6735,"name":"Bob Ball","email":"bob.ball@citrix.com","username":"bob-ball"},"change_message_id":"c0d121ccb9827e523b893ebb0de14d43a8947782","unresolved":false,"context_lines":[{"line_number":116,"context_line":"                self._vhd_stream_to_vdi(vdi_ref, header, data, file_size)"},{"line_number":117,"context_line":"                vdi_uuid \u003d self.session.call_xenapi(\u0027VDI.get_uuid\u0027, vdi_ref)"},{"line_number":118,"context_line":"                if vhd.name \u003d\u003d \u00270.vhd\u0027:"},{"line_number":119,"context_line":"                    self.vdis[\u0027root\u0027] \u003d dict(uuid\u003dvdi_uuid)"},{"line_number":120,"context_line":"                else:"},{"line_number":121,"context_line":"                    self.vdis[vhd.name] \u003d dict(uuid\u003dvdi_uuid)"},{"line_number":122,"context_line":"        self.stream.close()"}],"source_content_type":"text/x-python","patch_set":1,"id":"da6ed579_a49ad76c","line":119,"updated":"2016-01-18 15:41:26.000000000","message":"Why use a special name here?  Looks like this code is trying to add the start of the multi-file streaming?","commit_id":"aeb5810536e1ac65fe66aba012ef2467852a12e6"},{"author":{"_account_id":17920,"name":"Jianghua Wang","email":"jianghua.wang@citrix.com","username":"wjhfresh"},"change_message_id":"11efaea85f2a9b8e65c7fea16b4a357d6fef834e","unresolved":false,"context_lines":[{"line_number":116,"context_line":"                self._vhd_stream_to_vdi(vdi_ref, header, data, file_size)"},{"line_number":117,"context_line":"                vdi_uuid \u003d self.session.call_xenapi(\u0027VDI.get_uuid\u0027, vdi_ref)"},{"line_number":118,"context_line":"                if vhd.name \u003d\u003d \u00270.vhd\u0027:"},{"line_number":119,"context_line":"                    self.vdis[\u0027root\u0027] \u003d dict(uuid\u003dvdi_uuid)"},{"line_number":120,"context_line":"                else:"},{"line_number":121,"context_line":"                    self.vdis[vhd.name] \u003d dict(uuid\u003dvdi_uuid)"},{"line_number":122,"context_line":"        self.stream.close()"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba63e191_81f25b99","line":119,"in_reply_to":"da6ed579_a49ad76c","updated":"2016-01-19 02:44:37.000000000","message":"this part need to be changed to support multiple-files. I didn\u0027t have a clear view about how to handle the chain when coding this. So just made it to work for single file but kept the logical for multiple VDIs. In the new version, I will change it to return dict(root\u003ddict(uuid\u003dleaf_vhd_uuid)) and make the chain for the multiple files.","commit_id":"aeb5810536e1ac65fe66aba012ef2467852a12e6"},{"author":{"_account_id":6735,"name":"Bob Ball","email":"bob.ball@citrix.com","username":"bob-ball"},"change_message_id":"c0d121ccb9827e523b893ebb0de14d43a8947782","unresolved":false,"context_lines":[{"line_number":121,"context_line":"                    self.vdis[vhd.name] \u003d dict(uuid\u003dvdi_uuid)"},{"line_number":122,"context_line":"        self.stream.close()"},{"line_number":123,"context_line":""},{"line_number":124,"context_line":"    def _get_header(self, fileobj):"},{"line_number":125,"context_line":"        header \u003d fileobj.read(512)"},{"line_number":126,"context_line":"        fmt \u003d \u0027!Q\u0027"},{"line_number":127,"context_line":"        (virtual_size, ) \u003d struct.unpack(fmt, header[48:56])"}],"source_content_type":"text/x-python","patch_set":1,"id":"da6ed579_64b93fcb","line":124,"updated":"2016-01-18 15:41:26.000000000","message":"We will need a comment with reference to the VHD spec and an explanation of which bytes are being read here in the funal version.","commit_id":"aeb5810536e1ac65fe66aba012ef2467852a12e6"},{"author":{"_account_id":17920,"name":"Jianghua Wang","email":"jianghua.wang@citrix.com","username":"wjhfresh"},"change_message_id":"11efaea85f2a9b8e65c7fea16b4a357d6fef834e","unresolved":false,"context_lines":[{"line_number":121,"context_line":"                    self.vdis[vhd.name] \u003d dict(uuid\u003dvdi_uuid)"},{"line_number":122,"context_line":"        self.stream.close()"},{"line_number":123,"context_line":""},{"line_number":124,"context_line":"    def _get_header(self, fileobj):"},{"line_number":125,"context_line":"        header \u003d fileobj.read(512)"},{"line_number":126,"context_line":"        fmt \u003d \u0027!Q\u0027"},{"line_number":127,"context_line":"        (virtual_size, ) \u003d struct.unpack(fmt, header[48:56])"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba63e191_61308757","line":124,"in_reply_to":"da6ed579_64b93fcb","updated":"2016-01-19 02:44:37.000000000","message":"sure. Will add it in the next version.","commit_id":"aeb5810536e1ac65fe66aba012ef2467852a12e6"},{"author":{"_account_id":6735,"name":"Bob Ball","email":"bob.ball@citrix.com","username":"bob-ball"},"change_message_id":"c0d121ccb9827e523b893ebb0de14d43a8947782","unresolved":false,"context_lines":[{"line_number":156,"context_line":""},{"line_number":157,"context_line":"        try:"},{"line_number":158,"context_line":"            conn.request(\u0027PUT\u0027, vdi_import_path, headers\u003dheaders)"},{"line_number":159,"context_line":"            conn.send(header)"},{"line_number":160,"context_line":"            # size_total \u003d len(header)"},{"line_number":161,"context_line":"            # while data_size \u003e size_total:"},{"line_number":162,"context_line":"            #    trunk \u003d data.read(114800)"}],"source_content_type":"text/x-python","patch_set":1,"id":"da6ed579_a48bb767","line":159,"updated":"2016-01-18 15:41:26.000000000","message":"This would then send the cached part of the stream first, followed by data","commit_id":"aeb5810536e1ac65fe66aba012ef2467852a12e6"},{"author":{"_account_id":17920,"name":"Jianghua Wang","email":"jianghua.wang@citrix.com","username":"wjhfresh"},"change_message_id":"11efaea85f2a9b8e65c7fea16b4a357d6fef834e","unresolved":false,"context_lines":[{"line_number":156,"context_line":""},{"line_number":157,"context_line":"        try:"},{"line_number":158,"context_line":"            conn.request(\u0027PUT\u0027, vdi_import_path, headers\u003dheaders)"},{"line_number":159,"context_line":"            conn.send(header)"},{"line_number":160,"context_line":"            # size_total \u003d len(header)"},{"line_number":161,"context_line":"            # while data_size \u003e size_total:"},{"line_number":162,"context_line":"            #    trunk \u003d data.read(114800)"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba63e191_213a8f37","line":159,"in_reply_to":"da6ed579_a48bb767","updated":"2016-01-19 02:44:37.000000000","message":"Agree. Will do it.","commit_id":"aeb5810536e1ac65fe66aba012ef2467852a12e6"},{"author":{"_account_id":17920,"name":"Jianghua Wang","email":"jianghua.wang@citrix.com","username":"wjhfresh"},"change_message_id":"8c0eb039cb2a4bbdfb4a4687e2ff9bd98f829590","unresolved":false,"context_lines":[{"line_number":157,"context_line":"        try:"},{"line_number":158,"context_line":"            conn.request(\u0027PUT\u0027, vdi_import_path, headers\u003dheaders)"},{"line_number":159,"context_line":"            conn.send(header)"},{"line_number":160,"context_line":"            # size_total \u003d len(header)"},{"line_number":161,"context_line":"            # while data_size \u003e size_total:"},{"line_number":162,"context_line":"            #    trunk \u003d data.read(114800)"},{"line_number":163,"context_line":"            #    size_total +\u003d len(trunk)"}],"source_content_type":"text/x-python","patch_set":1,"id":"da6ed579_2e9d6659","line":160,"updated":"2016-01-13 04:03:59.000000000","message":"Will remove these comment lines in the formal review.","commit_id":"aeb5810536e1ac65fe66aba012ef2467852a12e6"},{"author":{"_account_id":6735,"name":"Bob Ball","email":"bob.ball@citrix.com","username":"bob-ball"},"change_message_id":"3e6c91f2ff68ea027c54772570ce14203171ae7e","unresolved":false,"context_lines":[{"line_number":182,"context_line":"        stream.close()"},{"line_number":183,"context_line":""},{"line_number":184,"context_line":"    def get_vdi_size(self, conn_resp):"},{"line_number":185,"context_line":"        \u0027\u0027\u0027the exported VHD should be a \"Dynamic Hard Disk Image\"."},{"line_number":186,"context_line":"         https://www.microsoft.com/en-us/download/confirmation.aspx?id\u003d23850"},{"line_number":187,"context_line":"         \"Virtual Hard Disk Image Format Specification\""},{"line_number":188,"context_line":"         The Dynamic Hard Disk Image format is as below:"}],"source_content_type":"text/x-python","patch_set":3,"id":"9a68dd71_005d4a46","line":185,"updated":"2016-01-25 12:56:19.000000000","message":"We should raise an exception if it\u0027s not a dynamid HD image","commit_id":"91787b8e78033751190fd6dc3e94175dd602772f"},{"author":{"_account_id":6735,"name":"Bob Ball","email":"bob.ball@citrix.com","username":"bob-ball"},"change_message_id":"3e6c91f2ff68ea027c54772570ce14203171ae7e","unresolved":false,"context_lines":[{"line_number":219,"context_line":"        FOOTER_SIZE \u003d 512"},{"line_number":220,"context_line":"        DYN_DISK_HEADER \u003d 1024"},{"line_number":221,"context_line":"        BAT_ENT_LEN \u003d 4"},{"line_number":222,"context_line":"        layout \u003d {\u0027bat_offset\u0027:"},{"line_number":223,"context_line":"                      {\u0027offset\u0027: FOOTER_SIZE + 16, \u0027len\u0027: 8},"},{"line_number":224,"context_line":"                  \u0027bat_num\u0027:"},{"line_number":225,"context_line":"                      {\u0027offset\u0027: FOOTER_SIZE + 28, \u0027len\u0027: 4}"}],"source_content_type":"text/x-python","patch_set":3,"id":"9a68dd71_c0a732a5","line":222,"updated":"2016-01-25 12:56:19.000000000","message":"I think this could be clearer; I was getting confused as to what these actually mean.\n\nI suggest using constants - perhaps using something like\nDDH_BAT_OFFSET, DDH_BAT_OFFSET_FORMAT, DDH_BAT_LENGTH, DDH_BAT_LENGTH_FORMAT.\nThis way it\u0027d be clearer that each of these values is part of the dynamic disk header?\n\nI also think it\u0027s better to use a FORMAT as the key and calculate the length based on the format.","commit_id":"91787b8e78033751190fd6dc3e94175dd602772f"},{"author":{"_account_id":6735,"name":"Bob Ball","email":"bob.ball@citrix.com","username":"bob-ball"},"change_message_id":"3e6c91f2ff68ea027c54772570ce14203171ae7e","unresolved":false,"context_lines":[{"line_number":221,"context_line":"        BAT_ENT_LEN \u003d 4"},{"line_number":222,"context_line":"        layout \u003d {\u0027bat_offset\u0027:"},{"line_number":223,"context_line":"                      {\u0027offset\u0027: FOOTER_SIZE + 16, \u0027len\u0027: 8},"},{"line_number":224,"context_line":"                  \u0027bat_num\u0027:"},{"line_number":225,"context_line":"                      {\u0027offset\u0027: FOOTER_SIZE + 28, \u0027len\u0027: 4}"},{"line_number":226,"context_line":"                  }"},{"line_number":227,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"9a68dd71_cb451343","line":224,"range":{"start_line":224,"start_character":19,"end_line":224,"end_character":26},"updated":"2016-01-25 12:56:19.000000000","message":"I don\u0027t understand what bat_num is - from the spec should this be MAX_TABLE_ENTRIES?  Try to re-use terms from the spec.","commit_id":"91787b8e78033751190fd6dc3e94175dd602772f"},{"author":{"_account_id":6735,"name":"Bob Ball","email":"bob.ball@citrix.com","username":"bob-ball"},"change_message_id":"3e6c91f2ff68ea027c54772570ce14203171ae7e","unresolved":false,"context_lines":[{"line_number":238,"context_line":"            self._get_format(layout[\u0027bat_num\u0027][\u0027len\u0027]),"},{"line_number":239,"context_line":"            buf[start: end])"},{"line_number":240,"context_line":""},{"line_number":241,"context_line":"        self.cache +\u003d buf"},{"line_number":242,"context_line":"        read_size \u003d bat_offset + bat_entry_num * BAT_ENT_LEN - len(self.cache)"},{"line_number":243,"context_line":"        # calculate number of the valid BAT entries."},{"line_number":244,"context_line":"        # as the exported VHD file are totally new, all of the valid"}],"source_content_type":"text/x-python","patch_set":3,"id":"9a68dd71_60bd26d7","line":241,"updated":"2016-01-25 12:56:19.000000000","message":"For consistency, this should be immediately after you read from the buffer.","commit_id":"91787b8e78033751190fd6dc3e94175dd602772f"},{"author":{"_account_id":6735,"name":"Bob Ball","email":"bob.ball@citrix.com","username":"bob-ball"},"change_message_id":"3e6c91f2ff68ea027c54772570ce14203171ae7e","unresolved":false,"context_lines":[{"line_number":254,"context_line":"            if value \u003d\u003d 0xFFFFFFFF:"},{"line_number":255,"context_line":"                break"},{"line_number":256,"context_line":"            else:"},{"line_number":257,"context_line":"                bat_valid_ent_num +\u003d 1"},{"line_number":258,"context_line":"        bat_size \u003d bat_entry_num * BAT_ENT_LEN"},{"line_number":259,"context_line":"        if bat_size % 512 !\u003d 0:"},{"line_number":260,"context_line":"            # padding to 512 sector boundary"}],"source_content_type":"text/x-python","patch_set":3,"id":"9a68dd71_2b0e2fe5","line":257,"updated":"2016-01-25 12:56:19.000000000","message":"num_valid_bat_entries would be better","commit_id":"91787b8e78033751190fd6dc3e94175dd602772f"}],"nova/virt/xenapi/vm_utils.py":[{"author":{"_account_id":17920,"name":"Jianghua Wang","email":"jianghua.wang@citrix.com","username":"wjhfresh"},"change_message_id":"8c0eb039cb2a4bbdfb4a4687e2ff9bd98f829590","unresolved":false,"context_lines":[{"line_number":1397,"context_line":"    return bittorrent"},{"line_number":1398,"context_line":""},{"line_number":1399,"context_line":""},{"line_number":1400,"context_line":"def _image_uses_vdistreamstore(context, instance):"},{"line_number":1401,"context_line":"    vdistreamstore \u003d CONF.xenserver.torrent_images.lower()"},{"line_number":1402,"context_line":"    if vdistreamstore \u003d\u003d \u0027true\u0027:"},{"line_number":1403,"context_line":"        return True"}],"source_content_type":"text/x-python","patch_set":1,"id":"da6ed579_ae72b647","line":1400,"updated":"2016-01-13 04:03:59.000000000","message":"Sorry for the mess-up with line 1400 - 1405. I\u0027m using the image_download_handler to choose vdistreamstore. So will remove these lines.","commit_id":"aeb5810536e1ac65fe66aba012ef2467852a12e6"}]}
