[PATCH 2/5] qemu: domain: Extract network device def post parse code

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

 



Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_domain.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index ab0a823f1e..dbdd94de2f 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -5727,6 +5727,22 @@ qemuDomainDeviceDiskDefPostParse(virDomainDiskDefPtr disk,
 }


+static int
+qemuDomainDeviceNetDefPostParse(virDomainNetDefPtr net,
+                                const virDomainDef *def,
+                                virQEMUCapsPtr qemuCaps)
+{
+    if (net->type != VIR_DOMAIN_NET_TYPE_HOSTDEV &&
+        !net->model) {
+        if (VIR_STRDUP(net->model,
+                       qemuDomainDefaultNetModel(def, qemuCaps)) < 0)
+            return -1;
+    }
+
+    return 0;
+}
+
+
 static int
 qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
                              const virDomainDef *def,
@@ -5744,12 +5760,8 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
     int ret = -1;

     if (dev->type == VIR_DOMAIN_DEVICE_NET &&
-        dev->data.net->type != VIR_DOMAIN_NET_TYPE_HOSTDEV &&
-        !dev->data.net->model) {
-        if (VIR_STRDUP(dev->data.net->model,
-                       qemuDomainDefaultNetModel(def, qemuCaps)) < 0)
-            goto cleanup;
-    }
+        qemuDomainDeviceNetDefPostParse(dev->data.net, def, qemuCaps) < 0)
+        goto cleanup;

     if (dev->type == VIR_DOMAIN_DEVICE_DISK &&
         qemuDomainDeviceDiskDefPostParse(dev->data.disk, cfg) < 0)
-- 
2.16.2

--
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