)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":27615,"name":"Rajat Dhasmana","email":"rajatdhasmana@gmail.com","username":"whoami-rajat"},"change_message_id":"a25ad4083b22fd644fd49503ae1812e29edd487a","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"86019d1d_3ab98211","updated":"2025-03-26 22:24:30.000000000","message":"I was testing this locally and tried the following scenarios:\n\n1. Retype from LVM to RBD (no attachments)\nThe optimized path rejected the migration stating that the volume should be available[1]\n\n    if volume[\u0027status\u0027] !\u003d \u0027available\u0027:\n        return false_ret\n        \nIt returned because the volume status was \u0027retyping\u0027\n\n2. Retype from RBD to LVM (no attachments)\n\nThis time it refused to migrate since RBD expects the source and destination to be RBD backends[2].\n\n3. Retype from LVM to RBD (with attachments)\n\nRefuses optimized path and goes to the generic migration path due to the attachment check we have.\n\nOverall I\u0027m happy that this is triggering the right code path but surely we have improvements to make into our drivers to better handle the retype+migration requests.\n\n[1] https://github.com/openstack/cinder/blob/f5493ad62d16222b2ebb27bce6d9f7079fd0115c/cinder/volume/drivers/lvm.py#L760-L761\n\n[2] https://github.com/openstack/cinder/blob/f5493ad62d16222b2ebb27bce6d9f7079fd0115c/cinder/volume/drivers/rbd.py#L2338-L2342","commit_id":"b8610a01b61cf86db2f31e26eb0d4dab4a812ace"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"b40ba10a44e6a4b681715320cf1f7dddafa9c73f","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"615718d4_d3f6e666","updated":"2025-03-26 21:49:59.000000000","message":"Thanks for revising Gorka\u0027s patch, Alan.  LGTM.","commit_id":"b8610a01b61cf86db2f31e26eb0d4dab4a812ace"},{"author":{"_account_id":21129,"name":"Alan Bishop","email":"abishopsweng@gmail.com","username":"ASBishop","status":"ex Red Hat"},"change_message_id":"fbd5536f4110f19598e95abb63b7adae3046afb5","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"a20b8458_5c12284d","updated":"2025-01-10 05:11:12.000000000","message":"recheck\n\nspurious vm resize timed out","commit_id":"b8610a01b61cf86db2f31e26eb0d4dab4a812ace"},{"author":{"_account_id":27615,"name":"Rajat Dhasmana","email":"rajatdhasmana@gmail.com","username":"whoami-rajat"},"change_message_id":"da3fa59e050a9ab6eab94098993e975bb02b2068","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"f09a8797_b83a48d9","in_reply_to":"86019d1d_3ab98211","updated":"2025-03-27 06:45:19.000000000","message":"Fixed the LVM issue here https://review.opendev.org/c/openstack/cinder/+/945680","commit_id":"b8610a01b61cf86db2f31e26eb0d4dab4a812ace"}],"cinder/volume/manager.py":[{"author":{"_account_id":30555,"name":"Fernando Ferraz","display_name":"Fernando Ferraz","email":"fesilva@redhat.com","username":"fernandoperches"},"change_message_id":"f684a559c60b1b6db06242bbae0cb8ffe8ed93b1","unresolved":true,"context_lines":[{"line_number":2662,"context_line":"        # Do not attempt driver assisted migration when the volume has"},{"line_number":2663,"context_line":"        # attachments. Nova must be involved when migrating an attached"},{"line_number":2664,"context_line":"        # volume, and that\u0027s handled by the generic migration code."},{"line_number":2665,"context_line":"        if (len(volume.volume_attachment) \u003d\u003d 0 and"},{"line_number":2666,"context_line":"                not force_host_copy and"},{"line_number":2667,"context_line":"                self._can_use_driver_migration(diff)):"},{"line_number":2668,"context_line":"            try:"}],"source_content_type":"text/x-python","patch_set":1,"id":"bd136958_e3bdf061","line":2665,"updated":"2025-03-26 15:10:34.000000000","message":"I would suggest using \"if (volume.volume_attachment and ...\" as it would be safer to access in case of None and the count doesn\u0027t matter. However, I\u0027m almost sure volume_attachment will always return a list, right? I believe this is enforced in obj_make_list (oslo.versionedobjects).","commit_id":"b8610a01b61cf86db2f31e26eb0d4dab4a812ace"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"b40ba10a44e6a4b681715320cf1f7dddafa9c73f","unresolved":true,"context_lines":[{"line_number":2662,"context_line":"        # Do not attempt driver assisted migration when the volume has"},{"line_number":2663,"context_line":"        # attachments. Nova must be involved when migrating an attached"},{"line_number":2664,"context_line":"        # volume, and that\u0027s handled by the generic migration code."},{"line_number":2665,"context_line":"        if (len(volume.volume_attachment) \u003d\u003d 0 and"},{"line_number":2666,"context_line":"                not force_host_copy and"},{"line_number":2667,"context_line":"                self._can_use_driver_migration(diff)):"},{"line_number":2668,"context_line":"            try:"}],"source_content_type":"text/x-python","patch_set":1,"id":"d7193d8a_a0c5ed02","line":2665,"in_reply_to":"5e2ebbb3_3c9a0ced","updated":"2025-03-26 21:49:59.000000000","message":"Good question, Fernando.  I think the idea is that when using oslo versioned objects, you need to take advantage of the __len__() defined on whatever\u0027s in the field, because its content could be non-None yet represent zero objects.  So this is the common openstack pattern for checking whether there are any of these things or not.","commit_id":"b8610a01b61cf86db2f31e26eb0d4dab4a812ace"},{"author":{"_account_id":27615,"name":"Rajat Dhasmana","email":"rajatdhasmana@gmail.com","username":"whoami-rajat"},"change_message_id":"a25ad4083b22fd644fd49503ae1812e29edd487a","unresolved":true,"context_lines":[{"line_number":2662,"context_line":"        # Do not attempt driver assisted migration when the volume has"},{"line_number":2663,"context_line":"        # attachments. Nova must be involved when migrating an attached"},{"line_number":2664,"context_line":"        # volume, and that\u0027s handled by the generic migration code."},{"line_number":2665,"context_line":"        if (len(volume.volume_attachment) \u003d\u003d 0 and"},{"line_number":2666,"context_line":"                not force_host_copy and"},{"line_number":2667,"context_line":"                self._can_use_driver_migration(diff)):"},{"line_number":2668,"context_line":"            try:"}],"source_content_type":"text/x-python","patch_set":1,"id":"867cd721_176f5f67","line":2665,"in_reply_to":"5e2ebbb3_3c9a0ced","updated":"2025-03-26 22:24:30.000000000","message":"The short answer is YES, an empty volume_attachment will always return a list.\nThe long answer is as follows:\n\n1. The volume.volume_attachment is a VolumeAttachmentList object\nThis is how it looks when it\u0027s empty\n\n        (Pdb) volume.volume_attachment\n        VolumeAttachmentList(objects\u003d[])\n    \n2. If we look at the hierarchy of classes,\n\nVolumeAttachmentList:\nVolumeAttachmentList \u003c- ObjectListBase \u003c- collections.abc.Sequence\n\nList:\nlist \u003c- collections.abc.MutableSequence \u003c- collections.abc.Sequence\n\nAnd both implement methods for making the container iterable\nFollowing example confirms that they origin from same class,\n\n    \u003e\u003e\u003e from collections.abc import Sequence\n    \u003e\u003e\u003e print(isinstance([], Sequence))\n    True","commit_id":"b8610a01b61cf86db2f31e26eb0d4dab4a812ace"},{"author":{"_account_id":30555,"name":"Fernando Ferraz","display_name":"Fernando Ferraz","email":"fesilva@redhat.com","username":"fernandoperches"},"change_message_id":"f34d8d6405fe87875ad4e4ee49cbe017cf349b4d","unresolved":true,"context_lines":[{"line_number":2662,"context_line":"        # Do not attempt driver assisted migration when the volume has"},{"line_number":2663,"context_line":"        # attachments. Nova must be involved when migrating an attached"},{"line_number":2664,"context_line":"        # volume, and that\u0027s handled by the generic migration code."},{"line_number":2665,"context_line":"        if (len(volume.volume_attachment) \u003d\u003d 0 and"},{"line_number":2666,"context_line":"                not force_host_copy and"},{"line_number":2667,"context_line":"                self._can_use_driver_migration(diff)):"},{"line_number":2668,"context_line":"            try:"}],"source_content_type":"text/x-python","patch_set":1,"id":"5e2ebbb3_3c9a0ced","line":2665,"in_reply_to":"bd136958_e3bdf061","updated":"2025-03-26 15:12:12.000000000","message":"If we are sure volume_attachment returns a empty list when it has no attachments then I think we could just keep your way.","commit_id":"b8610a01b61cf86db2f31e26eb0d4dab4a812ace"}],"releasenotes/notes/retype-assisted-migration-6cdc7f9b21beb859.yaml":[{"author":{"_account_id":5997,"name":"Walt","display_name":"Hemna","email":"waboring@hemna.com","username":"walter-boring","status":"SAP"},"change_message_id":"042b0bc787ca3695ad811757a51ca99575be6257","unresolved":true,"context_lines":[{"line_number":4,"context_line":"    `Bug #1886543 \u003chttps://bugs.launchpad.net/cinder/+bug/1886543\u003e`_:"},{"line_number":5,"context_line":"    On retypes requiring a migration, try to use the driver assisted mechanism"},{"line_number":6,"context_line":"    when moving from one backend to another when we know it\u0027s safe from the"},{"line_number":7,"context_line":"    volume type perspective."}],"source_content_type":"text/x-yaml","patch_set":1,"id":"7e71727d_0ccd526d","line":7,"updated":"2025-03-26 15:09:25.000000000","message":"might be worth mentioning that if a volume is attached this is one of the main reasons it\u0027s not safe.","commit_id":"b8610a01b61cf86db2f31e26eb0d4dab4a812ace"}]}
