)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"b3dd62ec002d76eabe5f07443b3f7b34bb53d8d6","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"libvirt: refresh info_cache before creating devices metadata"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"In some cases, Physical functions with VLAN are not being reported via the"},{"line_number":10,"context_line":"device\u0027s metadata, since info_cache shows as empty. Refreshing the info_cache"},{"line_number":11,"context_line":"before metadata creation solves the problem."},{"line_number":12,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"5f201791_e3be31fe","line":9,"range":{"start_line":9,"start_character":0,"end_line":9,"end_character":13},"updated":"2017-06-20 21:14:47.000000000","message":"In what cases? The way this is written, it\u0027s going to do a refresh of the info cache, which is a callback through conductor to the database to do a join on the instances_info_cache table. Is there a better way to determine what\u0027s causing this to be missing information in the first place and fix that?\n\nBecause right now this is going to always refresh during spawn, migration/resize, rescue, volume attach and interface attach regardless of whether or not it\u0027s needed, which seems heavy-handed to me. My guess is this is a problem seen only when attaching a port to an existing instance.","commit_id":"632720aa27ce1409865a5548d33bcf83d9d27826"}],"nova/tests/unit/virt/libvirt/test_driver.py":[{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"130a0dbe30ca1a8edc285ca4bcbef8de626d24d3","unresolved":false,"context_lines":[{"line_number":1582,"context_line":"                       return_value\u003dguest),"},{"line_number":1583,"context_line":"            mock.patch.object(nova.virt.libvirt.guest.Guest, \u0027get_xml_desc\u0027,"},{"line_number":1584,"context_line":"                              return_value\u003dxml)):"},{"line_number":1585,"context_line":"            refresh_mock \u003d mock.Mock()"},{"line_number":1586,"context_line":"            instance_ref.info_cache.refresh \u003d refresh_mock"},{"line_number":1587,"context_line":"            metadata_obj \u003d drvr._build_device_metadata(self.context,"},{"line_number":1588,"context_line":"                                                       instance_ref)"},{"line_number":1589,"context_line":"            self.assertTrue(refresh_mock.called)"}],"source_content_type":"text/x-python","patch_set":1,"id":"df140735_3697c893","line":1586,"range":{"start_line":1585,"start_character":0,"end_line":1586,"end_character":58},"updated":"2017-05-29 10:44:26.000000000","message":"Could you format this as a decorator instead?\n\n    mock.patch.object(instance_ref.info_cache, \u0027refresh\u0027)\n\nor similar?","commit_id":"1b8d39d011f78ff34cdd67d7c8f35f26cd0070a1"}],"nova/virt/libvirt/driver.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"b3dd62ec002d76eabe5f07443b3f7b34bb53d8d6","unresolved":false,"context_lines":[{"line_number":1243,"context_line":"            # really important optimization of not calling the database unless"},{"line_number":1244,"context_line":"            # device_metadata has actually changed is done for us by"},{"line_number":1245,"context_line":"            # instance.save()."},{"line_number":1246,"context_line":"            instance.device_metadata \u003d self._build_device_metadata("},{"line_number":1247,"context_line":"                context, instance)"},{"line_number":1248,"context_line":"            instance.save()"},{"line_number":1249,"context_line":"        except Exception:"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f201791_0347ed1f","line":1246,"range":{"start_line":1246,"start_character":44,"end_line":1246,"end_character":66},"updated":"2017-06-20 21:14:47.000000000","message":"We don\u0027t care about refreshing the network info cache when attaching a volume do we?","commit_id":"632720aa27ce1409865a5548d33bcf83d9d27826"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"b3dd62ec002d76eabe5f07443b3f7b34bb53d8d6","unresolved":false,"context_lines":[{"line_number":1423,"context_line":"            # really important optimization of not calling the database unless"},{"line_number":1424,"context_line":"            # device_metadata has actually changed is done for us by"},{"line_number":1425,"context_line":"            # instance.save()."},{"line_number":1426,"context_line":"            instance.device_metadata \u003d self._build_device_metadata("},{"line_number":1427,"context_line":"                context, instance)"},{"line_number":1428,"context_line":"            instance.save()"},{"line_number":1429,"context_line":"        except Exception:"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f201791_23730983","line":1426,"range":{"start_line":1426,"start_character":44,"end_line":1426,"end_character":66},"updated":"2017-06-20 21:14:47.000000000","message":"Is this the case that is the problem? Are we calling driver.attach_interface with a stale info_cache field on the instance? I\u0027m thinking about this patch:\n\nhttps://review.openstack.org/#/c/403568/","commit_id":"632720aa27ce1409865a5548d33bcf83d9d27826"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"e211e446ce216e90e9e84b93bb5c94af38788a00","unresolved":false,"context_lines":[{"line_number":1423,"context_line":"            # really important optimization of not calling the database unless"},{"line_number":1424,"context_line":"            # device_metadata has actually changed is done for us by"},{"line_number":1425,"context_line":"            # instance.save()."},{"line_number":1426,"context_line":"            instance.device_metadata \u003d self._build_device_metadata("},{"line_number":1427,"context_line":"                context, instance)"},{"line_number":1428,"context_line":"            instance.save()"},{"line_number":1429,"context_line":"        except Exception:"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f201791_d25f7c0c","line":1426,"range":{"start_line":1426,"start_character":44,"end_line":1426,"end_character":66},"in_reply_to":"5f201791_23730983","updated":"2017-06-21 02:05:40.000000000","message":"Yeah Kevin Zheng and I sorted out what the issue is in his bug. When attaching a pre-existing port (in this case with a vlan tag) to an instance, allocate_for_instance calls this:\n\nhttps://github.com/openstack/nova/blob/9ed0d611453aee7a27debd773bdbe146510be0ad/nova/network/neutronv2/api.py#L881\n\nThe port_ids and preexisting_port_ids there are going to be the same single-entry list with the ID of the port we\u0027re attaching.\n\nThat\u0027s going to call this:\n\nhttps://github.com/openstack/nova/blob/9ed0d611453aee7a27debd773bdbe146510be0ad/nova/network/base_api.py#L249\n\nThat method in neutronv2 API is going to refresh the instance.info_cache but at that point the port being attached isn\u0027t in there:\n\nhttps://github.com/openstack/nova/blob/9ed0d611453aee7a27debd773bdbe146510be0ad/nova/network/neutronv2/api.py#L1284\n\nThat calls _build_network_info_model with the port_ids and preexisting_port_ids lists which have the same single entry. We return that NetworkInfo list with the single vif for the single port being attached, which is asserted here:\n\nhttps://github.com/openstack/nova/blob/9ed0d611453aee7a27debd773bdbe146510be0ad/nova/compute/manager.py#L5080\n\nThat network_info is passed into driver.attach_interface:\n\nhttps://github.com/openstack/nova/blob/9ed0d611453aee7a27debd773bdbe146510be0ad/nova/compute/manager.py#L5088\n\nSo it should have the vlan tag on it - does it not in your case?","commit_id":"632720aa27ce1409865a5548d33bcf83d9d27826"},{"author":{"_account_id":7730,"name":"Sahid Orentino Ferdjaoui","email":"sahid.ferdjaoui@industrialdiscipline.com","username":"sahid"},"change_message_id":"1042d12ac1ef432e672fc62637f212d381e5ce62","unresolved":false,"context_lines":[{"line_number":7818,"context_line":"        def _get_device_name(bdm):"},{"line_number":7819,"context_line":"            return block_device.strip_dev(bdm.device_name)"},{"line_number":7820,"context_line":""},{"line_number":7821,"context_line":"        if instance.info_cache is not None:"},{"line_number":7822,"context_line":"            instance.info_cache.refresh()"},{"line_number":7823,"context_line":""},{"line_number":7824,"context_line":"        network_info \u003d instance.info_cache.network_info"}],"source_content_type":"text/x-python","patch_set":2,"id":"7f231b9d_716c7a9b","line":7821,"updated":"2017-06-16 08:07:15.000000000","message":"Seems reasonable to be sure of that.","commit_id":"632720aa27ce1409865a5548d33bcf83d9d27826"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"b3dd62ec002d76eabe5f07443b3f7b34bb53d8d6","unresolved":false,"context_lines":[{"line_number":7818,"context_line":"        def _get_device_name(bdm):"},{"line_number":7819,"context_line":"            return block_device.strip_dev(bdm.device_name)"},{"line_number":7820,"context_line":""},{"line_number":7821,"context_line":"        if instance.info_cache is not None:"},{"line_number":7822,"context_line":"            instance.info_cache.refresh()"},{"line_number":7823,"context_line":""},{"line_number":7824,"context_line":"        network_info \u003d instance.info_cache.network_info"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f201791_a3e83916","line":7821,"in_reply_to":"7f231b9d_716c7a9b","updated":"2017-06-20 21:14:47.000000000","message":"Use nova.compute.utils.refresh_info_cache_for_instance()? It\u0027s essentially the same thing, but a utility method used elsewhere, so would be good to be consistent.","commit_id":"632720aa27ce1409865a5548d33bcf83d9d27826"}]}
