)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c294baf25ceacaf8475252c16b2cfcbd7a8d9852","unresolved":false,"context_lines":[{"line_number":11,"context_line":"or instance_mappings. This patch extends this command with the --force"},{"line_number":12,"context_line":"option for destroying instance_mappings in addition to the host_mappings"},{"line_number":13,"context_line":"of the cell which is to be deleted."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"Change-Id: Ibefa0465224bec9a22431c7d3b5c8f5d91fc7732"},{"line_number":16,"context_line":"Closes-Bug: #1745375"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"3fa0c359_c89c9c6c","line":14,"updated":"2018-02-15 00:47:02.000000000","message":"To be clear, the --force option only removes instance_mappings if there are no live instances (not deleted) in the cell.","commit_id":"68f0b4f05c0bbc5ec6822c0a95df4141e51db629"},{"author":{"_account_id":26936,"name":"Surya Seetharaman","email":"suryaseetharaman.9@gmail.com","username":"tssurya"},"change_message_id":"6fd56b6138c556c9bf677b32f181ea8ba9210c08","unresolved":false,"context_lines":[{"line_number":11,"context_line":"or instance_mappings. This patch extends this command with the --force"},{"line_number":12,"context_line":"option for destroying instance_mappings in addition to the host_mappings"},{"line_number":13,"context_line":"of the cell which is to be deleted."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"Change-Id: Ibefa0465224bec9a22431c7d3b5c8f5d91fc7732"},{"line_number":16,"context_line":"Closes-Bug: #1745375"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"3fa0c359_1ae87114","line":14,"in_reply_to":"3fa0c359_c89c9c6c","updated":"2018-02-15 17:47:05.000000000","message":"Changed the message so that it is more clear.","commit_id":"68f0b4f05c0bbc5ec6822c0a95df4141e51db629"}],"nova/cmd/manage.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c294baf25ceacaf8475252c16b2cfcbd7a8d9852","unresolved":false,"context_lines":[{"line_number":1381,"context_line":"        * It has hosts and force is False."},{"line_number":1382,"context_line":"        * It has instance mappings and force is False."},{"line_number":1383,"context_line":""},{"line_number":1384,"context_line":"        If force is True and the cell has host, hosts and instance_mappings"},{"line_number":1385,"context_line":"        are deleted as well (as long as there are no living instances)."},{"line_number":1386,"context_line":""},{"line_number":1387,"context_line":"        Returns 0 in the following cases."}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa0c359_68878811","line":1384,"range":{"start_line":1384,"start_character":42,"end_line":1384,"end_character":53},"updated":"2018-02-15 00:47:02.000000000","message":"might as well fix this typo","commit_id":"68f0b4f05c0bbc5ec6822c0a95df4141e51db629"},{"author":{"_account_id":26936,"name":"Surya Seetharaman","email":"suryaseetharaman.9@gmail.com","username":"tssurya"},"change_message_id":"6fd56b6138c556c9bf677b32f181ea8ba9210c08","unresolved":false,"context_lines":[{"line_number":1381,"context_line":"        * It has hosts and force is False."},{"line_number":1382,"context_line":"        * It has instance mappings and force is False."},{"line_number":1383,"context_line":""},{"line_number":1384,"context_line":"        If force is True and the cell has host, hosts and instance_mappings"},{"line_number":1385,"context_line":"        are deleted as well (as long as there are no living instances)."},{"line_number":1386,"context_line":""},{"line_number":1387,"context_line":"        Returns 0 in the following cases."}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa0c359_1404c8c5","line":1384,"range":{"start_line":1384,"start_character":42,"end_line":1384,"end_character":53},"in_reply_to":"3fa0c359_68878811","updated":"2018-02-15 17:47:05.000000000","message":"Done","commit_id":"68f0b4f05c0bbc5ec6822c0a95df4141e51db629"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c294baf25ceacaf8475252c16b2cfcbd7a8d9852","unresolved":false,"context_lines":[{"line_number":1411,"context_line":"        instance_mappings \u003d objects.InstanceMappingList.get_by_cell_id("},{"line_number":1412,"context_line":"            ctxt, cell_mapping.id)"},{"line_number":1413,"context_line":"        if instance_mappings:"},{"line_number":1414,"context_line":"            with context.target_cell(ctxt, cell_mapping) as cctxt:"},{"line_number":1415,"context_line":"                instances \u003d objects.InstanceList.get_all(cctxt)"},{"line_number":1416,"context_line":"            if instances:"},{"line_number":1417,"context_line":"                # There are instances in the cell."},{"line_number":1418,"context_line":"                print(_(\u0027There are existing instances mapped to cell with \u0027"},{"line_number":1419,"context_line":"                        \u0027uuid %s.\u0027) % cell_uuid)"},{"line_number":1420,"context_line":"                return 3"},{"line_number":1421,"context_line":"            else:"},{"line_number":1422,"context_line":"                if not force:"},{"line_number":1423,"context_line":"                    # There are no instances in the cell but the records remain"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa0c359_e872b849","line":1420,"range":{"start_line":1414,"start_character":12,"end_line":1420,"end_character":24},"updated":"2018-02-15 00:47:02.000000000","message":"OK this is the case that, regardless of --force, if there are non-deleted instances in the cell we fail.","commit_id":"68f0b4f05c0bbc5ec6822c0a95df4141e51db629"},{"author":{"_account_id":26936,"name":"Surya Seetharaman","email":"suryaseetharaman.9@gmail.com","username":"tssurya"},"change_message_id":"6fd56b6138c556c9bf677b32f181ea8ba9210c08","unresolved":false,"context_lines":[{"line_number":1411,"context_line":"        instance_mappings \u003d objects.InstanceMappingList.get_by_cell_id("},{"line_number":1412,"context_line":"            ctxt, cell_mapping.id)"},{"line_number":1413,"context_line":"        if instance_mappings:"},{"line_number":1414,"context_line":"            with context.target_cell(ctxt, cell_mapping) as cctxt:"},{"line_number":1415,"context_line":"                instances \u003d objects.InstanceList.get_all(cctxt)"},{"line_number":1416,"context_line":"            if instances:"},{"line_number":1417,"context_line":"                # There are instances in the cell."},{"line_number":1418,"context_line":"                print(_(\u0027There are existing instances mapped to cell with \u0027"},{"line_number":1419,"context_line":"                        \u0027uuid %s.\u0027) % cell_uuid)"},{"line_number":1420,"context_line":"                return 3"},{"line_number":1421,"context_line":"            else:"},{"line_number":1422,"context_line":"                if not force:"},{"line_number":1423,"context_line":"                    # There are no instances in the cell but the records remain"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa0c359_f4b91ce9","line":1420,"range":{"start_line":1414,"start_character":12,"end_line":1420,"end_character":24},"in_reply_to":"3fa0c359_e872b849","updated":"2018-02-15 17:47:05.000000000","message":"Yes.","commit_id":"68f0b4f05c0bbc5ec6822c0a95df4141e51db629"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c294baf25ceacaf8475252c16b2cfcbd7a8d9852","unresolved":false,"context_lines":[{"line_number":1430,"context_line":"                    return 4"},{"line_number":1431,"context_line":""},{"line_number":1432,"context_line":"        # Delete instance_mappings of the deleted instances"},{"line_number":1433,"context_line":"        for instance_mapping in instance_mappings:"},{"line_number":1434,"context_line":"            instance_mapping.destroy()"},{"line_number":1435,"context_line":""},{"line_number":1436,"context_line":"        # Delete hosts mapped to the cell."}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa0c359_689c685d","line":1433,"updated":"2018-02-15 00:47:02.000000000","message":"We don\u0027t check --force here because if there are instance mappings and no live instances in the cell, we already checked force above and if not force, we failed, otherwise we move ahead to delete the mappings here.","commit_id":"68f0b4f05c0bbc5ec6822c0a95df4141e51db629"},{"author":{"_account_id":26936,"name":"Surya Seetharaman","email":"suryaseetharaman.9@gmail.com","username":"tssurya"},"change_message_id":"6fd56b6138c556c9bf677b32f181ea8ba9210c08","unresolved":false,"context_lines":[{"line_number":1430,"context_line":"                    return 4"},{"line_number":1431,"context_line":""},{"line_number":1432,"context_line":"        # Delete instance_mappings of the deleted instances"},{"line_number":1433,"context_line":"        for instance_mapping in instance_mappings:"},{"line_number":1434,"context_line":"            instance_mapping.destroy()"},{"line_number":1435,"context_line":""},{"line_number":1436,"context_line":"        # Delete hosts mapped to the cell."}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa0c359_54c81073","line":1433,"in_reply_to":"3fa0c359_689c685d","updated":"2018-02-15 17:47:05.000000000","message":"Yes.","commit_id":"68f0b4f05c0bbc5ec6822c0a95df4141e51db629"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"312a9d57b1368a7045697c0eb5aacaf8c885a215","unresolved":false,"context_lines":[{"line_number":1419,"context_line":"                        \u0027uuid %s.\u0027) % cell_uuid)"},{"line_number":1420,"context_line":"                return 3"},{"line_number":1421,"context_line":"            else:"},{"line_number":1422,"context_line":"                if not force:"},{"line_number":1423,"context_line":"                    # There are no instances in the cell but the records remain"},{"line_number":1424,"context_line":"                    # in the \u0027instance_mappings\u0027 table."},{"line_number":1425,"context_line":"                    print(_(\"There are instance mappings to cell with uuid \""}],"source_content_type":"text/x-python","patch_set":5,"id":"3fa0c359_20bfe9fb","line":1422,"updated":"2018-02-20 15:05:29.000000000","message":"Why not elif?","commit_id":"ee2f65d91fb632f04be3572967029cd58be4c614"},{"author":{"_account_id":26936,"name":"Surya Seetharaman","email":"suryaseetharaman.9@gmail.com","username":"tssurya"},"change_message_id":"dbd0c644c66c08024983777afb08cfc27f086878","unresolved":false,"context_lines":[{"line_number":1419,"context_line":"                        \u0027uuid %s.\u0027) % cell_uuid)"},{"line_number":1420,"context_line":"                return 3"},{"line_number":1421,"context_line":"            else:"},{"line_number":1422,"context_line":"                if not force:"},{"line_number":1423,"context_line":"                    # There are no instances in the cell but the records remain"},{"line_number":1424,"context_line":"                    # in the \u0027instance_mappings\u0027 table."},{"line_number":1425,"context_line":"                    print(_(\"There are instance mappings to cell with uuid \""}],"source_content_type":"text/x-python","patch_set":5,"id":"3fa0c359_e01341b7","line":1422,"in_reply_to":"3fa0c359_20bfe9fb","updated":"2018-02-20 15:18:14.000000000","message":"not sure why I didn\u0027t use an elif :D . But will do this too in the clean-up patch.","commit_id":"ee2f65d91fb632f04be3572967029cd58be4c614"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"b859812728777abaff2a9bca66a20d1a40479a38","unresolved":false,"context_lines":[{"line_number":1419,"context_line":"                        \u0027uuid %s.\u0027) % cell_uuid)"},{"line_number":1420,"context_line":"                return 3"},{"line_number":1421,"context_line":"            else:"},{"line_number":1422,"context_line":"                if not force:"},{"line_number":1423,"context_line":"                    # There are no instances in the cell but the records remain"},{"line_number":1424,"context_line":"                    # in the \u0027instance_mappings\u0027 table."},{"line_number":1425,"context_line":"                    print(_(\"There are instance mappings to cell with uuid \""}],"source_content_type":"text/x-python","patch_set":5,"id":"3fa0c359_ffa5e29f","line":1422,"in_reply_to":"3fa0c359_e01341b7","updated":"2018-02-22 16:24:42.000000000","message":"Heh :-)","commit_id":"ee2f65d91fb632f04be3572967029cd58be4c614"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"312a9d57b1368a7045697c0eb5aacaf8c885a215","unresolved":false,"context_lines":[{"line_number":1438,"context_line":"            host_mapping.destroy()"},{"line_number":1439,"context_line":""},{"line_number":1440,"context_line":"        # There are no hosts or instances mapped to the cell so delete it."},{"line_number":1441,"context_line":"        cell_mapping.destroy()"},{"line_number":1442,"context_line":"        return 0"},{"line_number":1443,"context_line":""},{"line_number":1444,"context_line":"    @args(\u0027--cell_uuid\u0027, metavar\u003d\u0027\u003ccell_uuid\u003e\u0027, dest\u003d\u0027cell_uuid\u0027,"}],"source_content_type":"text/x-python","patch_set":5,"id":"3fa0c359_e004a1c8","line":1441,"updated":"2018-02-20 15:05:29.000000000","message":"We could have raced to get here and gained another instance or two before we do this destroy. It\u0027s probably reasonable to assume the operator will prevent that from happening, but it\u0027s possible. If we get here, we\u0027ll fail because of the FK right? This was possible with the host mappings as well, but presumably it\u0027s more likely that an instance will get spawned than a new host added.\n\nMaybe as a follow-up we could catch and handle that case nicely?","commit_id":"ee2f65d91fb632f04be3572967029cd58be4c614"},{"author":{"_account_id":26936,"name":"Surya Seetharaman","email":"suryaseetharaman.9@gmail.com","username":"tssurya"},"change_message_id":"dbd0c644c66c08024983777afb08cfc27f086878","unresolved":false,"context_lines":[{"line_number":1438,"context_line":"            host_mapping.destroy()"},{"line_number":1439,"context_line":""},{"line_number":1440,"context_line":"        # There are no hosts or instances mapped to the cell so delete it."},{"line_number":1441,"context_line":"        cell_mapping.destroy()"},{"line_number":1442,"context_line":"        return 0"},{"line_number":1443,"context_line":""},{"line_number":1444,"context_line":"    @args(\u0027--cell_uuid\u0027, metavar\u003d\u0027\u003ccell_uuid\u003e\u0027, dest\u003d\u0027cell_uuid\u0027,"}],"source_content_type":"text/x-python","patch_set":5,"id":"3fa0c359_60f9717e","line":1441,"in_reply_to":"3fa0c359_e004a1c8","updated":"2018-02-20 15:18:14.000000000","message":"Yes, will do this in a follow-up.","commit_id":"ee2f65d91fb632f04be3572967029cd58be4c614"}],"nova/tests/unit/test_nova_manage.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c294baf25ceacaf8475252c16b2cfcbd7a8d9852","unresolved":false,"context_lines":[{"line_number":1827,"context_line":"        inst_uuid \u003d uuidutils.generate_uuid()"},{"line_number":1828,"context_line":"        proj_uuid \u003d uuidutils.generate_uuid()"},{"line_number":1829,"context_line":"        instance \u003d objects.Instance(ctxt, project_id\u003dproj_uuid,"},{"line_number":1830,"context_line":"                                                uuid\u003dinst_uuid)"},{"line_number":1831,"context_line":"        instance.create()"},{"line_number":1832,"context_line":""},{"line_number":1833,"context_line":"        im \u003d objects.InstanceMapping(ctxt, project_id\u003dproj_uuid,"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa0c359_289e6054","line":1830,"updated":"2018-02-15 00:47:02.000000000","message":"nit: align this with the ctxt arg","commit_id":"68f0b4f05c0bbc5ec6822c0a95df4141e51db629"},{"author":{"_account_id":26936,"name":"Surya Seetharaman","email":"suryaseetharaman.9@gmail.com","username":"tssurya"},"change_message_id":"6fd56b6138c556c9bf677b32f181ea8ba9210c08","unresolved":false,"context_lines":[{"line_number":1827,"context_line":"        inst_uuid \u003d uuidutils.generate_uuid()"},{"line_number":1828,"context_line":"        proj_uuid \u003d uuidutils.generate_uuid()"},{"line_number":1829,"context_line":"        instance \u003d objects.Instance(ctxt, project_id\u003dproj_uuid,"},{"line_number":1830,"context_line":"                                                uuid\u003dinst_uuid)"},{"line_number":1831,"context_line":"        instance.create()"},{"line_number":1832,"context_line":""},{"line_number":1833,"context_line":"        im \u003d objects.InstanceMapping(ctxt, project_id\u003dproj_uuid,"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa0c359_7ab41536","line":1830,"in_reply_to":"3fa0c359_289e6054","updated":"2018-02-15 17:47:05.000000000","message":"Done","commit_id":"68f0b4f05c0bbc5ec6822c0a95df4141e51db629"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c294baf25ceacaf8475252c16b2cfcbd7a8d9852","unresolved":false,"context_lines":[{"line_number":1831,"context_line":"        instance.create()"},{"line_number":1832,"context_line":""},{"line_number":1833,"context_line":"        im \u003d objects.InstanceMapping(ctxt, project_id\u003dproj_uuid,"},{"line_number":1834,"context_line":"                                    cell_mapping\u003dcm,"},{"line_number":1835,"context_line":"                                    instance_uuid\u003dinst_uuid)"},{"line_number":1836,"context_line":"        im.create()"},{"line_number":1837,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa0c359_c8aa5c70","line":1834,"updated":"2018-02-15 00:47:02.000000000","message":"nit: align with ctxt arg","commit_id":"68f0b4f05c0bbc5ec6822c0a95df4141e51db629"},{"author":{"_account_id":26936,"name":"Surya Seetharaman","email":"suryaseetharaman.9@gmail.com","username":"tssurya"},"change_message_id":"6fd56b6138c556c9bf677b32f181ea8ba9210c08","unresolved":false,"context_lines":[{"line_number":1831,"context_line":"        instance.create()"},{"line_number":1832,"context_line":""},{"line_number":1833,"context_line":"        im \u003d objects.InstanceMapping(ctxt, project_id\u003dproj_uuid,"},{"line_number":1834,"context_line":"                                    cell_mapping\u003dcm,"},{"line_number":1835,"context_line":"                                    instance_uuid\u003dinst_uuid)"},{"line_number":1836,"context_line":"        im.create()"},{"line_number":1837,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa0c359_5ab7d93b","line":1834,"in_reply_to":"3fa0c359_c8aa5c70","updated":"2018-02-15 17:47:05.000000000","message":"Done","commit_id":"68f0b4f05c0bbc5ec6822c0a95df4141e51db629"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c294baf25ceacaf8475252c16b2cfcbd7a8d9852","unresolved":false,"context_lines":[{"line_number":1835,"context_line":"                                    instance_uuid\u003dinst_uuid)"},{"line_number":1836,"context_line":"        im.create()"},{"line_number":1837,"context_line":""},{"line_number":1838,"context_line":"        # delete the instance such that we now have only its mapping"},{"line_number":1839,"context_line":"        instance.destroy()"},{"line_number":1840,"context_line":""},{"line_number":1841,"context_line":"        self.assertEqual(0, self.commands.delete_cell(uuidsentinel.cell1,"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa0c359_88b694dc","line":1838,"updated":"2018-02-15 00:47:02.000000000","message":"Before you run this, can you run the command with force\u003dTrue and show that we still fail and don\u0027t remove the mapping? That\u0027s an important part of this. I don\u0027t know if that\u0027s easy or not with mocked tests - would definitely be possible using a live db and real records like in:\n\nhttps://github.com/openstack/nova/blob/master/nova/tests/functional/test_nova_manage.py\n\nThen delete the instance and run this as you have it to show the mapping is deleted.","commit_id":"68f0b4f05c0bbc5ec6822c0a95df4141e51db629"},{"author":{"_account_id":26936,"name":"Surya Seetharaman","email":"suryaseetharaman.9@gmail.com","username":"tssurya"},"change_message_id":"6fd56b6138c556c9bf677b32f181ea8ba9210c08","unresolved":false,"context_lines":[{"line_number":1835,"context_line":"                                    instance_uuid\u003dinst_uuid)"},{"line_number":1836,"context_line":"        im.create()"},{"line_number":1837,"context_line":""},{"line_number":1838,"context_line":"        # delete the instance such that we now have only its mapping"},{"line_number":1839,"context_line":"        instance.destroy()"},{"line_number":1840,"context_line":""},{"line_number":1841,"context_line":"        self.assertEqual(0, self.commands.delete_cell(uuidsentinel.cell1,"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa0c359_1a839158","line":1838,"in_reply_to":"3fa0c359_88b694dc","updated":"2018-02-15 17:47:05.000000000","message":"Done","commit_id":"68f0b4f05c0bbc5ec6822c0a95df4141e51db629"}]}
