[libvirt] [PATCH 2/2] qemu: don't update cpu unconditionally for migratable flag

Nikolay Shirokovskiy nshirokovskiy at virtuozzo.com
Thu Sep 21 14:32:33 UTC 2017



On 21.09.2017 17:24, Jiri Denemark wrote:
> On Thu, Sep 21, 2017 at 16:39:39 +0300, Nikolay Shirokovskiy wrote:
>> Imagine if we use 'virsh dumpxml --migratable' for offline domain
>> to get config to tweak before migration. Currenly cpu section will
>> be expanded, host-cpu mode turns into custom and migration fails
>> because of ABI check.
>>
>> Looks like ABI check does not make much sence for offline migration
>> but we don't want host-cpu mode to turn into custom in the first place.
>> Using --migratable is reasonable in this case because this flags
>> makes changes for inactive configs too like removing automatically
>> added parts that old versions can not handle.
>>
>> I suggest not to update cpu for inactive configs. This appoach is
>> coherent with the way migration works for inactive configs in case
>> it is not specified externally to migration: function qemuMigrationCookieXMLFormat
>> don't expand cpu too.
>>
>> Adding flag for active configs is useless because qemuDomainFormatXML
>> will clear it in this case.
> 
> Not anymore, see commit v3.7.0-151-g06f75ff2cb.

Is g06f75ff2cb commit in public libvirt tree? I can't see it even on https://libvirt.org/git/?p=libvirt.git;a=summary.


> 
> ...
>> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
>> index d9dff93..3223554 100644
>> --- a/src/qemu/qemu_driver.c
>> +++ b/src/qemu/qemu_driver.c
>> @@ -6993,9 +6993,6 @@ static char
>>      if (qemuDomainUpdateCurrentMemorySize(driver, vm) < 0)
>>          goto cleanup;
>>  
>> -    if ((flags & VIR_DOMAIN_XML_MIGRATABLE))
>> -        flags |= VIR_DOMAIN_XML_UPDATE_CPU;
>> -
>>      ret = qemuDomainFormatXML(driver, vm, flags);
>>  
>>   cleanup:
> 
> This area of code changed recently and it looks like the following now:
> 
>     if ((flags & VIR_DOMAIN_XML_MIGRATABLE))
>         flags |= QEMU_DOMAIN_FORMAT_LIVE_FLAGS;
> 
>     /* The CPU is already updated in the domain's live definition, we need to
>      * ignore the VIR_DOMAIN_XML_UPDATE_CPU flag.
>      */
>     if (virDomainObjIsActive(vm) &&
>         !(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE))
>         flags &= ~VIR_DOMAIN_XML_UPDATE_CPU;
> 
> But even before the changes, the two lines you are removing were
> 
>     if ((flags & VIR_DOMAIN_XML_MIGRATABLE))
>         flags |= QEMU_DOMAIN_FORMAT_LIVE_FLAGS;
> 
> since commit v0.10.2-133-g28f8dfdccc, i.e., for the last 5 years. I
> guess you have some local changes applied to the libvirt tree.
> 

))) The previous commit in series touch this place.

Nikolay
 




More information about the libvir-list mailing list