[PATCH v2 11/21] migration: Fix migration termination

Cédric Le Goater posted 21 patches 9 months ago
Maintainers: Stefano Stabellini <sstabellini@kernel.org>, Anthony Perard <anthony.perard@citrix.com>, Paul Durrant <paul@xen.org>, Paolo Bonzini <pbonzini@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Eduardo Habkost <eduardo@habkost.net>, "Michael S. Tsirkin" <mst@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Nicholas Piggin <npiggin@gmail.com>, Daniel Henrique Barboza <danielhb413@gmail.com>, "Cédric Le Goater" <clg@kaod.org>, David Gibson <david@gibson.dropbear.id.au>, Harsh Prateek Bora <harshpb@linux.ibm.com>, Halil Pasic <pasic@linux.ibm.com>, Christian Borntraeger <borntraeger@linux.ibm.com>, Eric Farman <farman@linux.ibm.com>, David Hildenbrand <david@redhat.com>, Ilya Leoshkevich <iii@linux.ibm.com>, Thomas Huth <thuth@redhat.com>, Alex Williamson <alex.williamson@redhat.com>, Peter Xu <peterx@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Fabiano Rosas <farosas@suse.de>, Eric Blake <eblake@redhat.com>, Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>, John Snow <jsnow@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, Fam Zheng <fam@euphon.net>, Hyman Huang <yong.huang@smartx.com>
There is a newer version of this series
[PATCH v2 11/21] migration: Fix migration termination
Posted by Cédric Le Goater 9 months ago
Handle migration termination when in SETUP state. This can happen if
qemu_savevm_state_setup() fails.

Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
 migration/migration.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/migration/migration.c b/migration/migration.c
index c1a62b696f62c0d5aca0505e58bc4dc0ff561fde..63294417ff9cae868ad8a167094a795fc30e4da0 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -3161,6 +3161,8 @@ static void migration_iteration_finish(MigrationState *s)
             }
         }
         break;
+    case MIGRATION_STATUS_SETUP:
+        break;
 
     default:
         /* Should not reach here, but if so, forgive the VM. */
@@ -3192,6 +3194,8 @@ static void bg_migration_iteration_finish(MigrationState *s)
     case MIGRATION_STATUS_CANCELLED:
     case MIGRATION_STATUS_CANCELLING:
         break;
+    case MIGRATION_STATUS_SETUP:
+        break;
 
     default:
         /* Should not reach here, but if so, forgive the VM. */
-- 
2.43.2


Re: [PATCH v2 11/21] migration: Fix migration termination
Posted by Peter Xu 9 months ago
On Tue, Feb 27, 2024 at 07:03:35PM +0100, Cédric Le Goater wrote:
> Handle migration termination when in SETUP state. This can happen if
> qemu_savevm_state_setup() fails.
> 
> Signed-off-by: Cédric Le Goater <clg@redhat.com>
> ---
>  migration/migration.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/migration/migration.c b/migration/migration.c
> index c1a62b696f62c0d5aca0505e58bc4dc0ff561fde..63294417ff9cae868ad8a167094a795fc30e4da0 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -3161,6 +3161,8 @@ static void migration_iteration_finish(MigrationState *s)
>              }
>          }
>          break;
> +    case MIGRATION_STATUS_SETUP:
> +        break;
>  
>      default:
>          /* Should not reach here, but if so, forgive the VM. */
> @@ -3192,6 +3194,8 @@ static void bg_migration_iteration_finish(MigrationState *s)
>      case MIGRATION_STATUS_CANCELLED:
>      case MIGRATION_STATUS_CANCELLING:
>          break;
> +    case MIGRATION_STATUS_SETUP:
> +        break;
>  
>      default:
>          /* Should not reach here, but if so, forgive the VM. */

Would this cause "query-migrate" to keep reporting "SETUP" even if setup()
failed?

IIUC we may need to set state to FAILED when setup() failed.  If so, this
patch might not be needed.

Thanks,

-- 
Peter Xu


Re: [PATCH v2 11/21] migration: Fix migration termination
Posted by Cédric Le Goater 9 months ago
On 2/29/24 06:34, Peter Xu wrote:
> On Tue, Feb 27, 2024 at 07:03:35PM +0100, Cédric Le Goater wrote:
>> Handle migration termination when in SETUP state. This can happen if
>> qemu_savevm_state_setup() fails.
>>
>> Signed-off-by: Cédric Le Goater <clg@redhat.com>
>> ---
>>   migration/migration.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/migration/migration.c b/migration/migration.c
>> index c1a62b696f62c0d5aca0505e58bc4dc0ff561fde..63294417ff9cae868ad8a167094a795fc30e4da0 100644
>> --- a/migration/migration.c
>> +++ b/migration/migration.c
>> @@ -3161,6 +3161,8 @@ static void migration_iteration_finish(MigrationState *s)
>>               }
>>           }
>>           break;
>> +    case MIGRATION_STATUS_SETUP:
>> +        break;
>>   
>>       default:
>>           /* Should not reach here, but if so, forgive the VM. */
>> @@ -3192,6 +3194,8 @@ static void bg_migration_iteration_finish(MigrationState *s)
>>       case MIGRATION_STATUS_CANCELLED:
>>       case MIGRATION_STATUS_CANCELLING:
>>           break;
>> +    case MIGRATION_STATUS_SETUP:
>> +        break;
>>   
>>       default:
>>           /* Should not reach here, but if so, forgive the VM. */
> 
> Would this cause "query-migrate" to keep reporting "SETUP" even if setup()
> failed?
> 
> IIUC we may need to set state to FAILED when setup() failed.  If so, this
> patch might not be needed.

Oh yes. you are right. I will see how that can be done.

Thanks for the feedback.

C.