[libvirt] [PATCH 05/18] virDomainControllerDefFormat: move PCI model and target formatting

Pavel Hrdina phrdina at redhat.com
Sat Jun 3 09:46:26 UTC 2017


On Tue, May 30, 2017 at 02:50:28PM +0200, Ján Tomko wrote:
> These can be formatted right when we know we will need them.
> No need for separate bool variables.
> ---
>  src/conf/domain_conf.c | 30 +++++++++++-------------------
>  1 file changed, 11 insertions(+), 19 deletions(-)

I don't think that we should mix formatting controller attributes with
controller sub-elements into one switch.

We can drop "VIR_DOMAIN_CONTROLLER_TYPE_PCI" from that switch and drop
all the pci(hole64|Model|Target) variables and use this instead:

if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI) {
    if (def->opts.pciopts.modelName != VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE) {
        format model
    }

    if (def->opts.pciopts.chassisNr != -1 || ...) {
        format target
    }
}

...

if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI &&
    def->opts.pciopts.pcihole64) {
    format holes64    
}

Pavel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170603/a1525a9c/attachment-0001.sig>


More information about the libvir-list mailing list