From 48dbd70e39ca1abf5a0487a38fd05766ec81d62e Mon Sep 17 00:00:00 2001 From: Andrea Bolognani Date: Fri, 15 Feb 2019 12:26:13 +0100 Subject: [PATCH] conf: Introduce virDomainNetDefPostParse() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Minor tweaks to ensure compliance with our coding style. Signed-off-by: Andrea Bolognani Reviewed-by: Ján Tomko --- src/conf/domain_conf.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d79a961f29..f0c62f0de9 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4933,6 +4933,18 @@ virDomainControllerDefPostParse(virDomainControllerDefPtr cdev) } +static int +virDomainNetDefPostParse(virDomainNetDefPtr net) +{ + if (!virDomainNetIsVirtioModel(net) && + virDomainCheckVirtioOptions(net->virtio) < 0) { + return -1; + } + + return 0; +} + + static int virDomainVsockDefPostParse(virDomainVsockDefPtr vsock) { @@ -4973,12 +4985,8 @@ virDomainDeviceDefPostParseCommon(virDomainDeviceDefPtr dev, if (dev->type == VIR_DOMAIN_DEVICE_CONTROLLER) return virDomainControllerDefPostParse(dev->data.controller); - if (dev->type == VIR_DOMAIN_DEVICE_NET) { - virDomainNetDefPtr net = dev->data.net; - if (!virDomainNetIsVirtioModel(net) && - virDomainCheckVirtioOptions(net->virtio) < 0) - return -1; - } + if (dev->type == VIR_DOMAIN_DEVICE_NET) + return virDomainNetDefPostParse(dev->data.net); if (dev->type == VIR_DOMAIN_DEVICE_VSOCK && virDomainVsockDefPostParse(dev->data.vsock) < 0)