[libvirt] [PATCH] libxl: mark domain0 as persistent

Jim Fehlig posted 1 patch 6 years, 4 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20171213214153.25144-1-jfehlig@suse.com
src/libxl/libxl_driver.c | 1 +
1 file changed, 1 insertion(+)
[libvirt] [PATCH] libxl: mark domain0 as persistent
Posted by Jim Fehlig 6 years, 4 months ago
A Xen domain0 is better described as a persistent domain. Mark it
as such during intialization.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
---

I noticed this while debugging a libvirt-guests issue. The list_guests()
function filters domain0 with

echo "$list" | grep -v 00000000-0000-0000-0000-000000000000

If domain0 is the only item in $list, the grep returns 1, causing
a failure of the stop operation when action is suspend. This
patch fixes the libvirt-guests issue, but I can also send a patch
to improve the filter if desired. E.g.

echo "$list" | sed "s/00000000-0000-0000-0000-000000000000//g"

 src/libxl/libxl_driver.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 40328a6cb..79e29ce07 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -609,6 +609,7 @@ libxlAddDom0(libxlDriverPrivatePtr driver)
 
     def = NULL;
 
+    vm->persistent = 1;
     virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_BOOTED);
     if (virDomainDefSetVcpusMax(vm->def, d_info.vcpu_max_id + 1, driver->xmlopt))
         goto cleanup;
-- 
2.15.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] libxl: mark domain0 as persistent
Posted by Michal Privoznik 6 years, 4 months ago
On 12/13/2017 10:41 PM, Jim Fehlig wrote:
> A Xen domain0 is better described as a persistent domain. Mark it
> as such during intialization.
> 
> Signed-off-by: Jim Fehlig <jfehlig@suse.com>
> ---
> 
> I noticed this while debugging a libvirt-guests issue. The list_guests()
> function filters domain0 with
> 
> echo "$list" | grep -v 00000000-0000-0000-0000-000000000000
> 
> If domain0 is the only item in $list, the grep returns 1, causing
> a failure of the stop operation when action is suspend. This
> patch fixes the libvirt-guests issue, but I can also send a patch
> to improve the filter if desired. E.g.
> 
> echo "$list" | sed "s/00000000-0000-0000-0000-000000000000//g"
> 
>  src/libxl/libxl_driver.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
> index 40328a6cb..79e29ce07 100644
> --- a/src/libxl/libxl_driver.c
> +++ b/src/libxl/libxl_driver.c
> @@ -609,6 +609,7 @@ libxlAddDom0(libxlDriverPrivatePtr driver)
>  
>      def = NULL;
>  
> +    vm->persistent = 1;
>      virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_BOOTED);
>      if (virDomainDefSetVcpusMax(vm->def, d_info.vcpu_max_id + 1, driver->xmlopt))
>          goto cleanup;
> 

I think this is orthogonal to libvirt-guests fix. dom0 should be marked
as persistent because it is persistent. I mean, even though we don't
store its config anywhere, we can't really get rid of it (udefine &&
destroy).

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] libxl: mark domain0 as persistent
Posted by Jim Fehlig 6 years, 4 months ago
On 12/14/2017 12:15 AM, Michal Privoznik wrote:
> On 12/13/2017 10:41 PM, Jim Fehlig wrote:
>> A Xen domain0 is better described as a persistent domain. Mark it
>> as such during intialization.
>>
>> Signed-off-by: Jim Fehlig <jfehlig@suse.com>
>> ---
>>
>> I noticed this while debugging a libvirt-guests issue. The list_guests()
>> function filters domain0 with
>>
>> echo "$list" | grep -v 00000000-0000-0000-0000-000000000000
>>
>> If domain0 is the only item in $list, the grep returns 1, causing
>> a failure of the stop operation when action is suspend. This
>> patch fixes the libvirt-guests issue, but I can also send a patch
>> to improve the filter if desired. E.g.
>>
>> echo "$list" | sed "s/00000000-0000-0000-0000-000000000000//g"
>>
>>   src/libxl/libxl_driver.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
>> index 40328a6cb..79e29ce07 100644
>> --- a/src/libxl/libxl_driver.c
>> +++ b/src/libxl/libxl_driver.c
>> @@ -609,6 +609,7 @@ libxlAddDom0(libxlDriverPrivatePtr driver)
>>   
>>       def = NULL;
>>   
>> +    vm->persistent = 1;
>>       virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_BOOTED);
>>       if (virDomainDefSetVcpusMax(vm->def, d_info.vcpu_max_id + 1, driver->xmlopt))
>>           goto cleanup;
>>
> 
> I think this is orthogonal to libvirt-guests fix. dom0 should be marked
> as persistent because it is persistent. I mean, even though we don't
> store its config anywhere, we can't really get rid of it (udefine &&
> destroy).

Right, that's why I didn't mention libvirt-guests in the commit message. Is it 
ok to push this patch and send another for the libvirt-guests improvement?

Regards,
Jim

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] libxl: mark domain0 as persistent
Posted by Michal Privoznik 6 years, 4 months ago
On 12/14/2017 05:53 PM, Jim Fehlig wrote:
> On 12/14/2017 12:15 AM, Michal Privoznik wrote:
>> On 12/13/2017 10:41 PM, Jim Fehlig wrote:
>>> A Xen domain0 is better described as a persistent domain. Mark it
>>> as such during intialization.
>>>
>>> Signed-off-by: Jim Fehlig <jfehlig@suse.com>
>>> ---
>>>
>>> I noticed this while debugging a libvirt-guests issue. The list_guests()
>>> function filters domain0 with
>>>
>>> echo "$list" | grep -v 00000000-0000-0000-0000-000000000000
>>>
>>> If domain0 is the only item in $list, the grep returns 1, causing
>>> a failure of the stop operation when action is suspend. This
>>> patch fixes the libvirt-guests issue, but I can also send a patch
>>> to improve the filter if desired. E.g.
>>>
>>> echo "$list" | sed "s/00000000-0000-0000-0000-000000000000//g"
>>>
>>>   src/libxl/libxl_driver.c | 1 +
>>>   1 file changed, 1 insertion(+)
>>>
>>> diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
>>> index 40328a6cb..79e29ce07 100644
>>> --- a/src/libxl/libxl_driver.c
>>> +++ b/src/libxl/libxl_driver.c
>>> @@ -609,6 +609,7 @@ libxlAddDom0(libxlDriverPrivatePtr driver)
>>>         def = NULL;
>>>   +    vm->persistent = 1;
>>>       virDomainObjSetState(vm, VIR_DOMAIN_RUNNING,
>>> VIR_DOMAIN_RUNNING_BOOTED);
>>>       if (virDomainDefSetVcpusMax(vm->def, d_info.vcpu_max_id + 1,
>>> driver->xmlopt))
>>>           goto cleanup;
>>>
>>
>> I think this is orthogonal to libvirt-guests fix. dom0 should be marked
>> as persistent because it is persistent. I mean, even though we don't
>> store its config anywhere, we can't really get rid of it (udefine &&
>> destroy).
> 
> Right, that's why I didn't mention libvirt-guests in the commit message.
> Is it ok to push this patch and send another for the libvirt-guests
> improvement?

Oh right. Sorry, I forgot to write it explicitly: ACK.

Michal

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