On Mon, Oct 12, 2020 at 09:12:50AM -0400, Cole Robinson wrote:
On 10/12/20 5:05 AM, Daniel P. Berrangé wrote:
> On Mon, Oct 12, 2020 at 10:55:52AM +0200, Michal Privoznik wrote:
>> On 10/12/20 10:50 AM, Daniel P. Berrangé wrote:
>>> On Sun, Oct 11, 2020 at 07:44:36PM -0400, Cole Robinson wrote:
>>>> If storage migration is requested, and the destination storage does
>>>> not exist on the remote host, qemu's migration support will call
>>>> into the libvirt storage driver to precreate the destination storage.
>>>>
>>>> The storage driver virConnectPtr is opened too early though, adding
>>>> an unnecessary dependency on the storage driver for several cases
>>>> that don't require it. This currently requires kubevirt to install
>>>> the storage driver even though they aren't actually using it.
>>>>
>>>> Push the virGetConnectStorage calls to right before the cases they are
>>>> actually needed.
>>>
>>> This pushes the connection open attempts inside a loop body. So if the
>>> VM has multiple disks, then we're going to be repeatedly opening and
>>> closing the connection which is not desirable.
>>>
>>> I think we need a global connection across all disks, which is lazy
>>> opened on first access.
>>
>> Doesn't virGetConnectStorage() cache the connection?
>
> Yes & no.
>
> You can call virSetConnectStorage(conn) to populate the cache with a
> pre-opened connection. If you haven't done that, then a new connection
> will be opened every time. The ltter is what this code will be doing.
>
What is the use case for not caching the connection by default?
It is a matter of figuring out an invalidation strategy, so we don't
keep the other daemons running continuously when no client is actually
triggering their usage.
virSetConnect* has very few users, but virGetConnect* is sprinkled
in
many places, including multiple uses in generic code in domain_conf.c.
Can this be done as part of virGetConnect*?
Regards,
Daniel
--
|:
https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|:
https://libvirt.org -o-
https://fstop138.berrange.com :|
|:
https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|