)]}'
{"nova/virt/xenapi/vmops.py":[{"author":{"_account_id":11069,"name":"Corey Wright","email":"undefined+launchpad@pobox.com","username":"coreywright"},"change_message_id":"648b062649cb7eb072064966ffa6ad19a0b157f9","unresolved":false,"context_lines":[{"line_number":2252,"context_line":"            volume_to_sr_uuids \u003d {}"},{"line_number":2253,"context_line":"            for sr_ref in iscsi_sr_refs:"},{"line_number":2254,"context_line":"                sr_uuid \u003d self.session.SR.get_uuid(sr_ref)"},{"line_number":2255,"context_line":"                volume_uuid \u003d None  # pdb device_config or bdi should tell us"},{"line_number":2256,"context_line":"                volume_to_sr_uuids[volume_uuid] \u003d sr_uuid"},{"line_number":2257,"context_line":"            dest_check_data.volume_to_sr_uuids \u003d volume_to_sr_uuids"},{"line_number":2258,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"5a18252c_1ee4b10b","line":2255,"updated":"2016-04-12 00:19:16.000000000","message":"pbd\u0027s device_config gives us the volume id encoded in the target iqn, at least in my environment.\n\n# xe pbd-list sr-uuid\u003dFA15E-D15C-98a64f03-ddad-448e-bc26-b7c44f51bb4f params\u003ddevice-config\ndevice-config (MRO)    : port: 3260; targetIQN: iqn.2010-11.com.rackspace:98a64f03-ddad-448e-bc26-b7c44f51bb4f; target: 10.190.254.73\n\nso does sr\u0027s sm_config (which i prefer as we are already working with a sr).\n\n# xe sr-list uuid\u003dFA15E-D15C-98a64f03-ddad-448e-bc26-b7c44f51bb4f params\u003dsm-config \nsm-config (MRO)    : port: 3260; targetIQN: iqn.2010-11.com.rackspace:98a64f03-ddad-448e-bc26-b7c44f51bb4f; target: 10.190.254.73\n\nbut is that encoding guaranteed across all environments and cinder backend implementations?\n\nif yes, then:\n\nfor sr_ref in iscsi_sr_refs:\n    sr_uuid \u003d self._session.SR.get_uuid(sr_ref)\n    sm_config \u003d self._session.SR.get_sm_config(sr_ref)\n    if \u0027targetIQN\u0027 in sm_config:\n        volume_uuid \u003d sm_config[\u0027targetIQN\u0027].split(\u0027:\u0027)[1]\n\nif no/maybe, then the only guaranteed mapping is to follow the same process as volume-uuid-to-sr-uuid (with a good bit of refactoring in volume_utils.py to support it):\n\nsr_uuids \u003d [self._session.SR.get_uuid(sr_ref)\n            for sr_ref in iscsi_sr_refs]\nvolume_to_sr_uuids \u003d {}\nblock_device_mapping \u003d virt_driver.block_device_info_get_mapping(\n        block_device_info)\nfor volume in block_device_mapping:\n    connection_data \u003d volume[\u0027connection_info\u0027][\u0027data\u0027]\n    (volume_id, host,\n     port, iqn) \u003d volume_utils.parse_volume_info(connection_data)\n    sr_uuid \u003d volume_utils.generate_new_style_sr_uuid(host, port,\n                                                      iqn)\n    if sr_uuid not in sr_uuids:\n        sr_uuid \u003d volume_utils.generate_old_style_sr_uuid(\n                volume_id)\n        if sr_uuid not in sr_uuids:\n            LOG.warning(_LW(\u0027neither new or old style SR UUID found \u0027\n                            \u0027as generated from volume: %s\u0027),\n                        volume_id)\n            continue\n    volume_to_sr_uuids[volume_id] \u003d sr_uuid","commit_id":"a927af5a6e1d85f3b1e9850d94229acaf693feab"},{"author":{"_account_id":6735,"name":"Bob Ball","email":"bob.ball@citrix.com","username":"bob-ball"},"change_message_id":"14845d884b2e6e0c62502b7755aa9934eee50670","unresolved":false,"context_lines":[{"line_number":2252,"context_line":"            volume_to_sr_uuids \u003d {}"},{"line_number":2253,"context_line":"            for sr_ref in iscsi_sr_refs:"},{"line_number":2254,"context_line":"                sr_uuid \u003d self.session.SR.get_uuid(sr_ref)"},{"line_number":2255,"context_line":"                volume_uuid \u003d None  # pdb device_config or bdi should tell us"},{"line_number":2256,"context_line":"                volume_to_sr_uuids[volume_uuid] \u003d sr_uuid"},{"line_number":2257,"context_line":"            dest_check_data.volume_to_sr_uuids \u003d volume_to_sr_uuids"},{"line_number":2258,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"5a18252c_28dde642","line":2255,"in_reply_to":"5a18252c_1ee4b10b","updated":"2016-04-12 07:58:53.000000000","message":"Given the XS implementation only supports iSCSI currently, I think it\u0027s safe to assume that the volume ID is part of the target IQN.  If the implementation changes in future, I think it\u0027s safe to assume it was connected with a new-style name, so we don\u0027t need to pass the UUID through to the remote host.","commit_id":"a927af5a6e1d85f3b1e9850d94229acaf693feab"},{"author":{"_account_id":6735,"name":"Bob Ball","email":"bob.ball@citrix.com","username":"bob-ball"},"change_message_id":"6dfec2158fd88258f743f4c7025e077b94fb7a9f","unresolved":false,"context_lines":[{"line_number":2252,"context_line":"            volume_to_sr_uuids \u003d {}"},{"line_number":2253,"context_line":"            for sr_ref in iscsi_sr_refs:"},{"line_number":2254,"context_line":"                sr_uuid \u003d self.session.SR.get_uuid(sr_ref)"},{"line_number":2255,"context_line":"                volume_uuid \u003d None  # pdb device_config or bdi should tell us"},{"line_number":2256,"context_line":"                volume_to_sr_uuids[volume_uuid] \u003d sr_uuid"},{"line_number":2257,"context_line":"            dest_check_data.volume_to_sr_uuids \u003d volume_to_sr_uuids"},{"line_number":2258,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"5a18252c_625d23e9","line":2255,"in_reply_to":"5a18252c_28dde642","updated":"2016-04-12 15:17:02.000000000","message":"Actually - what I\u0027d suggest is you get the BDM, get the volume_id and mount_point from that, then get the VBD from XAPI using find_vbd_by_number, and trace back from that VBD to the SR (vbd.get_VDI, vdi.get_SR) and get the SR uuid from there.\nI don\u0027t like the suggestion of generating the old+new style UUIDs in this function, since it\u0027s just guessing.\n\nIf we trace through XAPI as suggested above, then it doesn\u0027t matter how many changes we make to the UUID generation code, it will always work since we force whatever UUID is found on the source on to the destination.","commit_id":"a927af5a6e1d85f3b1e9850d94229acaf693feab"},{"author":{"_account_id":11069,"name":"Corey Wright","email":"undefined+launchpad@pobox.com","username":"coreywright"},"change_message_id":"6c1b67c34ef2e51e600971c12fe9b460e9b41bb0","unresolved":false,"context_lines":[{"line_number":2252,"context_line":"            volume_to_sr_uuids \u003d {}"},{"line_number":2253,"context_line":"            for sr_ref in iscsi_sr_refs:"},{"line_number":2254,"context_line":"                sr_uuid \u003d self.session.SR.get_uuid(sr_ref)"},{"line_number":2255,"context_line":"                volume_uuid \u003d None  # pdb device_config or bdi should tell us"},{"line_number":2256,"context_line":"                volume_to_sr_uuids[volume_uuid] \u003d sr_uuid"},{"line_number":2257,"context_line":"            dest_check_data.volume_to_sr_uuids \u003d volume_to_sr_uuids"},{"line_number":2258,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"5a18252c_710f982e","line":2255,"in_reply_to":"5a18252c_625d23e9","updated":"2016-04-13 04:02:56.000000000","message":"@BobBall\n\nthanks for the design / implementation outline!  i have more confidence in this than the two previous approaches i had posted (ie reverse-engineering or brute-forcing the SR UUID).\n\nblock_device_mapping \u003d virt_driver.block_device_info_get_mapping(\n        block_device_info)\nvolume_to_sr_uuids \u003d {}\nfor volume in block_device_mapping:\n    # get volume UUID\n    try:\n        volume_uuid \u003d volume[\u0027connection_info\u0027][\u0027data\u0027][\u0027volume_id\u0027]\n    except KeyError:\n        continue\n    # get SR UUID\n    mount_device \u003d volume[\u0027mount_device\u0027]\n    device_number \u003d volume_utils.get_device_number(mount_device)\n    vbd_ref \u003d volume_utils.find_vbd_by_number(self._session,\n                                              vm_ref,\n                                              device_number)\n    vdi_ref \u003d self._session.VBD.get_VDI(vbd_ref)\n    sr_ref \u003d self._session.VDI.get_SR(vdi_ref)\n    sr_uuid \u003d self._session.SR.get_uuid(sr_ref)\n    # map volume UUID to SR UUID\n    volume_to_sr_uuids[volume_uuid] \u003d sr_uuid","commit_id":"a927af5a6e1d85f3b1e9850d94229acaf693feab"}]}
