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

[libvirt] [PATCH v4 16/17] Openvz --ipadd can be provided multiple times



Vzctl man page says that --ipadd can be provided multiple times to add
several IP addresses. Looping over the configured ip addresses to add
one --ipadd for each. This would even handle the multiple IPs handled
by openvz_conf.c
---
 src/openvz/openvz_driver.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 273bac1..68cc841 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -907,9 +907,13 @@ openvzDomainSetNetwork(virConnectPtr conn, const char *vpsid,
         virCommandAddArgBuffer(cmd, &buf);
     } else if (net->type == VIR_DOMAIN_NET_TYPE_ETHERNET &&
               net->nips > 0) {
+        size_t i;
+
         /* --ipadd ip */
-        char *ipStr = virSocketAddrFormat(&net->ips[0]->address);
-        virCommandAddArgList(cmd, "--ipadd", ipStr, NULL);
+        for (i = 0; i < net->nips; i++) {
+            char *ipStr = virSocketAddrFormat(&net->ips[i]->address);
+            virCommandAddArgList(cmd, "--ipadd", ipStr, NULL);
+        }
     }
 
     /* TODO: processing NAT and physical device */
-- 
2.1.2


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