)]}'
{"nova/tests/unit/virt/libvirt/test_driver.py":[{"author":{"_account_id":16366,"name":"Randall Nortman","email":"openstack@nortman.net","username":"rnortman"},"change_message_id":"8e957f52ebed9e9cedb58325e8a423feb94dbed5","unresolved":false,"context_lines":[{"line_number":3343,"context_line":"        self.assertEqual(\u0027127.0.0.1\u0027, console_device.listen_host)"},{"line_number":3344,"context_line":"        # This port number here MUST BE the same as declared above in the"},{"line_number":3345,"context_line":"        # mock. This means \"_create_serial_console_devices\" re-uses the"},{"line_number":3346,"context_line":"        # port numbers of the instance. Again, port exhaustion is bad."},{"line_number":3347,"context_line":"        self.assertEqual(\u002711000\u0027, console_device.listen_port)"},{"line_number":3348,"context_line":"        mock_get_serials.assert_called_once_with(mock_guest)"},{"line_number":3349,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"dae33548_32fc7e3d","line":3346,"updated":"2016-02-18 02:18:01.000000000","message":"This comment is redundant with the one above.  No real need to reiterate this information.","commit_id":"23ec0f82e11d7cdeaee31dad931cd8b3a4ac1d28"},{"author":{"_account_id":13816,"name":"Marco Pavone","email":"marco.pavone@de.ibm.com","username":"pavone"},"change_message_id":"68dab860c1c1d358837727f184254f8a0b096046","unresolved":false,"context_lines":[{"line_number":3343,"context_line":"        self.assertEqual(\u0027127.0.0.1\u0027, console_device.listen_host)"},{"line_number":3344,"context_line":"        # This port number here MUST BE the same as declared above in the"},{"line_number":3345,"context_line":"        # mock. This means \"_create_serial_console_devices\" re-uses the"},{"line_number":3346,"context_line":"        # port numbers of the instance. Again, port exhaustion is bad."},{"line_number":3347,"context_line":"        self.assertEqual(\u002711000\u0027, console_device.listen_port)"},{"line_number":3348,"context_line":"        mock_get_serials.assert_called_once_with(mock_guest)"},{"line_number":3349,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"bae84128_a174d835","line":3346,"in_reply_to":"dae33548_32fc7e3d","updated":"2016-02-23 13:23:00.000000000","message":"I agree the \"port exhaustion\" is emphasized twice here. I slightly rephrazed this in a newer version. But the explanation, how \"_create_serial_console_devices\" is expected to behave (in the different comments) should help a bit when reading this testcase, imho.","commit_id":"23ec0f82e11d7cdeaee31dad931cd8b3a4ac1d28"}],"nova/virt/libvirt/driver.py":[{"author":{"_account_id":16366,"name":"Randall Nortman","email":"openstack@nortman.net","username":"rnortman"},"change_message_id":"8e957f52ebed9e9cedb58325e8a423feb94dbed5","unresolved":false,"context_lines":[{"line_number":4145,"context_line":""},{"line_number":4146,"context_line":"        if CONF.serial_console.enabled:"},{"line_number":4147,"context_line":"            try:"},{"line_number":4148,"context_line":"                # try to re-use the serial connection data from the"},{"line_number":4149,"context_line":"                # instance, if it already exists."},{"line_number":4150,"context_line":"                guest_obj \u003d self._host.get_guest(instance)"},{"line_number":4151,"context_line":"                serials \u003d self._get_serial_ports_from_guest(guest_obj)"}],"source_content_type":"text/x-python","patch_set":4,"id":"dae33548_32e59ea7","line":4148,"updated":"2016-02-18 02:18:01.000000000","message":"Minor nitpick -- capitalize the first letter of the sentence in this comment.","commit_id":"23ec0f82e11d7cdeaee31dad931cd8b3a4ac1d28"},{"author":{"_account_id":13816,"name":"Marco Pavone","email":"marco.pavone@de.ibm.com","username":"pavone"},"change_message_id":"68dab860c1c1d358837727f184254f8a0b096046","unresolved":false,"context_lines":[{"line_number":4145,"context_line":""},{"line_number":4146,"context_line":"        if CONF.serial_console.enabled:"},{"line_number":4147,"context_line":"            try:"},{"line_number":4148,"context_line":"                # try to re-use the serial connection data from the"},{"line_number":4149,"context_line":"                # instance, if it already exists."},{"line_number":4150,"context_line":"                guest_obj \u003d self._host.get_guest(instance)"},{"line_number":4151,"context_line":"                serials \u003d self._get_serial_ports_from_guest(guest_obj)"}],"source_content_type":"text/x-python","patch_set":4,"id":"bae84128_81a8b478","line":4148,"in_reply_to":"dae33548_32e59ea7","updated":"2016-02-23 13:23:00.000000000","message":"Done","commit_id":"23ec0f82e11d7cdeaee31dad931cd8b3a4ac1d28"},{"author":{"_account_id":16366,"name":"Randall Nortman","email":"openstack@nortman.net","username":"rnortman"},"change_message_id":"8e957f52ebed9e9cedb58325e8a423feb94dbed5","unresolved":false,"context_lines":[{"line_number":4160,"context_line":"                    listen_port \u003d serial_console.acquire_port(listen_host)"},{"line_number":4161,"context_line":"                    serials.append((listen_host, listen_port))"},{"line_number":4162,"context_line":""},{"line_number":4163,"context_line":"            for counter, (listen_host, listen_port) in enumerate(serials):"},{"line_number":4164,"context_line":"                if guest_arch in (arch.S390, arch.S390X):"},{"line_number":4165,"context_line":"                    console \u003d vconfig.LibvirtConfigGuestConsole()"},{"line_number":4166,"context_line":"                else:"}],"source_content_type":"text/x-python","patch_set":4,"id":"dae33548_727c46ec","line":4163,"updated":"2016-02-18 02:18:01.000000000","message":"Is there a reason you refactored the logic here to process the ports in two passes, with the first pass building a temporary list which you then iterate over again?  Unless I\u0027m missing something, this is unnecessary and makes the code harder to understand.  (Other than that, though, it does appear to be correct.)","commit_id":"23ec0f82e11d7cdeaee31dad931cd8b3a4ac1d28"},{"author":{"_account_id":13816,"name":"Marco Pavone","email":"marco.pavone@de.ibm.com","username":"pavone"},"change_message_id":"68dab860c1c1d358837727f184254f8a0b096046","unresolved":false,"context_lines":[{"line_number":4160,"context_line":"                    listen_port \u003d serial_console.acquire_port(listen_host)"},{"line_number":4161,"context_line":"                    serials.append((listen_host, listen_port))"},{"line_number":4162,"context_line":""},{"line_number":4163,"context_line":"            for counter, (listen_host, listen_port) in enumerate(serials):"},{"line_number":4164,"context_line":"                if guest_arch in (arch.S390, arch.S390X):"},{"line_number":4165,"context_line":"                    console \u003d vconfig.LibvirtConfigGuestConsole()"},{"line_number":4166,"context_line":"                else:"}],"source_content_type":"text/x-python","patch_set":4,"id":"bae84128_75163c56","line":4163,"in_reply_to":"dae33548_727c46ec","updated":"2016-02-23 13:23:00.000000000","message":"This is slight different from the previous approach with one loop. Now, the acquire_port is only called in the exception case. So the implementation should work best for both cases, where the instance already exists, and where it does not yet exist.","commit_id":"23ec0f82e11d7cdeaee31dad931cd8b3a4ac1d28"},{"author":{"_account_id":20417,"name":"GuoChang Tang","email":"tangguochang@139.com"},"change_message_id":"921699e390d87de31eccf3f649f50d7e1a69327e","unresolved":false,"context_lines":[{"line_number":4190,"context_line":"            try:"},{"line_number":4191,"context_line":"                # Try to re-use the serial connection data from the"},{"line_number":4192,"context_line":"                # instance, if it already exists."},{"line_number":4193,"context_line":"                guest_obj \u003d self._host.get_guest(instance)"},{"line_number":4194,"context_line":"                serials \u003d self._get_serial_ports_from_guest(guest_obj)"},{"line_number":4195,"context_line":"            except exception.InstanceNotFound:"},{"line_number":4196,"context_line":"                # If this is a new instance, create new serial connection"},{"line_number":4197,"context_line":"                # data."}],"source_content_type":"text/x-python","patch_set":6,"id":"5aef4532_2aec7b8e","line":4194,"range":{"start_line":4193,"start_character":16,"end_line":4194,"end_character":70},"updated":"2016-03-09 00:55:23.000000000","message":"what will happen if follow the steps below ?\n1 create a VM when serial_console is disabled.\n2 enable serial_console.\n3 hard reboot the VM.\nwill the VM get serial connection data after hard reboot ?","commit_id":"1f65d64957951df91eec2c7a9202298f84102ecd"},{"author":{"_account_id":11303,"name":"Markus Zoeller (markus_z)","email":"mzoeller@linux.vnet.ibm.com","username":"mzoeller"},"change_message_id":"9f462fc909f4bb787a35dd1c955a0f935654ec17","unresolved":false,"context_lines":[{"line_number":4190,"context_line":"            try:"},{"line_number":4191,"context_line":"                # Try to re-use the serial connection data from the"},{"line_number":4192,"context_line":"                # instance, if it already exists."},{"line_number":4193,"context_line":"                guest_obj \u003d self._host.get_guest(instance)"},{"line_number":4194,"context_line":"                serials \u003d self._get_serial_ports_from_guest(guest_obj)"},{"line_number":4195,"context_line":"            except exception.InstanceNotFound:"},{"line_number":4196,"context_line":"                # If this is a new instance, create new serial connection"},{"line_number":4197,"context_line":"                # data."}],"source_content_type":"text/x-python","patch_set":6,"id":"5aef4532_9c53216b","line":4194,"range":{"start_line":4193,"start_character":16,"end_line":4194,"end_character":70},"in_reply_to":"5aef4532_2aec7b8e","updated":"2016-03-09 10:50:45.000000000","message":"TL;DR: The hard rebooted (new) instance will get a serial console.\n\nLonger explanation:\nIIUC a hard reboot destroys the instance and creates a new one with \nthe same \"display_name\" but a different \"name\". The \"name\" attribute\nis the handle libvirt creates, for example \"instance-00000001\", which\nis templated by the config option \"instance_name_template\" [1]. This\n\"name\" attribute is used when we want to get the libvirt domain from\nthe \"host.py\" module. Below are the interesting parts in the code.\nAs the \"instance.name\" used in the host module will be a different one\nI think the line\n\n    guest_obj \u003d self._host.get_guest(instance)\n\nwill throw an \"InstanceNotFound\" exception and we will create a serial\nconsole for this new instance.\n\nnova/virt/libvirt/driver.py::\n\n    def reboot(self, context, instance, network_info, reboot_type,\n               block_device_info\u003dNone, bad_volumes_callback\u003dNone):\n        # [...]\n        return self._hard_reboot(context, instance, network_info,\n                                 block_device_info)\n\n\n    def _hard_reboot(self, context, instance, network_info,\n                     block_device_info\u003dNone):\n        # [...]\n        self._destroy(instance)\n\n\n    def _destroy(self, instance, attempt\u003d1):\n        guest \u003d self._host.get_guest(instance)\n        # [...]\n        guest.poweroff()\n\nnova/virt/libvirt/guest.py::\n\n    def poweroff(self):\n        self._domain.destroy()\n\nnova/virt/libvirt/host.py::\n\n    def get_guest(self, instance):\n        return libvirt_guest.Guest(\n            self.get_domain(instance))\n\n    def get_domain(self, instance):\n        return self._get_domain_by_name(instance.name)\n\nReferences:\n[1] http://docs.openstack.org/developer/nova/sample_config.html","commit_id":"1f65d64957951df91eec2c7a9202298f84102ecd"}]}
