|
|
147b37 |
From 84131c477c2c5b512723e96b59528a93ed7d41c4 Mon Sep 17 00:00:00 2001
|
|
|
147b37 |
Message-Id: <84131c477c2c5b512723e96b59528a93ed7d41c4@dist-git>
|
|
|
147b37 |
From: Pino Toscano <ptoscano@redhat.com>
|
|
|
147b37 |
Date: Thu, 12 Apr 2018 17:26:19 +0200
|
|
|
147b37 |
Subject: [PATCH] vmx: allocate space for network interfaces if needed
|
|
|
147b37 |
MIME-Version: 1.0
|
|
|
147b37 |
Content-Type: text/plain; charset=UTF-8
|
|
|
147b37 |
Content-Transfer-Encoding: 8bit
|
|
|
147b37 |
|
|
|
147b37 |
Dynamically grow the array of network interfaces for each interface
|
|
|
147b37 |
read, instead of using a single array of size 4. This way, in the
|
|
|
147b37 |
future it will be easier to not limit the number of network interfaces
|
|
|
147b37 |
(which this patch still does not change).
|
|
|
147b37 |
|
|
|
147b37 |
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
|
|
|
147b37 |
(cherry picked from commit 6d394989fda53b53f0a21522bebe44ea01a40de9)
|
|
|
147b37 |
|
|
|
147b37 |
https: //bugzilla.redhat.com/show_bug.cgi?id=1566524
|
|
|
147b37 |
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
|
|
|
147b37 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
147b37 |
---
|
|
|
147b37 |
src/vmx/vmx.c | 17 +++++++----------
|
|
|
147b37 |
1 file changed, 7 insertions(+), 10 deletions(-)
|
|
|
147b37 |
|
|
|
147b37 |
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
|
|
|
147b37 |
index 85bf195cd7..3433f39d5c 100644
|
|
|
147b37 |
--- a/src/vmx/vmx.c
|
|
|
147b37 |
+++ b/src/vmx/vmx.c
|
|
|
147b37 |
@@ -1751,19 +1751,16 @@ virVMXParseConfig(virVMXContext *ctx,
|
|
|
147b37 |
}
|
|
|
147b37 |
|
|
|
147b37 |
/* def:nets */
|
|
|
147b37 |
- if (VIR_ALLOC_N(def->nets, 4) < 0)
|
|
|
147b37 |
- goto cleanup;
|
|
|
147b37 |
-
|
|
|
147b37 |
- def->nnets = 0;
|
|
|
147b37 |
-
|
|
|
147b37 |
for (controller = 0; controller < 4; ++controller) {
|
|
|
147b37 |
- if (virVMXParseEthernet(conf, controller,
|
|
|
147b37 |
- &def->nets[def->nnets]) < 0) {
|
|
|
147b37 |
+ virDomainNetDefPtr net = NULL;
|
|
|
147b37 |
+ if (virVMXParseEthernet(conf, controller, &net) < 0)
|
|
|
147b37 |
goto cleanup;
|
|
|
147b37 |
- }
|
|
|
147b37 |
|
|
|
147b37 |
- if (def->nets[def->nnets] != NULL)
|
|
|
147b37 |
- ++def->nnets;
|
|
|
147b37 |
+ if (!net)
|
|
|
147b37 |
+ continue;
|
|
|
147b37 |
+
|
|
|
147b37 |
+ if (VIR_APPEND_ELEMENT(def->nets, def->nnets, net) < 0)
|
|
|
147b37 |
+ goto cleanup;
|
|
|
147b37 |
}
|
|
|
147b37 |
|
|
|
147b37 |
/* def:inputs */
|
|
|
147b37 |
--
|
|
|
147b37 |
2.17.0
|
|
|
147b37 |
|