Re: [PATCH 1/2] qemu: set jobinfo type to CANCELLED if migration is cancelled in all conditions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2014/11/27 18:48, Martin Kletzander wrote:
> On Thu, Nov 27, 2014 at 04:26:24PM +0800, Wang Rui wrote:
>> The migration job status is traced in qemuMigrationUpdateJobStatus which is
>> called in qemuMigrationRun. But if migration is cancelled before the trace
>> such as in qemuMigrationDriveMirror, the jobinfo type won't be update to
>> CANCELLED. After this patch, we can get jobinfo type as CANCELLED if migration
>> is cancelled during the drive mirror migration.
>>
>> Signed-off-by: Wang Rui <moon.wangrui@xxxxxxxxxx>
>> ---
>> src/qemu/qemu_migration.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
>> index a1b1458..c678ba7 100644
>> --- a/src/qemu/qemu_migration.c
>> +++ b/src/qemu/qemu_migration.c
>> @@ -1504,6 +1504,7 @@ qemuMigrationDriveMirror(virQEMUDriverPtr driver,
>>                  * as this is a critical section so we are guaranteed
>>                  * priv->job.asyncAbort will not change */
>>                 qemuDomainObjExitMonitor(driver, vm);
>> +                priv->job.current->type = VIR_DOMAIN_JOB_CANCELLED;
>>                 virReportError(VIR_ERR_OPERATION_ABORTED, _("%s: %s"),
>>                                qemuDomainAsyncJobTypeToString(priv->job.asyncJob),
>>                                _("canceled by client"));
>> @@ -3611,6 +3612,7 @@ qemuMigrationRun(virQEMUDriverPtr driver,
>>          * as this is a critical section so we are guaranteed
>>          * priv->job.asyncAbort will not change */
>>         qemuDomainObjExitMonitor(driver, vm);
>> +        priv->job.current->type = VIR_DOMAIN_JOB_CANCELLED;
>>         virReportError(VIR_ERR_OPERATION_ABORTED, _("%s: %s"),
>>                        qemuDomainAsyncJobTypeToString(priv->job.asyncJob),
>>                        _("canceled by client"));
>> -- 
>> 1.7.12.4
>>
> 
> Can't we use qemuMigrationUpdateJobStatus() here?
> 
> Martin

Hi, thanks for your reply.

I don't think we can.
I tried this way but couldn't get jobinfo type as CANCELLED if I cancelled it
during drive mirror migration. When libvirt sends qmp "migrate_cancel" to QEMU,
QEMU only sets its state if its old state is MIG_STATE_SETUP or MIG_STATE_ACTIVE.
But in drive mirror migration, QEMU's state is MIG_STATE_NONE.

static void migrate_fd_cancel(MigrationState *s)
{
...

        old_state = s->state;
        if (old_state != MIG_STATE_SETUP && old_state != MIG_STATE_ACTIVE) {
            break;
...
}

So we haven't set QEMU's state to CANCELLED. And then if we query status in libvirt
by qemuMigrationUpdateJobStatus, QEMU won't tell us the right status.

MigrationInfo *qmp_query_migrate(Error **errp)
{
...
    switch (s->state) {
    case MIG_STATE_NONE:
        /* no migration has happened ever */
        break;
...
}

Another reason why I don't use qemuMigrationUpdateJobStatus is considering job failed in
libvirt(in my patch 2/2). If job is failed in libvirt, it's not accurate to query job
status from QEMU.

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]