Re: [PATCH 2/3] qemu: mark user defined websocket as used

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

 




On 09.12.2016 15:57, John Ferlan wrote:
> 
> 
> On 12/09/2016 01:51 AM, Nikolay Shirokovskiy wrote:
>>
>>
>> On 08.12.2016 23:07, John Ferlan wrote:
>>>
>>>
>>> On 11/22/2016 06:09 AM, Nikolay Shirokovskiy wrote:
>>>> We need extra state variable to distinguish between autogenerated
>>>> and user defined cases after auto generation is done.
>>>> ---
>>>>  src/conf/domain_conf.h  |  1 +
>>>>  src/qemu/qemu_process.c | 19 +++++++++++++++++--
>>>>  2 files changed, 18 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
>>>> index 541b600..9bc4522 100644
>>>> --- a/src/conf/domain_conf.h
>>>> +++ b/src/conf/domain_conf.h
>>>> @@ -1468,6 +1468,7 @@ struct _virDomainGraphicsDef {
>>>>              int port;
>>>>              bool portReserved;
>>>>              int websocket;
>>>> +            bool websocketGenerated;
>>>>              bool autoport;
>>>>              char *keymap;
>>>>              virDomainGraphicsAuthDef auth;
>>>> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
>>>> index 6aaaa10..1799f33 100644
>>>> --- a/src/qemu/qemu_process.c
>>>> +++ b/src/qemu/qemu_process.c
>>>> @@ -3574,6 +3574,7 @@ qemuProcessVNCAllocatePorts(virQEMUDriverPtr driver,
>>>>          if (virPortAllocatorAcquire(driver->webSocketPorts, &port) < 0)
>>>>              return -1;
>>>>          graphics->data.vnc.websocket = port;
>>>> +        graphics->data.vnc.websocketGenerated = true;
>>>>      }
>>>>  
>>>>      return 0;
>>>> @@ -4065,6 +4066,12 @@ qemuProcessGraphicsReservePorts(virQEMUDriverPtr driver,
>>>>                  return -1;
>>>>              graphics->data.vnc.portReserved = true;
>>>>          }
>>>> +        if (graphics->data.vnc.websocket != -1 &&   /* auto websocket */
>>>> +            graphics->data.vnc.websocket &&         /* no websocket */
>>>> +            virPortAllocatorSetUsed(driver->remotePorts,
>>>> +                                    graphics->data.vnc.websocket,
>>>> +                                    true) < 0)
>>>> +            return -1;
>>>>          break;
>>>>  
>>>>      case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
>>>> @@ -6189,8 +6196,16 @@ void qemuProcessStop(virQEMUDriverPtr driver,
>>>>                                          false);
>>>>                  graphics->data.vnc.portReserved = false;
>>>>              }
>>>> -            virPortAllocatorRelease(driver->webSocketPorts,
>>>> -                                    graphics->data.vnc.websocket);
>>>> +            if (graphics->data.vnc.websocketGenerated) {
>>>> +                virPortAllocatorRelease(driver->webSocketPorts,
>>>> +                                        graphics->data.vnc.websocket);
>>>> +                graphics->data.vnc.websocketGenerated = false;
>>>> +                graphics->data.vnc.websocket = -1;
>>>
>>> One more question... Should this be 0 instead of -1?
>>>
>>> We set to -1 during Reserve and set the Generated flag indicating that
>>> the user didn't set to -1, but we did.
>>
>> Not quite. -1 is valid user input. Reserve does not change websocket value.
>>
> 
> Oh right - I think I was crossing thoughts and thinking setting to -1
> was internally done...
> 
> The series is now pushed
> 
> Tks,
> 
> John

Thankx!

--
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]
  Powered by Linux