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