)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"35b27a264f4ab118c2051f8ccd1a8c14fdb44a0d","unresolved":false,"context_lines":[{"line_number":10,"context_line":"nova-compute starts. This looks for all non-deleted volume BDMs"},{"line_number":11,"context_line":"for instances running on the host which do not have an attachment_id"},{"line_number":12,"context_line":"set indicating they were created before the compute API used the"},{"line_number":13,"context_line":"Cinder 3.44 microversion to create \u0027new style\u0027 attachments."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"For those BDMs found, the migration routine creates a \u0027new style\u0027"},{"line_number":16,"context_line":"attachment with the host connector, from the virt driver, per"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":6,"id":"3fa7e38b_716ca29b","line":13,"updated":"2019-09-26 19:37:18.000000000","message":"Could also note that (1) we didn\u0027t require cinder \u003e\u003d 3.44 (queens) in nova until Train and (2) we still don\u0027t create volumes during boot from volume using the new attachment flow (link to patches in both cases).","commit_id":"845260cf9090bdb69b08139c698282cdf5061b78"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"97620245844dc35c0b2ff53211f05163ee5f7987","unresolved":false,"context_lines":[{"line_number":10,"context_line":"nova-compute starts. This looks for all non-deleted volume BDMs"},{"line_number":11,"context_line":"for instances running on the host which do not have an attachment_id"},{"line_number":12,"context_line":"set indicating they were created before the compute API used the"},{"line_number":13,"context_line":"Cinder 3.44 microversion to create \u0027new style\u0027 attachments."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"For those BDMs found, the migration routine creates a \u0027new style\u0027"},{"line_number":16,"context_line":"attachment with the host connector, from the virt driver, per"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":6,"id":"3fa7e38b_8649e360","line":13,"in_reply_to":"3fa7e38b_716ca29b","updated":"2019-09-26 21:30:31.000000000","message":"Done","commit_id":"845260cf9090bdb69b08139c698282cdf5061b78"}],"nova/compute/manager.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"b200977fc75c74d0843dc721c6a220b4d9da7199","unresolved":false,"context_lines":[{"line_number":597,"context_line":"            return"},{"line_number":598,"context_line":""},{"line_number":599,"context_line":"        inst_map \u003d {instance.uuid: instance for instance in instances}"},{"line_number":600,"context_line":"        bdms \u003d objects.BlockDeviceMappingList.get_legacy_attachments("},{"line_number":601,"context_line":"            context, inst_map.keys(), use_slave\u003dTrue)"},{"line_number":602,"context_line":"        if not bdms:"},{"line_number":603,"context_line":"            return"}],"source_content_type":"text/x-python","patch_set":2,"id":"df7087c5_3f4f2693","line":600,"updated":"2018-03-21 19:25:48.000000000","message":"TODO: should probably leave a reminder to add something to nova-status for this. It would basically be the same DB query except for the specific instance UUIDs.","commit_id":"0c83d0ccbfd0eee88241fd75b3c8bb6a08971dbf"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"6358916f12960ac0c938528ccc9e05f11a1b2d53","unresolved":false,"context_lines":[{"line_number":613,"context_line":"            inst_id \u003d bdm.instance_uuid"},{"line_number":614,"context_line":"            LOG.debug(\u0027Migrating BDM for instance to new style volume \u0027"},{"line_number":615,"context_line":"                      \u0027attachments.\u0027, instance_id\u003dinst_id)"},{"line_number":616,"context_line":"            connector \u003d self.driver.get_volume_connector(inst_map[inst_id])"},{"line_number":617,"context_line":"            # Note that creating the attachment with the host connector"},{"line_number":618,"context_line":"            # immediately \u0027completes\u0027 it and keeps the volume in-use."},{"line_number":619,"context_line":"            attachment_id \u003d self.volume_api.attachment_create("}],"source_content_type":"text/x-python","patch_set":2,"id":"df7087c5_c67187e0","line":616,"range":{"start_line":616,"start_character":12,"end_line":616,"end_character":75},"updated":"2018-03-21 17:13:58.000000000","message":"Two issues here:\n\n1. We should get this once outside the loop.\n\n2. Should we use the original host connector used to create the initial backend storage connection? If the attachment is new enough, the original host connector is stashed in the connection_info in the BDM and we can try to re-use that first before relying on the current host connector. See how the \u0027local delete\u0027 flow in the API handles this:\n\nhttps://github.com/openstack/nova/blob/2ec8c49f6cb4a0e7dba217e824c20d9c703d2105/nova/compute/api.py#L1994","commit_id":"0c83d0ccbfd0eee88241fd75b3c8bb6a08971dbf"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"678ae66218a498d7badf0fe09be3da9327f2cac2","unresolved":false,"context_lines":[{"line_number":616,"context_line":"            connector \u003d self.driver.get_volume_connector(inst_map[inst_id])"},{"line_number":617,"context_line":"            # Note that creating the attachment with the host connector"},{"line_number":618,"context_line":"            # immediately \u0027completes\u0027 it and keeps the volume in-use."},{"line_number":619,"context_line":"            attachment_id \u003d self.volume_api.attachment_create("},{"line_number":620,"context_line":"                context, bdm.volume_id, inst_id, connector)[\u0027id\u0027]"},{"line_number":621,"context_line":"            bdm.attachment_id \u003d attachment_id"},{"line_number":622,"context_line":"            # TODO(mriedem): If the save() fails (I\u0027m not sure why it would),"}],"source_content_type":"text/x-python","patch_set":2,"id":"df7087c5_3c50940a","line":619,"updated":"2018-03-21 18:02:33.000000000","message":"If we start up all our computes at the same time post-upgrade, like you would expect config management to do, we\u0027re going to storm cinder\u0027s castle pretty hard. Surely some of these will fail and then we\u0027ll bail out of this method, which will kill startup. That means each compute will have to re-spawn nova-compute to make some more progress, which might fail again. If it happens enough, systemd might stop respawning for a while, etc.\n\nWouldn\u0027t it be better to be super graceful about any cinder-related failures and pause for a minute or so before continuing (related also to my comment below about using a thread for this).","commit_id":"0c83d0ccbfd0eee88241fd75b3c8bb6a08971dbf"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"b200977fc75c74d0843dc721c6a220b4d9da7199","unresolved":false,"context_lines":[{"line_number":616,"context_line":"            connector \u003d self.driver.get_volume_connector(inst_map[inst_id])"},{"line_number":617,"context_line":"            # Note that creating the attachment with the host connector"},{"line_number":618,"context_line":"            # immediately \u0027completes\u0027 it and keeps the volume in-use."},{"line_number":619,"context_line":"            attachment_id \u003d self.volume_api.attachment_create("},{"line_number":620,"context_line":"                context, bdm.volume_id, inst_id, connector)[\u0027id\u0027]"},{"line_number":621,"context_line":"            bdm.attachment_id \u003d attachment_id"},{"line_number":622,"context_line":"            # TODO(mriedem): If the save() fails (I\u0027m not sure why it would),"}],"source_content_type":"text/x-python","patch_set":2,"id":"df7087c5_5fabfa1b","line":619,"in_reply_to":"df7087c5_3c50940a","updated":"2018-03-21 19:25:48.000000000","message":"Yeah I can catch an error and sleep for a second or something, unless you think we need a longer sleep.\n\nAlternatively to this, I think at some point I had mentioned running this in a periodic task, like heal_instance_info which works on a queue of instances, one per minute. But the problem with that is eventually you\u0027d done the migration and don\u0027t need that periodic task running every minute just to query the database and do nothing. The operator could disable it when they\u0027re done, but that\u0027s not cool either.","commit_id":"0c83d0ccbfd0eee88241fd75b3c8bb6a08971dbf"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"c5181d22ac670e77a79846aa23981ee9b1a21974","unresolved":false,"context_lines":[{"line_number":616,"context_line":"            connector \u003d self.driver.get_volume_connector(inst_map[inst_id])"},{"line_number":617,"context_line":"            # Note that creating the attachment with the host connector"},{"line_number":618,"context_line":"            # immediately \u0027completes\u0027 it and keeps the volume in-use."},{"line_number":619,"context_line":"            attachment_id \u003d self.volume_api.attachment_create("},{"line_number":620,"context_line":"                context, bdm.volume_id, inst_id, connector)[\u0027id\u0027]"},{"line_number":621,"context_line":"            bdm.attachment_id \u003d attachment_id"},{"line_number":622,"context_line":"            # TODO(mriedem): If the save() fails (I\u0027m not sure why it would),"}],"source_content_type":"text/x-python","patch_set":2,"id":"df7087c5_9a452046","line":619,"in_reply_to":"df7087c5_5fabfa1b","updated":"2018-03-21 19:31:03.000000000","message":"Yeah I think making it a one-shot task on startup is probably okay, and it can just exit when it\u0027s sure there\u0027s nothing to do. I don\u0027t know that a periodic is necessarily a problem either, as it can short-circuit itself to off just like the task can exit. Unless you\u0027re worried about debug log-spam about running it?\n\nI think it\u0027s easier to reason about a one-shot background thread, but either would be okay with me, FWIW.","commit_id":"0c83d0ccbfd0eee88241fd75b3c8bb6a08971dbf"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"678ae66218a498d7badf0fe09be3da9327f2cac2","unresolved":false,"context_lines":[{"line_number":1199,"context_line":"                # _sync_scheduler_instance_info periodic task will."},{"line_number":1200,"context_line":"                self._update_scheduler_instance_info(context, instances)"},{"line_number":1201,"context_line":""},{"line_number":1202,"context_line":"        self._migrate_legacy_volume_attachments(context, instances)"},{"line_number":1203,"context_line":""},{"line_number":1204,"context_line":"    def cleanup_host(self):"},{"line_number":1205,"context_line":"        self.driver.register_event_listener(None)"}],"source_content_type":"text/x-python","patch_set":2,"id":"df7087c5_dc087829","line":1202,"updated":"2018-03-21 18:02:33.000000000","message":"When we did the ironic flavor resource class migration thing, we spawned this a a thread on startup. Seems like make it would be worth doing the same thing here?","commit_id":"0c83d0ccbfd0eee88241fd75b3c8bb6a08971dbf"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"b200977fc75c74d0843dc721c6a220b4d9da7199","unresolved":false,"context_lines":[{"line_number":1199,"context_line":"                # _sync_scheduler_instance_info periodic task will."},{"line_number":1200,"context_line":"                self._update_scheduler_instance_info(context, instances)"},{"line_number":1201,"context_line":""},{"line_number":1202,"context_line":"        self._migrate_legacy_volume_attachments(context, instances)"},{"line_number":1203,"context_line":""},{"line_number":1204,"context_line":"    def cleanup_host(self):"},{"line_number":1205,"context_line":"        self.driver.register_event_listener(None)"}],"source_content_type":"text/x-python","patch_set":2,"id":"df7087c5_1fbee264","line":1202,"in_reply_to":"df7087c5_dc087829","updated":"2018-03-21 19:25:48.000000000","message":"Sure I can thread this out.","commit_id":"0c83d0ccbfd0eee88241fd75b3c8bb6a08971dbf"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"b229ae34a1df30dbf1d65ad12557a09da18b9143","unresolved":false,"context_lines":[{"line_number":624,"context_line":"                bdm, instance)"},{"line_number":625,"context_line":"            if connector is None:"},{"line_number":626,"context_line":"                connector \u003d self.driver.get_volume_connector(instance)"},{"line_number":627,"context_line":"            # Note that creating the attachment with the host connector"},{"line_number":628,"context_line":"            # immediately \u0027completes\u0027 it and keeps the volume in-use."},{"line_number":629,"context_line":"            try:"},{"line_number":630,"context_line":"                attachment_id \u003d self.volume_api.attachment_create("},{"line_number":631,"context_line":"                    context, bdm.volume_id, instance.uuid, connector)[\u0027id\u0027]"},{"line_number":632,"context_line":"            except Exception as e:"},{"line_number":633,"context_line":"                # Be paranoid about failures from Cinder during the data"},{"line_number":634,"context_line":"                # migration; log an error, sleep for a minute, hope that it\u0027s"},{"line_number":635,"context_line":"                # transient and continue."},{"line_number":636,"context_line":"                LOG.error(\u0027An error occurred while trying to create \u0027"},{"line_number":637,"context_line":"                          \u0027attachment for volume %s. This will be retried on \u0027"},{"line_number":638,"context_line":"                          \u0027the next restart of the nova-compute service \u0027"},{"line_number":639,"context_line":"                          \u0027unless the volume is detached or the instance is \u0027"},{"line_number":640,"context_line":"                          \u0027deleted. Sleeping for one minute. Error: %s.\u0027,"},{"line_number":641,"context_line":"                          bdm.volume_id, six.text_type(e), instance\u003dinstance)"},{"line_number":642,"context_line":"                greenthread.sleep(60)"},{"line_number":643,"context_line":"            else:"},{"line_number":644,"context_line":"                bdm.attachment_id \u003d attachment_id"},{"line_number":645,"context_line":"                bdm.save()"},{"line_number":646,"context_line":"                # Allow switching of greenthreads between queries."},{"line_number":647,"context_line":"                greenthread.sleep(0)"},{"line_number":648,"context_line":""},{"line_number":649,"context_line":"    def _get_instances_on_driver(self, context, filters\u003dNone):"},{"line_number":650,"context_line":"        \"\"\"Return a list of instance records for the instances found"}],"source_content_type":"text/x-python","patch_set":3,"id":"bf659307_d4582932","line":647,"range":{"start_line":627,"start_character":0,"end_line":647,"end_character":36},"updated":"2018-04-11 09:58:05.000000000","message":"Do we want to retry? If not, we\u0027re going to be left with a single (or multiple, if this failed multiple times) BDM that doesn\u0027t have this attribute set, while everything else does","commit_id":"a77ca1a3278f4dbdfa9d51e85ca6224c45bfca67"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"741277ae8ef4d0acc91614b43fb83ebf374558ed","unresolved":false,"context_lines":[{"line_number":624,"context_line":"                bdm, instance)"},{"line_number":625,"context_line":"            if connector is None:"},{"line_number":626,"context_line":"                connector \u003d self.driver.get_volume_connector(instance)"},{"line_number":627,"context_line":"            # Note that creating the attachment with the host connector"},{"line_number":628,"context_line":"            # immediately \u0027completes\u0027 it and keeps the volume in-use."},{"line_number":629,"context_line":"            try:"},{"line_number":630,"context_line":"                attachment_id \u003d self.volume_api.attachment_create("},{"line_number":631,"context_line":"                    context, bdm.volume_id, instance.uuid, connector)[\u0027id\u0027]"},{"line_number":632,"context_line":"            except Exception as e:"},{"line_number":633,"context_line":"                # Be paranoid about failures from Cinder during the data"},{"line_number":634,"context_line":"                # migration; log an error, sleep for a minute, hope that it\u0027s"},{"line_number":635,"context_line":"                # transient and continue."},{"line_number":636,"context_line":"                LOG.error(\u0027An error occurred while trying to create \u0027"},{"line_number":637,"context_line":"                          \u0027attachment for volume %s. This will be retried on \u0027"},{"line_number":638,"context_line":"                          \u0027the next restart of the nova-compute service \u0027"},{"line_number":639,"context_line":"                          \u0027unless the volume is detached or the instance is \u0027"},{"line_number":640,"context_line":"                          \u0027deleted. Sleeping for one minute. Error: %s.\u0027,"},{"line_number":641,"context_line":"                          bdm.volume_id, six.text_type(e), instance\u003dinstance)"},{"line_number":642,"context_line":"                greenthread.sleep(60)"},{"line_number":643,"context_line":"            else:"},{"line_number":644,"context_line":"                bdm.attachment_id \u003d attachment_id"},{"line_number":645,"context_line":"                bdm.save()"},{"line_number":646,"context_line":"                # Allow switching of greenthreads between queries."},{"line_number":647,"context_line":"                greenthread.sleep(0)"},{"line_number":648,"context_line":""},{"line_number":649,"context_line":"    def _get_instances_on_driver(self, context, filters\u003dNone):"},{"line_number":650,"context_line":"        \"\"\"Return a list of instance records for the instances found"}],"source_content_type":"text/x-python","patch_set":3,"id":"bf659307_ef479376","line":647,"range":{"start_line":627,"start_character":0,"end_line":647,"end_character":36},"in_reply_to":"bf659307_d4582932","updated":"2018-04-11 15:27:13.000000000","message":"We\u0027ll retry next time the nova-compute service is restarted, which I think is good enough. I imagine we\u0027ll eventually have an online data migration check in nova-manage for these before we can actually drop the old code flows, but that\u0027s not something we\u0027ll be doing in Rocky anyway, so this is here for people rolling through.","commit_id":"a77ca1a3278f4dbdfa9d51e85ca6224c45bfca67"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"afecd02b8ceca8d56f715ef1698e3035efcd23e5","unresolved":false,"context_lines":[{"line_number":584,"context_line":"            LOG.debug(\u0027Instance has been destroyed from under us while \u0027"},{"line_number":585,"context_line":"                      \u0027trying to set it to ERROR\u0027, instance\u003dinstance)"},{"line_number":586,"context_line":""},{"line_number":587,"context_line":"    # TODO(mriedem): We need an accompanying nova-status check for this in"},{"line_number":588,"context_line":"    # the S release. Why S? Because we need to give operators time to roll"},{"line_number":589,"context_line":"    # through the data migration in Rocky."},{"line_number":590,"context_line":"    def _migrate_legacy_volume_attachments(self, context, instances):"}],"source_content_type":"text/x-python","patch_set":6,"id":"3fa7e38b_31506a0b","line":587,"updated":"2019-09-26 19:32:57.000000000","message":"Update this.","commit_id":"845260cf9090bdb69b08139c698282cdf5061b78"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"97620245844dc35c0b2ff53211f05163ee5f7987","unresolved":false,"context_lines":[{"line_number":584,"context_line":"            LOG.debug(\u0027Instance has been destroyed from under us while \u0027"},{"line_number":585,"context_line":"                      \u0027trying to set it to ERROR\u0027, instance\u003dinstance)"},{"line_number":586,"context_line":""},{"line_number":587,"context_line":"    # TODO(mriedem): We need an accompanying nova-status check for this in"},{"line_number":588,"context_line":"    # the S release. Why S? Because we need to give operators time to roll"},{"line_number":589,"context_line":"    # through the data migration in Rocky."},{"line_number":590,"context_line":"    def _migrate_legacy_volume_attachments(self, context, instances):"}],"source_content_type":"text/x-python","patch_set":6,"id":"3fa7e38b_e63e97b6","line":587,"in_reply_to":"3fa7e38b_31506a0b","updated":"2019-09-26 21:30:31.000000000","message":"Done","commit_id":"845260cf9090bdb69b08139c698282cdf5061b78"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"afecd02b8ceca8d56f715ef1698e3035efcd23e5","unresolved":false,"context_lines":[{"line_number":604,"context_line":"        if not bdms:"},{"line_number":605,"context_line":"            return"},{"line_number":606,"context_line":""},{"line_number":607,"context_line":"        # Check to see if Cinder is new enough to handle creating attachments."},{"line_number":608,"context_line":"        try:"},{"line_number":609,"context_line":"            cinder.is_microversion_supported(context, \u00273.44\u0027)"},{"line_number":610,"context_line":"        except exception.CinderAPIVersionNotAvailable:"},{"line_number":611,"context_line":"            LOG.debug(\u0027Cinder 3.44 is not available; not migrating %s block \u0027"},{"line_number":612,"context_line":"                      \u0027device mappings.\u0027, len(bdms))"},{"line_number":613,"context_line":""},{"line_number":614,"context_line":"        for bdm in bdms:"},{"line_number":615,"context_line":"            instance \u003d inst_map[bdm.instance_uuid]"}],"source_content_type":"text/x-python","patch_set":6,"id":"3fa7e38b_f155f2fa","line":612,"range":{"start_line":607,"start_character":8,"end_line":612,"end_character":52},"updated":"2019-09-26 19:32:57.000000000","message":"This can be removed now, we require cinder\u003e\u003dqueens since nova train.","commit_id":"845260cf9090bdb69b08139c698282cdf5061b78"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"97620245844dc35c0b2ff53211f05163ee5f7987","unresolved":false,"context_lines":[{"line_number":604,"context_line":"        if not bdms:"},{"line_number":605,"context_line":"            return"},{"line_number":606,"context_line":""},{"line_number":607,"context_line":"        # Check to see if Cinder is new enough to handle creating attachments."},{"line_number":608,"context_line":"        try:"},{"line_number":609,"context_line":"            cinder.is_microversion_supported(context, \u00273.44\u0027)"},{"line_number":610,"context_line":"        except exception.CinderAPIVersionNotAvailable:"},{"line_number":611,"context_line":"            LOG.debug(\u0027Cinder 3.44 is not available; not migrating %s block \u0027"},{"line_number":612,"context_line":"                      \u0027device mappings.\u0027, len(bdms))"},{"line_number":613,"context_line":""},{"line_number":614,"context_line":"        for bdm in bdms:"},{"line_number":615,"context_line":"            instance \u003d inst_map[bdm.instance_uuid]"}],"source_content_type":"text/x-python","patch_set":6,"id":"3fa7e38b_a6441f48","line":612,"range":{"start_line":607,"start_character":8,"end_line":612,"end_character":52},"in_reply_to":"3fa7e38b_f155f2fa","updated":"2019-09-26 21:30:31.000000000","message":"Done","commit_id":"845260cf9090bdb69b08139c698282cdf5061b78"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"afecd02b8ceca8d56f715ef1698e3035efcd23e5","unresolved":false,"context_lines":[{"line_number":1275,"context_line":"            for instance in instances:"},{"line_number":1276,"context_line":"                if (not evacuated_instances or"},{"line_number":1277,"context_line":"                        instance.uuid not in evacuated_instances):"},{"line_number":1278,"context_line":"                    self._init_instance(context, instance)"},{"line_number":1279,"context_line":""},{"line_number":1280,"context_line":"        finally:"},{"line_number":1281,"context_line":"            if CONF.defer_iptables_apply:"}],"source_content_type":"text/x-python","patch_set":6,"id":"3fa7e38b_1159ae33","line":1278,"range":{"start_line":1278,"start_character":20,"end_line":1278,"end_character":58},"updated":"2019-09-26 19:32:57.000000000","message":"It\u0027s possible that the list of instances we pass to _migrate_legacy_volume_attachments has changed in some way after _init_instance so maybe need to check task_states or something? Refresh the list?","commit_id":"845260cf9090bdb69b08139c698282cdf5061b78"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"97620245844dc35c0b2ff53211f05163ee5f7987","unresolved":false,"context_lines":[{"line_number":1275,"context_line":"            for instance in instances:"},{"line_number":1276,"context_line":"                if (not evacuated_instances or"},{"line_number":1277,"context_line":"                        instance.uuid not in evacuated_instances):"},{"line_number":1278,"context_line":"                    self._init_instance(context, instance)"},{"line_number":1279,"context_line":""},{"line_number":1280,"context_line":"        finally:"},{"line_number":1281,"context_line":"            if CONF.defer_iptables_apply:"}],"source_content_type":"text/x-python","patch_set":6,"id":"3fa7e38b_4679ab91","line":1278,"range":{"start_line":1278,"start_character":20,"end_line":1278,"end_character":58},"in_reply_to":"3fa7e38b_1159ae33","updated":"2019-09-26 21:30:31.000000000","message":"Done","commit_id":"845260cf9090bdb69b08139c698282cdf5061b78"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"a64db4283365bc09130936b6ff6e86e6aa95a5c2","unresolved":false,"context_lines":[{"line_number":638,"context_line":""},{"line_number":639,"context_line":"        for bdm in bdms:"},{"line_number":640,"context_line":"            instance \u003d inst_map[bdm.instance_uuid]"},{"line_number":641,"context_line":"            LOG.debug(\u0027Migrating BDM for instance to new style volume \u0027"},{"line_number":642,"context_line":"                      \u0027attachments.\u0027, instance\u003dinstance)"},{"line_number":643,"context_line":"            # We want to use the original host connector when creating the"},{"line_number":644,"context_line":"            # volume attachment if it\u0027s available (those didn\u0027t start getting"}],"source_content_type":"text/x-python","patch_set":7,"id":"3fa7e38b_c386d466","line":641,"range":{"start_line":641,"start_character":33,"end_line":641,"end_character":36},"updated":"2019-09-27 21:28:18.000000000","message":"Log the volume_id here.","commit_id":"a49535a37f7aeedf7feab59d0fafae628eb47a54"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"6673f50764d7a17b1a26b4ac3f0470096b1f2044","unresolved":false,"context_lines":[{"line_number":638,"context_line":""},{"line_number":639,"context_line":"        for bdm in bdms:"},{"line_number":640,"context_line":"            instance \u003d inst_map[bdm.instance_uuid]"},{"line_number":641,"context_line":"            LOG.debug(\u0027Migrating BDM for instance to new style volume \u0027"},{"line_number":642,"context_line":"                      \u0027attachments.\u0027, instance\u003dinstance)"},{"line_number":643,"context_line":"            # We want to use the original host connector when creating the"},{"line_number":644,"context_line":"            # volume attachment if it\u0027s available (those didn\u0027t start getting"}],"source_content_type":"text/x-python","patch_set":7,"id":"3fa7e38b_d57e78ad","line":641,"range":{"start_line":641,"start_character":33,"end_line":641,"end_character":36},"in_reply_to":"3fa7e38b_c386d466","updated":"2019-09-30 15:39:21.000000000","message":"Done","commit_id":"a49535a37f7aeedf7feab59d0fafae628eb47a54"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"a64db4283365bc09130936b6ff6e86e6aa95a5c2","unresolved":false,"context_lines":[{"line_number":651,"context_line":"            # Note that creating the attachment with the host connector"},{"line_number":652,"context_line":"            # immediately \u0027completes\u0027 it and keeps the volume in-use."},{"line_number":653,"context_line":"            try:"},{"line_number":654,"context_line":"                attachment_id \u003d self.volume_api.attachment_create("},{"line_number":655,"context_line":"                    context, bdm.volume_id, instance.uuid, connector)[\u0027id\u0027]"},{"line_number":656,"context_line":"            except Exception as e:"},{"line_number":657,"context_line":"                # Be paranoid about failures from Cinder during the data"}],"source_content_type":"text/x-python","patch_set":7,"id":"3fa7e38b_c3d4944a","line":654,"range":{"start_line":654,"start_character":16,"end_line":654,"end_character":29},"updated":"2019-09-27 21:28:18.000000000","message":"Should probably log the attachment_id that gets created at debug level.","commit_id":"a49535a37f7aeedf7feab59d0fafae628eb47a54"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"6673f50764d7a17b1a26b4ac3f0470096b1f2044","unresolved":false,"context_lines":[{"line_number":651,"context_line":"            # Note that creating the attachment with the host connector"},{"line_number":652,"context_line":"            # immediately \u0027completes\u0027 it and keeps the volume in-use."},{"line_number":653,"context_line":"            try:"},{"line_number":654,"context_line":"                attachment_id \u003d self.volume_api.attachment_create("},{"line_number":655,"context_line":"                    context, bdm.volume_id, instance.uuid, connector)[\u0027id\u0027]"},{"line_number":656,"context_line":"            except Exception as e:"},{"line_number":657,"context_line":"                # Be paranoid about failures from Cinder during the data"}],"source_content_type":"text/x-python","patch_set":7,"id":"3fa7e38b_355d8c46","line":654,"range":{"start_line":654,"start_character":16,"end_line":654,"end_character":29},"in_reply_to":"3fa7e38b_c3d4944a","updated":"2019-09-30 15:39:21.000000000","message":"Done","commit_id":"a49535a37f7aeedf7feab59d0fafae628eb47a54"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"babdbdc6e5e2e5ba8734cd4808faa89778fad2a6","unresolved":false,"context_lines":[{"line_number":651,"context_line":"            # Note that creating the attachment with the host connector"},{"line_number":652,"context_line":"            # immediately \u0027completes\u0027 it and keeps the volume in-use."},{"line_number":653,"context_line":"            try:"},{"line_number":654,"context_line":"                attachment_id \u003d self.volume_api.attachment_create("},{"line_number":655,"context_line":"                    context, bdm.volume_id, instance.uuid, connector)[\u0027id\u0027]"},{"line_number":656,"context_line":"            except Exception as e:"},{"line_number":657,"context_line":"                # Be paranoid about failures from Cinder during the data"},{"line_number":658,"context_line":"                # migration; log an error, sleep for a minute, hope that it\u0027s"}],"source_content_type":"text/x-python","patch_set":7,"id":"3fa7e38b_03be36b3","line":655,"range":{"start_line":654,"start_character":16,"end_line":655,"end_character":75},"updated":"2019-09-27 13:47:39.000000000","message":"I think we might have one or two issues with this, but need to verify:\n\n1. Creating a new attachment with the host connector here will generate a new connection_info dict from cinder, we should probably update the BDM with that even though it might not have changed from the existing connection_info to the storage backend.\n\n2. The volume status might be \"attaching\" until we call attachment_complete, need to verify that behavior in devstack, probably by hacking an existing BDM in the DB to null out the attachment_id and then migrate it here. Actually, right now I can boot from volume and the BDM won\u0027t have an attachment_id (until https://review.opendev.org/#/c/541420/ lands that is).","commit_id":"a49535a37f7aeedf7feab59d0fafae628eb47a54"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"3097b76811ccbb7c0fbf9f5ec9bb852708f4905f","unresolved":false,"context_lines":[{"line_number":651,"context_line":"            # Note that creating the attachment with the host connector"},{"line_number":652,"context_line":"            # immediately \u0027completes\u0027 it and keeps the volume in-use."},{"line_number":653,"context_line":"            try:"},{"line_number":654,"context_line":"                attachment_id \u003d self.volume_api.attachment_create("},{"line_number":655,"context_line":"                    context, bdm.volume_id, instance.uuid, connector)[\u0027id\u0027]"},{"line_number":656,"context_line":"            except Exception as e:"},{"line_number":657,"context_line":"                # Be paranoid about failures from Cinder during the data"},{"line_number":658,"context_line":"                # migration; log an error, sleep for a minute, hope that it\u0027s"}],"source_content_type":"text/x-python","patch_set":7,"id":"3fa7e38b_6010364f","line":655,"range":{"start_line":654,"start_character":16,"end_line":655,"end_character":75},"in_reply_to":"3fa7e38b_03be36b3","updated":"2019-09-27 20:04:01.000000000","message":"With this patch applied, I created a volume-backed server (where the BDM won\u0027t have the attachment_id set yet because I don\u0027t have that other patch applied) and restarted n-cpu and hit an error because apparently nova-cpu.conf isn\u0027t configured to talk to cinder in devstack? I guess that\u0027s because we attach the volume using the user token but for this we don\u0027t have a user token we have to use the configuration (like the port binding admin API stuff we do with neutron on behalf of the non-admin user):\n\nSep 27 19:58:49 devstack nova-compute[17326]: DEBUG nova.compute.manager [None req-45eeaca1-8936-460c-bf44-c50da06d731a None None] [instance: a7c59879-0fed-4801-9549-95ef11aa5ed4] Migrating BDM for instance to new style volume attachments. {{(pid\u003d17326) _migrate_legacy_volume_attachments /opt/stack/nova/nova/compute/manager.py:642}}\nSep 27 19:58:49 devstack nova-compute[17326]: ERROR nova.volume.cinder [None req-45eeaca1-8936-460c-bf44-c50da06d731a None None] [instance: a7c59879-0fed-4801-9549-95ef11aa5ed4] Create attachment failed for volume c2eaeb7b-67af-4472-82a8-0893c34d7366. Error: Unknown auth type: None (HTTP 401) Code: 401: Unauthorized: Unknown auth type: None (HTTP 401)\nSep 27 19:58:49 devstack nova-compute[17326]: ERROR nova.compute.manager [None req-45eeaca1-8936-460c-bf44-c50da06d731a None None] [instance: a7c59879-0fed-4801-9549-95ef11aa5ed4] An error occurred while trying to create attachment for volume c2eaeb7b-67af-4472-82a8-0893c34d7366. This will be retried on the next restart of the nova-compute service unless the volume is detached or the instance is deleted. Sleeping for one minute. Error: Unknown auth type: None (HTTP 401).: Unauthorized: Unknown auth type: None (HTTP 401)\n\nThis also means we should probably handle that case in the code and exit early if we know we\u0027re not configured to handle it (and make sure that\u0027s in the release note).","commit_id":"a49535a37f7aeedf7feab59d0fafae628eb47a54"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"363005440602a8795e12cdc499f6eab8c47d2cf8","unresolved":false,"context_lines":[{"line_number":653,"context_line":"            try:"},{"line_number":654,"context_line":"                attachment_id \u003d self.volume_api.attachment_create("},{"line_number":655,"context_line":"                    context, bdm.volume_id, instance.uuid, connector)[\u0027id\u0027]"},{"line_number":656,"context_line":"            except Exception as e:"},{"line_number":657,"context_line":"                # Be paranoid about failures from Cinder during the data"},{"line_number":658,"context_line":"                # migration; log an error, sleep for a minute, hope that it\u0027s"},{"line_number":659,"context_line":"                # transient and continue."}],"source_content_type":"text/x-python","patch_set":7,"id":"3fa7e38b_e03c2694","line":656,"updated":"2019-09-27 20:24:16.000000000","message":"Got around the auth issue locally and now I\u0027m hitting VolumeNotFound when trying to create the attachment:\n\nSep 27 20:19:55 devstack nova-compute[18758]: ERROR nova.volume.cinder [None req-3229b297-a262-4fcd-9b78-1aaa1b9f59de None None] [instance: a7c59879-0fed-4801-9549-95ef11aa5ed4] Create attachment failed for volume c2eaeb7b-67af-4472-82a8-0893c34d7366. Error: Volume c2eaeb7b-67af-4472-82a8-0893c34d7366 could not be found. (HTTP 404) (Request-ID: req-cfc54f14-1963-4968-ae6f-2c4fc29b2899) Code: 404: NotFound: Volume c2eaeb7b-67af-4472-82a8-0893c34d7366 could not be found. (HTTP 404) (Request-ID: req-cfc54f14-1963-4968-ae6f-2c4fc29b2899)\n\nBut the volume does exist:\n\n$ openstack volume show c2eaeb7b-67af-4472-82a8-0893c34d7366 -f value -c status\nin-use\n\nThe problem is likely one of policy because I\u0027m using a service user configuration for the auth token which is not the owner of the volume. Maybe we need to handle VolumeNotFound and log something useful, e.g. if the volume does actually exist, the [cinder] auth likely does not have enough permissions to work with the volume i.e. is not an admin.","commit_id":"a49535a37f7aeedf7feab59d0fafae628eb47a54"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"322b7667d1bb03b97024ce151ee36dcb519f4878","unresolved":false,"context_lines":[{"line_number":653,"context_line":"            try:"},{"line_number":654,"context_line":"                attachment_id \u003d self.volume_api.attachment_create("},{"line_number":655,"context_line":"                    context, bdm.volume_id, instance.uuid, connector)[\u0027id\u0027]"},{"line_number":656,"context_line":"            except Exception as e:"},{"line_number":657,"context_line":"                # Be paranoid about failures from Cinder during the data"},{"line_number":658,"context_line":"                # migration; log an error, sleep for a minute, hope that it\u0027s"},{"line_number":659,"context_line":"                # transient and continue."}],"source_content_type":"text/x-python","patch_set":7,"id":"3fa7e38b_a0d2aecf","line":656,"in_reply_to":"3fa7e38b_004702be","updated":"2019-09-27 20:55:32.000000000","message":"Yup, the problem is the Cinder DB API is filtering on the context\u0027s project_id to get the volume:\n\nhttps://github.com/openstack/cinder/blob/33b32d982094a9d85dabd737cb1d634b3164c187/cinder/db/sqlalchemy/api.py#L1893\n\nAnd we\u0027re using an admin context but in a different project so the volume doesn\u0027t come back out of the query.","commit_id":"a49535a37f7aeedf7feab59d0fafae628eb47a54"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"a64db4283365bc09130936b6ff6e86e6aa95a5c2","unresolved":false,"context_lines":[{"line_number":653,"context_line":"            try:"},{"line_number":654,"context_line":"                attachment_id \u003d self.volume_api.attachment_create("},{"line_number":655,"context_line":"                    context, bdm.volume_id, instance.uuid, connector)[\u0027id\u0027]"},{"line_number":656,"context_line":"            except Exception as e:"},{"line_number":657,"context_line":"                # Be paranoid about failures from Cinder during the data"},{"line_number":658,"context_line":"                # migration; log an error, sleep for a minute, hope that it\u0027s"},{"line_number":659,"context_line":"                # transient and continue."}],"source_content_type":"text/x-python","patch_set":7,"id":"3fa7e38b_23e00826","line":656,"in_reply_to":"3fa7e38b_232fa888","updated":"2019-09-27 21:28:18.000000000","message":"I re-configured nova-cpu.conf to use the admin project/user rather than the service/cinder project/user (until https://review.opendev.org/#/c/685488/ lands anyway) and restarted and now the error is gone:\n\nSep 27 21:23:16 devstack nova-compute[22661]: DEBUG nova.compute.manager [None req-c70ab41f-7cbd-429c-8546-e9360c6f0e34 None None] [instance: a7c59879-0fed-4801-9549-95ef11aa5ed4] Migrating BDM for instance to new style volume attachments. {{(pid\u003d22661) _migrate_legacy_volume_attachments /opt/stack/nova/nova/compute/manager.py:650}}\nSep 27 21:23:17 devstack nova-compute[22661]: DEBUG nova.compute.resource_tracker [None req-c70ab41f-7cbd-429c-8546-e9360c6f0e34 None None] Instance a7c59879-0fed-4801-9549-95ef11aa5ed4 actively managed on this compute host and has allocations in placement: {u\u0027resources\u0027: {u\u0027VCPU\u0027: 1, u\u0027MEMORY_MB\u0027: 512}}. {{(pid\u003d22661) _remove_deleted_instances_allocations /opt/stack/nova/nova/compute/resource_tracker.py:1534}}\n\nAnd the BDM has an attachment_id:\n\n\n\nAnd as expected the volume is not in the \"attaching\" status:\n\n$ openstack volume list\n+--------------------------------------+------+-----------+------+------------------------------------+\n| ID                                   | Name | Status    | Size | Attached to                        |\n+--------------------------------------+------+-----------+------+------------------------------------+\n| c2eaeb7b-67af-4472-82a8-0893c34d7366 |      | attaching |    1 | Attached to test-bfv1 on /dev/vda  |\n+--------------------------------------+------+-----------+------+------------------------------------+\n\nWhich is wrong - we need to complete the attachment and update the BDM.connection_info.","commit_id":"a49535a37f7aeedf7feab59d0fafae628eb47a54"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"6673f50764d7a17b1a26b4ac3f0470096b1f2044","unresolved":false,"context_lines":[{"line_number":653,"context_line":"            try:"},{"line_number":654,"context_line":"                attachment_id \u003d self.volume_api.attachment_create("},{"line_number":655,"context_line":"                    context, bdm.volume_id, instance.uuid, connector)[\u0027id\u0027]"},{"line_number":656,"context_line":"            except Exception as e:"},{"line_number":657,"context_line":"                # Be paranoid about failures from Cinder during the data"},{"line_number":658,"context_line":"                # migration; log an error, sleep for a minute, hope that it\u0027s"},{"line_number":659,"context_line":"                # transient and continue."}],"source_content_type":"text/x-python","patch_set":7,"id":"3fa7e38b_7871bba7","line":656,"in_reply_to":"3fa7e38b_23e00826","updated":"2019-09-30 15:39:21.000000000","message":"Done - calling attachment_complete on the attachment to make the volume in-use again.","commit_id":"a49535a37f7aeedf7feab59d0fafae628eb47a54"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"86a681af13950c166af2370981bcd4869a1bd2b1","unresolved":false,"context_lines":[{"line_number":653,"context_line":"            try:"},{"line_number":654,"context_line":"                attachment_id \u003d self.volume_api.attachment_create("},{"line_number":655,"context_line":"                    context, bdm.volume_id, instance.uuid, connector)[\u0027id\u0027]"},{"line_number":656,"context_line":"            except Exception as e:"},{"line_number":657,"context_line":"                # Be paranoid about failures from Cinder during the data"},{"line_number":658,"context_line":"                # migration; log an error, sleep for a minute, hope that it\u0027s"},{"line_number":659,"context_line":"                # transient and continue."}],"source_content_type":"text/x-python","patch_set":7,"id":"3fa7e38b_a35b98f3","line":656,"in_reply_to":"3fa7e38b_23e00826","updated":"2019-09-27 21:29:17.000000000","message":"Here was the BDM attachment_id that I forgot to paste above:\n\nmysql\u003e select attachment_id from block_device_mapping where volume_id\u003d\"c2eaeb7b-67af-4472-82a8-0893c34d7366\";\n+--------------------------------------+\n| attachment_id                        |\n+--------------------------------------+\n| 33c32307-85b0-47ff-884b-1dab436661ac |\n+--------------------------------------+\n1 row in set (0.01 sec)\n\nmysql\u003e","commit_id":"a49535a37f7aeedf7feab59d0fafae628eb47a54"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"ad63b95ee8596a0cd16c9d64cea5646106ea267d","unresolved":false,"context_lines":[{"line_number":653,"context_line":"            try:"},{"line_number":654,"context_line":"                attachment_id \u003d self.volume_api.attachment_create("},{"line_number":655,"context_line":"                    context, bdm.volume_id, instance.uuid, connector)[\u0027id\u0027]"},{"line_number":656,"context_line":"            except Exception as e:"},{"line_number":657,"context_line":"                # Be paranoid about failures from Cinder during the data"},{"line_number":658,"context_line":"                # migration; log an error, sleep for a minute, hope that it\u0027s"},{"line_number":659,"context_line":"                # transient and continue."}],"source_content_type":"text/x-python","patch_set":7,"id":"3fa7e38b_232fa888","line":656,"in_reply_to":"3fa7e38b_a0d2aecf","updated":"2019-09-27 21:19:15.000000000","message":"And devstack does not grant the cinder user the admin role like it does to the nova user (for neutron to make admin-level os-server-external-event admin API calls):\n\nstack@devstack:~/devstack$ openstack role assignment list --user cinder --names\n+---------+----------------+-------+-----------------+--------+--------+-----------+\n| Role    | User           | Group | Project         | Domain | System | Inherited |\n+---------+----------------+-------+-----------------+--------+--------+-----------+\n| service | cinder@Default |       | service@Default |        |        | False     |\n+---------+----------------+-------+-----------------+--------+--------+-----------+\nstack@devstack:~/devstack$ openstack role assignment list --user nova --names\n+---------+--------------+-------+-----------------+--------+--------+-----------+\n| Role    | User         | Group | Project         | Domain | System | Inherited |\n+---------+--------------+-------+-----------------+--------+--------+-----------+\n| service | nova@Default |       | service@Default |        |        | False     |\n| admin   | nova@Default |       | service@Default |        |        | False     |\n+---------+--------------+-------+-----------------+--------+--------+-----------+","commit_id":"a49535a37f7aeedf7feab59d0fafae628eb47a54"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"6673f50764d7a17b1a26b4ac3f0470096b1f2044","unresolved":false,"context_lines":[{"line_number":653,"context_line":"            try:"},{"line_number":654,"context_line":"                attachment_id \u003d self.volume_api.attachment_create("},{"line_number":655,"context_line":"                    context, bdm.volume_id, instance.uuid, connector)[\u0027id\u0027]"},{"line_number":656,"context_line":"            except Exception as e:"},{"line_number":657,"context_line":"                # Be paranoid about failures from Cinder during the data"},{"line_number":658,"context_line":"                # migration; log an error, sleep for a minute, hope that it\u0027s"},{"line_number":659,"context_line":"                # transient and continue."}],"source_content_type":"text/x-python","patch_set":7,"id":"3fa7e38b_f8436b3d","line":656,"in_reply_to":"3fa7e38b_e03c2694","updated":"2019-09-30 15:39:21.000000000","message":"Done - handling VolumeNotFound and logging a more useful warning.","commit_id":"a49535a37f7aeedf7feab59d0fafae628eb47a54"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"3c601c997be9afcfb5b65b8af85f2fc23bf7e033","unresolved":false,"context_lines":[{"line_number":653,"context_line":"            try:"},{"line_number":654,"context_line":"                attachment_id \u003d self.volume_api.attachment_create("},{"line_number":655,"context_line":"                    context, bdm.volume_id, instance.uuid, connector)[\u0027id\u0027]"},{"line_number":656,"context_line":"            except Exception as e:"},{"line_number":657,"context_line":"                # Be paranoid about failures from Cinder during the data"},{"line_number":658,"context_line":"                # migration; log an error, sleep for a minute, hope that it\u0027s"},{"line_number":659,"context_line":"                # transient and continue."}],"source_content_type":"text/x-python","patch_set":7,"id":"3fa7e38b_004702be","line":656,"in_reply_to":"3fa7e38b_e03c2694","updated":"2019-09-27 20:50:52.000000000","message":"The cinder attachment_create policy is open-ended meaning anyone can perform the operation:\n\nhttps://docs.openstack.org/cinder/latest/configuration/block-storage/policy.html\n\nvolume:attachment_create\n\n    Default\n\n        \u003cempty string\u003e\n    Operations\n\n            POST /attachments\n\n    Create attachment.\n\n\n\"\" means anyone, see:\n\nhttps://docs.openstack.org/oslo.policy/latest/admin/policy-yaml-file.html\n\n\"Always true. The action is always permitted. This can be written as \"\" (empty string), [], or \"@\".\"\n\nI bet there is some kind of low-level hard-coded project_id filtering when getting the volume...","commit_id":"a49535a37f7aeedf7feab59d0fafae628eb47a54"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"a80896f8aec68e40a16be8e6dac9ab3f9df1b188","unresolved":false,"context_lines":[{"line_number":633,"context_line":"        # Since we do not have a user token we must use the cinder"},{"line_number":634,"context_line":"        # service user token for this operation. If we are unable to"},{"line_number":635,"context_line":"        # do so we need to just quit."},{"line_number":636,"context_line":"        if CONF.cinder.auth_type is None:"},{"line_number":637,"context_line":"            LOG.info(\u0027Unable to migrate legacy volume attachments since \u0027"},{"line_number":638,"context_line":"                     \u0027[cinder] auth is not configured.\u0027)"},{"line_number":639,"context_line":"            return"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_86ba18be","line":636,"updated":"2019-09-30 16:30:06.000000000","message":"Need a test for this.","commit_id":"38e31d82acd7f747a7c4418c36433bf06476cfbd"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"3ce9769e289cfa69dfad463ea4d7a67237c4e013","unresolved":false,"context_lines":[{"line_number":633,"context_line":"        # Since we do not have a user token we must use the cinder"},{"line_number":634,"context_line":"        # service user token for this operation. If we are unable to"},{"line_number":635,"context_line":"        # do so we need to just quit."},{"line_number":636,"context_line":"        if CONF.cinder.auth_type is None:"},{"line_number":637,"context_line":"            LOG.info(\u0027Unable to migrate legacy volume attachments since \u0027"},{"line_number":638,"context_line":"                     \u0027[cinder] auth is not configured.\u0027)"},{"line_number":639,"context_line":"            return"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_e0685422","line":636,"in_reply_to":"3fa7e38b_86ba18be","updated":"2019-10-03 22:03:40.000000000","message":"Done","commit_id":"38e31d82acd7f747a7c4418c36433bf06476cfbd"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"a80896f8aec68e40a16be8e6dac9ab3f9df1b188","unresolved":false,"context_lines":[{"line_number":671,"context_line":"        connector \u003d compute_utils.get_stashed_volume_connector(bdm, instance)"},{"line_number":672,"context_line":"        if connector is None:"},{"line_number":673,"context_line":"            connector \u003d self.driver.get_volume_connector(instance)"},{"line_number":674,"context_line":"        # Note that creating the attachment with the host connector"},{"line_number":675,"context_line":"        # immediately \u0027completes\u0027 it and keeps the volume in-use."},{"line_number":676,"context_line":"        try:"},{"line_number":677,"context_line":"            attachment \u003d self.volume_api.attachment_create("},{"line_number":678,"context_line":"                context, volume_id, instance.uuid, connector)"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_26e4840c","line":675,"range":{"start_line":674,"start_character":8,"end_line":675,"end_character":65},"updated":"2019-09-30 16:30:06.000000000","message":"This is wrong, see debug notes from PS7.","commit_id":"38e31d82acd7f747a7c4418c36433bf06476cfbd"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"3ce9769e289cfa69dfad463ea4d7a67237c4e013","unresolved":false,"context_lines":[{"line_number":671,"context_line":"        connector \u003d compute_utils.get_stashed_volume_connector(bdm, instance)"},{"line_number":672,"context_line":"        if connector is None:"},{"line_number":673,"context_line":"            connector \u003d self.driver.get_volume_connector(instance)"},{"line_number":674,"context_line":"        # Note that creating the attachment with the host connector"},{"line_number":675,"context_line":"        # immediately \u0027completes\u0027 it and keeps the volume in-use."},{"line_number":676,"context_line":"        try:"},{"line_number":677,"context_line":"            attachment \u003d self.volume_api.attachment_create("},{"line_number":678,"context_line":"                context, volume_id, instance.uuid, connector)"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_a35fc60c","line":675,"range":{"start_line":674,"start_character":8,"end_line":675,"end_character":65},"in_reply_to":"3fa7e38b_26e4840c","updated":"2019-10-03 22:03:40.000000000","message":"Done","commit_id":"38e31d82acd7f747a7c4418c36433bf06476cfbd"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"840a6d6298fdb35e711321be919c2787418640dd","unresolved":false,"context_lines":[{"line_number":674,"context_line":"        # Note that creating the attachment with the host connector"},{"line_number":675,"context_line":"        # immediately \u0027completes\u0027 it and keeps the volume in-use."},{"line_number":676,"context_line":"        try:"},{"line_number":677,"context_line":"            attachment \u003d self.volume_api.attachment_create("},{"line_number":678,"context_line":"                context, volume_id, instance.uuid, connector)"},{"line_number":679,"context_line":"        except exception.VolumeNotFound:"},{"line_number":680,"context_line":"            # There are two known cases where we could hit this:"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_3920229b","line":677,"range":{"start_line":677,"start_character":41,"end_line":677,"end_character":58},"updated":"2019-09-30 20:20:07.000000000","message":"Before doing this, we need to get the volume attachments for the volume and save off the legacy volume attachment so we can delete it after completing the new attachment otherwise the volume will still be in-use even after we delete the server and the new attachment record we created (because the legacy attachment will be orphaned).\n\nI wonder if an alternative to creating a new attachment is just updating the existing legacy attachment with a new host connector and save that in the BDM, though jgriffith would probably say we should just create a new attachment and delete the old one, similar to his comments here:\n\nhttps://review.opendev.org/#/c/579004/6/nova/virt/block_device.py@663","commit_id":"38e31d82acd7f747a7c4418c36433bf06476cfbd"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"3375ce06a96de6eafcea2ff321aa88bdf9354807","unresolved":false,"context_lines":[{"line_number":674,"context_line":"        # Note that creating the attachment with the host connector"},{"line_number":675,"context_line":"        # immediately \u0027completes\u0027 it and keeps the volume in-use."},{"line_number":676,"context_line":"        try:"},{"line_number":677,"context_line":"            attachment \u003d self.volume_api.attachment_create("},{"line_number":678,"context_line":"                context, volume_id, instance.uuid, connector)"},{"line_number":679,"context_line":"        except exception.VolumeNotFound:"},{"line_number":680,"context_line":"            # There are two known cases where we could hit this:"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_b96bb282","line":677,"range":{"start_line":677,"start_character":41,"end_line":677,"end_character":58},"in_reply_to":"3fa7e38b_3920229b","updated":"2019-09-30 20:43:27.000000000","message":"Also note that we\u0027d expect at most one attachments entry on the volume since you shouldn\u0027t be able to have a multiattach volume with multiple attachments using the legacy attachment flow, the API only allows that for new-style attachments:\n\nhttps://github.com/openstack/nova/blob/961c2945491ebcea3cf1cb175a06d057155aa5a5/nova/compute/api.py#L4086\n\nAnd the compute-level block device code only supports multiattach with a new style attachment:\n\nhttps://github.com/openstack/nova/blob/961c2945491ebcea3cf1cb175a06d057155aa5a5/nova/virt/block_device.py#L545","commit_id":"38e31d82acd7f747a7c4418c36433bf06476cfbd"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"3ce9769e289cfa69dfad463ea4d7a67237c4e013","unresolved":false,"context_lines":[{"line_number":674,"context_line":"        # Note that creating the attachment with the host connector"},{"line_number":675,"context_line":"        # immediately \u0027completes\u0027 it and keeps the volume in-use."},{"line_number":676,"context_line":"        try:"},{"line_number":677,"context_line":"            attachment \u003d self.volume_api.attachment_create("},{"line_number":678,"context_line":"                context, volume_id, instance.uuid, connector)"},{"line_number":679,"context_line":"        except exception.VolumeNotFound:"},{"line_number":680,"context_line":"            # There are two known cases where we could hit this:"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_e3937ea2","line":677,"range":{"start_line":677,"start_character":41,"end_line":677,"end_character":58},"in_reply_to":"3fa7e38b_b96bb282","updated":"2019-10-03 22:03:40.000000000","message":"Done","commit_id":"38e31d82acd7f747a7c4418c36433bf06476cfbd"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"a80896f8aec68e40a16be8e6dac9ab3f9df1b188","unresolved":false,"context_lines":[{"line_number":676,"context_line":"        try:"},{"line_number":677,"context_line":"            attachment \u003d self.volume_api.attachment_create("},{"line_number":678,"context_line":"                context, volume_id, instance.uuid, connector)"},{"line_number":679,"context_line":"        except exception.VolumeNotFound:"},{"line_number":680,"context_line":"            # There are two known cases where we could hit this:"},{"line_number":681,"context_line":"            # 1. We either raced with something or have stale BDM data"},{"line_number":682,"context_line":"            #    and the volume is really gone."}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_06ce2862","line":679,"updated":"2019-09-30 16:30:06.000000000","message":"Need a test for this.","commit_id":"38e31d82acd7f747a7c4418c36433bf06476cfbd"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"3ce9769e289cfa69dfad463ea4d7a67237c4e013","unresolved":false,"context_lines":[{"line_number":676,"context_line":"        try:"},{"line_number":677,"context_line":"            attachment \u003d self.volume_api.attachment_create("},{"line_number":678,"context_line":"                context, volume_id, instance.uuid, connector)"},{"line_number":679,"context_line":"        except exception.VolumeNotFound:"},{"line_number":680,"context_line":"            # There are two known cases where we could hit this:"},{"line_number":681,"context_line":"            # 1. We either raced with something or have stale BDM data"},{"line_number":682,"context_line":"            #    and the volume is really gone."}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_23f756f8","line":679,"in_reply_to":"3fa7e38b_06ce2862","updated":"2019-10-03 22:03:40.000000000","message":"This is covered by test_migrate_legacy_volume_attachments_errors.","commit_id":"38e31d82acd7f747a7c4418c36433bf06476cfbd"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"a80896f8aec68e40a16be8e6dac9ab3f9df1b188","unresolved":false,"context_lines":[{"line_number":714,"context_line":"            # be stuck with status \"in-use\"."},{"line_number":715,"context_line":"            try:"},{"line_number":716,"context_line":"                self.volume_api.attachment_complete(context, attachment_id)"},{"line_number":717,"context_line":"            except Exception as e:"},{"line_number":718,"context_line":"                # Log an error, attempt to delete the newly created"},{"line_number":719,"context_line":"                # attachment and return."},{"line_number":720,"context_line":"                LOG.error(\u0027Failed to complete newly created attachment %s \u0027"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_c6c33037","line":717,"updated":"2019-09-30 16:30:06.000000000","message":"Need a test for this.","commit_id":"38e31d82acd7f747a7c4418c36433bf06476cfbd"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"a80896f8aec68e40a16be8e6dac9ab3f9df1b188","unresolved":false,"context_lines":[{"line_number":723,"context_line":"                          instance\u003dinstance)"},{"line_number":724,"context_line":"                try:"},{"line_number":725,"context_line":"                    self.volume_api.attachment_delete(context, attachment_id)"},{"line_number":726,"context_line":"                except Exception as e2:"},{"line_number":727,"context_line":"                    # In this case there is not much we can do. Just log"},{"line_number":728,"context_line":"                    # an error because the volume status will be in-use."},{"line_number":729,"context_line":"                    LOG.error(\u0027Failed to delete newly created attachment %s \u0027"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_e6be6cac","line":726,"updated":"2019-09-30 16:30:06.000000000","message":"And this.","commit_id":"38e31d82acd7f747a7c4418c36433bf06476cfbd"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"a80896f8aec68e40a16be8e6dac9ab3f9df1b188","unresolved":false,"context_lines":[{"line_number":739,"context_line":"            # BDM so we can detach properly."},{"line_number":740,"context_line":"            new_connection_info \u003d attachment[\u0027connection_info\u0027]"},{"line_number":741,"context_line":"            old_connection_info \u003d \\"},{"line_number":742,"context_line":"                driver_block_device.safe_load_connection_info(bdm)"},{"line_number":743,"context_line":"            driver_block_device.update_connection_info("},{"line_number":744,"context_line":"                old_connection_info, new_connection_info, bdm.volume_id)"},{"line_number":745,"context_line":"            bdm.connection_info \u003d jsonutils.dumps(new_connection_info)"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_66011c6a","line":742,"range":{"start_line":742,"start_character":36,"end_line":742,"end_character":61},"updated":"2019-09-30 16:30:06.000000000","message":"Assert that we called this by setting bdm.connection_info\u003dNone in a test.","commit_id":"38e31d82acd7f747a7c4418c36433bf06476cfbd"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"a80896f8aec68e40a16be8e6dac9ab3f9df1b188","unresolved":false,"context_lines":[{"line_number":740,"context_line":"            new_connection_info \u003d attachment[\u0027connection_info\u0027]"},{"line_number":741,"context_line":"            old_connection_info \u003d \\"},{"line_number":742,"context_line":"                driver_block_device.safe_load_connection_info(bdm)"},{"line_number":743,"context_line":"            driver_block_device.update_connection_info("},{"line_number":744,"context_line":"                old_connection_info, new_connection_info, bdm.volume_id)"},{"line_number":745,"context_line":"            bdm.connection_info \u003d jsonutils.dumps(new_connection_info)"},{"line_number":746,"context_line":"            bdm.save()"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_06d38805","line":743,"range":{"start_line":743,"start_character":32,"end_line":743,"end_character":54},"updated":"2019-09-30 16:30:06.000000000","message":"Assert that we called this by checking for \u0027serial\u0027 in bdm.connection_info in a test.","commit_id":"38e31d82acd7f747a7c4418c36433bf06476cfbd"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"a80896f8aec68e40a16be8e6dac9ab3f9df1b188","unresolved":false,"context_lines":[{"line_number":741,"context_line":"            old_connection_info \u003d \\"},{"line_number":742,"context_line":"                driver_block_device.safe_load_connection_info(bdm)"},{"line_number":743,"context_line":"            driver_block_device.update_connection_info("},{"line_number":744,"context_line":"                old_connection_info, new_connection_info, bdm.volume_id)"},{"line_number":745,"context_line":"            bdm.connection_info \u003d jsonutils.dumps(new_connection_info)"},{"line_number":746,"context_line":"            bdm.save()"},{"line_number":747,"context_line":""}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_c6aa506f","line":744,"range":{"start_line":744,"start_character":58,"end_line":744,"end_character":71},"updated":"2019-09-30 16:30:06.000000000","message":"Can use volume_id here.","commit_id":"38e31d82acd7f747a7c4418c36433bf06476cfbd"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"3ce9769e289cfa69dfad463ea4d7a67237c4e013","unresolved":false,"context_lines":[{"line_number":741,"context_line":"            old_connection_info \u003d \\"},{"line_number":742,"context_line":"                driver_block_device.safe_load_connection_info(bdm)"},{"line_number":743,"context_line":"            driver_block_device.update_connection_info("},{"line_number":744,"context_line":"                old_connection_info, new_connection_info, bdm.volume_id)"},{"line_number":745,"context_line":"            bdm.connection_info \u003d jsonutils.dumps(new_connection_info)"},{"line_number":746,"context_line":"            bdm.save()"},{"line_number":747,"context_line":""}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_a35026d6","line":744,"range":{"start_line":744,"start_character":58,"end_line":744,"end_character":71},"in_reply_to":"3fa7e38b_c6aa506f","updated":"2019-10-03 22:03:40.000000000","message":"Done","commit_id":"38e31d82acd7f747a7c4418c36433bf06476cfbd"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"e54ae2b0e044d96f8c5c102d489f925dc42ceac7","unresolved":false,"context_lines":[{"line_number":795,"context_line":""},{"line_number":796,"context_line":"        # Finally delete the legacy attachment so that the volume will go back"},{"line_number":797,"context_line":"        # to \"available\" status when completely detached from the server."},{"line_number":798,"context_line":"        # TODO(mriedem): Should we be using terminate_connection here?"},{"line_number":799,"context_line":"        if legacy_attachment_id:  # TODO(mriedem): Test this case."},{"line_number":800,"context_line":"            try:"},{"line_number":801,"context_line":"                self.volume_api.attachment_delete("}],"source_content_type":"text/x-python","patch_set":9,"id":"3fa7e38b_6eb7753c","line":798,"updated":"2019-10-03 23:06:14.000000000","message":"I think this is OK because attachment_delete in cinder terminates the connection under the covers:\n\nhttps://github.com/openstack/cinder/blob/410791580ef60ddb03104bf20766859ed9d78932/cinder/volume/manager.py#L4650","commit_id":"e6899eca20f0180c96a68ce7a700dd23c5ea8e10"}],"nova/objects/block_device.py":[{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"b229ae34a1df30dbf1d65ad12557a09da18b9143","unresolved":false,"context_lines":[{"line_number":432,"context_line":"        return base.obj_make_list("},{"line_number":433,"context_line":"                context, cls(), objects.BlockDeviceMapping, db_bdms or [])"},{"line_number":434,"context_line":""},{"line_number":435,"context_line":"    @staticmethod"},{"line_number":436,"context_line":"    @db.select_db_reader_mode"},{"line_number":437,"context_line":"    def _db_bdm_get_legacy_attachments("},{"line_number":438,"context_line":"            context, instance_uuids, use_slave\u003dFalse):"},{"line_number":439,"context_line":"        if not instance_uuids:"},{"line_number":440,"context_line":"            return []"},{"line_number":441,"context_line":"        # Get all non-deleted attached volume BDMs where attachment_id is None"},{"line_number":442,"context_line":"        # and the instance_uuid is in the list of instance UUIDs."},{"line_number":443,"context_line":"        return context.session.query("},{"line_number":444,"context_line":"            db_models.BlockDeviceMapping).\\"},{"line_number":445,"context_line":"            filter(db_models.BlockDeviceMapping.instance_uuid.in_("},{"line_number":446,"context_line":"                instance_uuids)).\\"},{"line_number":447,"context_line":"            filter(db_models.BlockDeviceMapping.volume_id !\u003d null()).\\"},{"line_number":448,"context_line":"            filter_by("},{"line_number":449,"context_line":"                destination_type\u003dfields.BlockDeviceDestinationType.VOLUME).\\"},{"line_number":450,"context_line":"            filter_by(deleted\u003d0).\\"},{"line_number":451,"context_line":"            filter_by(attachment_id\u003dNone).all()"},{"line_number":452,"context_line":""},{"line_number":453,"context_line":"    @base.remotable_classmethod"},{"line_number":454,"context_line":"    def get_legacy_attachments(cls, context, instance_uuids, use_slave\u003dFalse):"},{"line_number":455,"context_line":"        db_bdms \u003d cls._db_bdm_get_legacy_attachments("},{"line_number":456,"context_line":"            context, instance_uuids, use_slave\u003duse_slave)"},{"line_number":457,"context_line":"        return base.obj_make_list("},{"line_number":458,"context_line":"                context, cls(), objects.BlockDeviceMapping, db_bdms or [])"},{"line_number":459,"context_line":""},{"line_number":460,"context_line":"    def root_bdm(self):"},{"line_number":461,"context_line":"        \"\"\"It only makes sense to call this method when the"}],"source_content_type":"text/x-python","patch_set":3,"id":"bf659307_14a1c1f8","line":458,"range":{"start_line":435,"start_character":0,"end_line":458,"end_character":74},"updated":"2018-04-11 09:58:05.000000000","message":"Do we want these to be attributes of the class as opposed to part of the migration? I\u0027m imagining this would be useless once the online migration has run but we\u0027d have to keep it around until said migration is removed or we\u0027d break the migration. Maybe it has to be though, on account of the \u0027remotable_classmethod\u0027 attribute","commit_id":"a77ca1a3278f4dbdfa9d51e85ca6224c45bfca67"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"741277ae8ef4d0acc91614b43fb83ebf374558ed","unresolved":false,"context_lines":[{"line_number":432,"context_line":"        return base.obj_make_list("},{"line_number":433,"context_line":"                context, cls(), objects.BlockDeviceMapping, db_bdms or [])"},{"line_number":434,"context_line":""},{"line_number":435,"context_line":"    @staticmethod"},{"line_number":436,"context_line":"    @db.select_db_reader_mode"},{"line_number":437,"context_line":"    def _db_bdm_get_legacy_attachments("},{"line_number":438,"context_line":"            context, instance_uuids, use_slave\u003dFalse):"},{"line_number":439,"context_line":"        if not instance_uuids:"},{"line_number":440,"context_line":"            return []"},{"line_number":441,"context_line":"        # Get all non-deleted attached volume BDMs where attachment_id is None"},{"line_number":442,"context_line":"        # and the instance_uuid is in the list of instance UUIDs."},{"line_number":443,"context_line":"        return context.session.query("},{"line_number":444,"context_line":"            db_models.BlockDeviceMapping).\\"},{"line_number":445,"context_line":"            filter(db_models.BlockDeviceMapping.instance_uuid.in_("},{"line_number":446,"context_line":"                instance_uuids)).\\"},{"line_number":447,"context_line":"            filter(db_models.BlockDeviceMapping.volume_id !\u003d null()).\\"},{"line_number":448,"context_line":"            filter_by("},{"line_number":449,"context_line":"                destination_type\u003dfields.BlockDeviceDestinationType.VOLUME).\\"},{"line_number":450,"context_line":"            filter_by(deleted\u003d0).\\"},{"line_number":451,"context_line":"            filter_by(attachment_id\u003dNone).all()"},{"line_number":452,"context_line":""},{"line_number":453,"context_line":"    @base.remotable_classmethod"},{"line_number":454,"context_line":"    def get_legacy_attachments(cls, context, instance_uuids, use_slave\u003dFalse):"},{"line_number":455,"context_line":"        db_bdms \u003d cls._db_bdm_get_legacy_attachments("},{"line_number":456,"context_line":"            context, instance_uuids, use_slave\u003duse_slave)"},{"line_number":457,"context_line":"        return base.obj_make_list("},{"line_number":458,"context_line":"                context, cls(), objects.BlockDeviceMapping, db_bdms or [])"},{"line_number":459,"context_line":""},{"line_number":460,"context_line":"    def root_bdm(self):"},{"line_number":461,"context_line":"        \"\"\"It only makes sense to call this method when the"}],"source_content_type":"text/x-python","patch_set":3,"id":"bf659307_af22fbb7","line":458,"range":{"start_line":435,"start_character":0,"end_line":458,"end_character":74},"in_reply_to":"bf659307_14a1c1f8","updated":"2018-04-11 15:27:13.000000000","message":"I\u0027m not sure how you mean for these to be attributes of the class? They have to be remotable so the compute service can query these remotely from the cell conductor which talks directly to the cell database.","commit_id":"a77ca1a3278f4dbdfa9d51e85ca6224c45bfca67"}],"nova/tests/functional/compute/test_bdm_migration.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"afecd02b8ceca8d56f715ef1698e3035efcd23e5","unresolved":false,"context_lines":[{"line_number":24,"context_line":"from nova.tests.unit.image import fake as fake_image"},{"line_number":25,"context_line":""},{"line_number":26,"context_line":""},{"line_number":27,"context_line":"class TestVolumeBDMAttachmentMigration(integrated_helpers._IntegratedTestBase,"},{"line_number":28,"context_line":"                                       integrated_helpers.InstanceHelperMixin):"},{"line_number":29,"context_line":"    \"\"\"Tests migrating old style volume attachments on nova-compute startup\"\"\""},{"line_number":30,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3fa7e38b_f17c1273","line":27,"range":{"start_line":27,"start_character":39,"end_line":27,"end_character":77},"updated":"2019-09-26 19:32:57.000000000","message":"Would probably be better if we didn\u0027t use this so then we wouldn\u0027t need...","commit_id":"845260cf9090bdb69b08139c698282cdf5061b78"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"97620245844dc35c0b2ff53211f05163ee5f7987","unresolved":false,"context_lines":[{"line_number":24,"context_line":"from nova.tests.unit.image import fake as fake_image"},{"line_number":25,"context_line":""},{"line_number":26,"context_line":""},{"line_number":27,"context_line":"class TestVolumeBDMAttachmentMigration(integrated_helpers._IntegratedTestBase,"},{"line_number":28,"context_line":"                                       integrated_helpers.InstanceHelperMixin):"},{"line_number":29,"context_line":"    \"\"\"Tests migrating old style volume attachments on nova-compute startup\"\"\""},{"line_number":30,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3fa7e38b_667ce782","line":27,"range":{"start_line":27,"start_character":39,"end_line":27,"end_character":77},"in_reply_to":"3fa7e38b_f17c1273","updated":"2019-09-26 21:30:31.000000000","message":"Done","commit_id":"845260cf9090bdb69b08139c698282cdf5061b78"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"afecd02b8ceca8d56f715ef1698e3035efcd23e5","unresolved":false,"context_lines":[{"line_number":28,"context_line":"                                       integrated_helpers.InstanceHelperMixin):"},{"line_number":29,"context_line":"    \"\"\"Tests migrating old style volume attachments on nova-compute startup\"\"\""},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    # These are all needed for _IntegratedTestBase."},{"line_number":32,"context_line":"    REQUIRES_LOCKING \u003d False"},{"line_number":33,"context_line":"    USE_NEUTRON \u003d True"},{"line_number":34,"context_line":"    api_major_version \u003d \u0027v2.1\u0027"},{"line_number":35,"context_line":"    microversion \u003d \u0027latest\u0027"},{"line_number":36,"context_line":"    _image_ref_parameter \u003d \u0027imageRef\u0027"},{"line_number":37,"context_line":"    _flavor_ref_parameter \u003d \u0027flavorRef\u0027"},{"line_number":38,"context_line":""},{"line_number":39,"context_line":"    @mock.patch(\u0027nova.volume.cinder.is_microversion_supported\u0027,"},{"line_number":40,"context_line":"                side_effect\u003d(exception.CinderAPIVersionNotAvailable("}],"source_content_type":"text/x-python","patch_set":6,"id":"3fa7e38b_b19a1ab6","line":37,"range":{"start_line":31,"start_character":4,"end_line":37,"end_character":39},"updated":"2019-09-26 19:32:57.000000000","message":"...all of this.","commit_id":"845260cf9090bdb69b08139c698282cdf5061b78"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"97620245844dc35c0b2ff53211f05163ee5f7987","unresolved":false,"context_lines":[{"line_number":28,"context_line":"                                       integrated_helpers.InstanceHelperMixin):"},{"line_number":29,"context_line":"    \"\"\"Tests migrating old style volume attachments on nova-compute startup\"\"\""},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    # These are all needed for _IntegratedTestBase."},{"line_number":32,"context_line":"    REQUIRES_LOCKING \u003d False"},{"line_number":33,"context_line":"    USE_NEUTRON \u003d True"},{"line_number":34,"context_line":"    api_major_version \u003d \u0027v2.1\u0027"},{"line_number":35,"context_line":"    microversion \u003d \u0027latest\u0027"},{"line_number":36,"context_line":"    _image_ref_parameter \u003d \u0027imageRef\u0027"},{"line_number":37,"context_line":"    _flavor_ref_parameter \u003d \u0027flavorRef\u0027"},{"line_number":38,"context_line":""},{"line_number":39,"context_line":"    @mock.patch(\u0027nova.volume.cinder.is_microversion_supported\u0027,"},{"line_number":40,"context_line":"                side_effect\u003d(exception.CinderAPIVersionNotAvailable("}],"source_content_type":"text/x-python","patch_set":6,"id":"3fa7e38b_066f33c5","line":37,"range":{"start_line":31,"start_character":4,"end_line":37,"end_character":39},"in_reply_to":"3fa7e38b_b19a1ab6","updated":"2019-09-26 21:30:31.000000000","message":"Done","commit_id":"845260cf9090bdb69b08139c698282cdf5061b78"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"afecd02b8ceca8d56f715ef1698e3035efcd23e5","unresolved":false,"context_lines":[{"line_number":36,"context_line":"    _image_ref_parameter \u003d \u0027imageRef\u0027"},{"line_number":37,"context_line":"    _flavor_ref_parameter \u003d \u0027flavorRef\u0027"},{"line_number":38,"context_line":""},{"line_number":39,"context_line":"    @mock.patch(\u0027nova.volume.cinder.is_microversion_supported\u0027,"},{"line_number":40,"context_line":"                side_effect\u003d(exception.CinderAPIVersionNotAvailable("},{"line_number":41,"context_line":"                    version\u003d\u00273.44\u0027), None))"},{"line_number":42,"context_line":"    @mock.patch(\u0027nova.volume.cinder.API.attachment_create\u0027,"},{"line_number":43,"context_line":"                side_effect\u003d(exception.CinderAPIVersionNotAvailable("},{"line_number":44,"context_line":"                    version\u003d\u00273.44\u0027), {\u0027id\u0027: uuids.attachment_id}))"},{"line_number":45,"context_line":"    def test_legacy_vol_bdm_attach_migration("},{"line_number":46,"context_line":"            self, attachment_create, is_microversion_supported):"},{"line_number":47,"context_line":"        \"\"\"Tests the following scenario:"}],"source_content_type":"text/x-python","patch_set":6,"id":"3fa7e38b_f1f17202","line":44,"range":{"start_line":39,"start_character":4,"end_line":44,"end_character":35},"updated":"2019-09-26 19:32:57.000000000","message":"The 3.44 stuff can be removed.\n\nWe shouldn\u0027t actually need these mocks in a functional test, the CinderFixture should handle all of this.","commit_id":"845260cf9090bdb69b08139c698282cdf5061b78"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"97620245844dc35c0b2ff53211f05163ee5f7987","unresolved":false,"context_lines":[{"line_number":36,"context_line":"    _image_ref_parameter \u003d \u0027imageRef\u0027"},{"line_number":37,"context_line":"    _flavor_ref_parameter \u003d \u0027flavorRef\u0027"},{"line_number":38,"context_line":""},{"line_number":39,"context_line":"    @mock.patch(\u0027nova.volume.cinder.is_microversion_supported\u0027,"},{"line_number":40,"context_line":"                side_effect\u003d(exception.CinderAPIVersionNotAvailable("},{"line_number":41,"context_line":"                    version\u003d\u00273.44\u0027), None))"},{"line_number":42,"context_line":"    @mock.patch(\u0027nova.volume.cinder.API.attachment_create\u0027,"},{"line_number":43,"context_line":"                side_effect\u003d(exception.CinderAPIVersionNotAvailable("},{"line_number":44,"context_line":"                    version\u003d\u00273.44\u0027), {\u0027id\u0027: uuids.attachment_id}))"},{"line_number":45,"context_line":"    def test_legacy_vol_bdm_attach_migration("},{"line_number":46,"context_line":"            self, attachment_create, is_microversion_supported):"},{"line_number":47,"context_line":"        \"\"\"Tests the following scenario:"}],"source_content_type":"text/x-python","patch_set":6,"id":"3fa7e38b_c66cbbcf","line":44,"range":{"start_line":39,"start_character":4,"end_line":44,"end_character":35},"in_reply_to":"3fa7e38b_f1f17202","updated":"2019-09-26 21:30:31.000000000","message":"Done","commit_id":"845260cf9090bdb69b08139c698282cdf5061b78"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"97620245844dc35c0b2ff53211f05163ee5f7987","unresolved":false,"context_lines":[{"line_number":66,"context_line":"        self.api.api_post(\u0027/servers/%s/os-volume_attachments\u0027 % server[\u0027id\u0027],"},{"line_number":67,"context_line":"                          volume_attachment)"},{"line_number":68,"context_line":""},{"line_number":69,"context_line":"        # Assert the volume was attached the old way (no attachment record)."},{"line_number":70,"context_line":"        ctxt \u003d context.get_admin_context()"},{"line_number":71,"context_line":"        legacy_attachments \u003d ("},{"line_number":72,"context_line":"            objects.BlockDeviceMappingList.get_legacy_attachments("},{"line_number":73,"context_line":"                ctxt, [server[\u0027id\u0027]]))"},{"line_number":74,"context_line":"        self.assertEqual(1, len(legacy_attachments))"},{"line_number":75,"context_line":"        self.assertIsNone(legacy_attachments[0].attachment_id)"},{"line_number":76,"context_line":""},{"line_number":77,"context_line":"        # restart nova-compute"},{"line_number":78,"context_line":"        self.compute.stop()"}],"source_content_type":"text/x-python","patch_set":6,"id":"3fa7e38b_833475df","line":75,"range":{"start_line":69,"start_character":8,"end_line":75,"end_character":62},"updated":"2019-09-26 21:30:31.000000000","message":"We\u0027re going to have to populate the database directly for this since the API always creates an attachment since Train.","commit_id":"845260cf9090bdb69b08139c698282cdf5061b78"}],"releasenotes/notes/volume-attachment-migrate-18057d73b7974812.yaml":[{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"b229ae34a1df30dbf1d65ad12557a09da18b9143","unresolved":false,"context_lines":[{"line_number":9,"context_line":"    performed \"offline\" since the *nova-compute* service needs to be able to"},{"line_number":10,"context_line":"    communicate with the block storage API."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"    .. __: https://specs.openstack.org/openstack/nova-specs/specs/queens/implemented/cinder-new-attach-apis.html"}],"source_content_type":"text/x-yaml","patch_set":3,"id":"bf659307_d47fc963","line":12,"range":{"start_line":12,"start_character":4,"end_line":12,"end_character":10},"updated":"2018-04-11 09:58:05.000000000","message":"nit: Is this correct? I always write these like so:\n\n    __ https://example.com\n\ni.e. no \u0027..\u0027 or \u0027:\u0027","commit_id":"a77ca1a3278f4dbdfa9d51e85ca6224c45bfca67"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"741277ae8ef4d0acc91614b43fb83ebf374558ed","unresolved":false,"context_lines":[{"line_number":9,"context_line":"    performed \"offline\" since the *nova-compute* service needs to be able to"},{"line_number":10,"context_line":"    communicate with the block storage API."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"    .. __: https://specs.openstack.org/openstack/nova-specs/specs/queens/implemented/cinder-new-attach-apis.html"}],"source_content_type":"text/x-yaml","patch_set":3,"id":"bf659307_ef15534a","line":12,"range":{"start_line":12,"start_character":4,"end_line":12,"end_character":10},"in_reply_to":"bf659307_d47fc963","updated":"2018-04-11 15:27:13.000000000","message":"I followed the spec:\n\nhttp://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#anonymous-hyperlinks","commit_id":"a77ca1a3278f4dbdfa9d51e85ca6224c45bfca67"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"afecd02b8ceca8d56f715ef1698e3035efcd23e5","unresolved":false,"context_lines":[{"line_number":1,"context_line":"---"},{"line_number":2,"context_line":"upgrade:"},{"line_number":3,"context_line":"  - |"},{"line_number":4,"context_line":"    Starting in Queens, volume attachments are made in a `new way`__. Now in"},{"line_number":5,"context_line":"    Rocky, when *nova-compute* services are restarted, a background thread"},{"line_number":6,"context_line":"    will be launched to migrate legacy volume attachment records for instances"},{"line_number":7,"context_line":"    running on the given compute host. Any errors that occur will be logged"},{"line_number":8,"context_line":"    but will not impact the start of the service. This migration cannot be"}],"source_content_type":"text/x-yaml","patch_set":6,"id":"3fa7e38b_f1cad29e","line":5,"range":{"start_line":4,"start_character":70,"end_line":5,"end_character":11},"updated":"2019-09-26 19:32:57.000000000","message":"Need to update this.","commit_id":"845260cf9090bdb69b08139c698282cdf5061b78"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"97620245844dc35c0b2ff53211f05163ee5f7987","unresolved":false,"context_lines":[{"line_number":1,"context_line":"---"},{"line_number":2,"context_line":"upgrade:"},{"line_number":3,"context_line":"  - |"},{"line_number":4,"context_line":"    Starting in Queens, volume attachments are made in a `new way`__. Now in"},{"line_number":5,"context_line":"    Rocky, when *nova-compute* services are restarted, a background thread"},{"line_number":6,"context_line":"    will be launched to migrate legacy volume attachment records for instances"},{"line_number":7,"context_line":"    running on the given compute host. Any errors that occur will be logged"},{"line_number":8,"context_line":"    but will not impact the start of the service. This migration cannot be"}],"source_content_type":"text/x-yaml","patch_set":6,"id":"3fa7e38b_866243d7","line":5,"range":{"start_line":4,"start_character":70,"end_line":5,"end_character":11},"in_reply_to":"3fa7e38b_f1cad29e","updated":"2019-09-26 21:30:31.000000000","message":"Done","commit_id":"845260cf9090bdb69b08139c698282cdf5061b78"}]}
