[libvirt] [PATCH 1/2] driver: Include source parameter to virDomainGetHostname

Michal Privoznik mprivozn at redhat.com
Mon Nov 25 16:06:31 UTC 2019


On 11/24/19 10:33 PM, Julio Faracco wrote:
> Thanks for your explanation, Peter!
> 
> I will focus on LXC side then...
> 

You may still implement the API for other drivers too. The way we 
addressed this problem in the past is to create new API and have the old 
one call the new one. That's why we have "virSomething WithFlags()" APIs 
- because simply when introducing virSomething() API we did not think of 
adding flags. But if you then look how virSomething is implemented at 
driver level (say qemu driver) then you will see virSomething() is a 
very thin wrapper that calls virSomethingWithFlags(..., 0);.


For instance virDomainCreate() and virDomainCreateWithFlags() and 
qemuDomainCreate() and qemuDomainCreateWithFlags().

So you will need to add a new API and then have the old call the new one 
with sensible @source. Since the sensible value can differ among drivers 
I guess we can have VIR_DOMAIN_HOSTNAME_SRC_DEFAULT which would mean 
"hypervisor driver default as in the most sensible source chosen 
automatically by driver".


Michal




More information about the libvir-list mailing list