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

[libvirt] [PATCH 2/2] vmx: Better Workstation vmx handling



This patch adds support for vmx files with empty networkName
values (which is the case for vmx generated by Workstation).

It also adds support for vmx containing NATed network interfaces.
---
 src/vmx/vmx.c |   29 ++++++++++++++++++-----------
 1 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 823d5df..3cc3b10 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -2418,12 +2418,20 @@ virVMXParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def)
     }
 
     /* vmx:networkName -> def:data.bridge.brname */
-    if ((connectionType == NULL ||
-         STRCASEEQ(connectionType, "bridged") ||
-         STRCASEEQ(connectionType, "custom")) &&
-        virVMXGetConfigString(conf, networkName_name, &networkName,
-                              false) < 0) {
-        goto cleanup;
+    if (connectionType == NULL ||
+        STRCASEEQ(connectionType, "bridged") ||
+        STRCASEEQ(connectionType, "custom")) {
+        if (virVMXGetConfigString(conf, networkName_name, &networkName,
+                                  true) < 0)
+            goto cleanup;
+
+        if (networkName == NULL) {
+            networkName = strdup("");
+            if (networkName == NULL) {
+                virReportOOMError();
+                goto cleanup;
+            }
+        }
     }
 
     /* vmx:vnet -> def:data.ifname */
@@ -2447,11 +2455,10 @@ virVMXParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def)
                   connectionType, connectionType_name);
         goto cleanup;
     } else if (STRCASEEQ(connectionType, "nat")) {
-        /* FIXME */
-        VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
-                  _("No yet handled value '%s' for VMX entry '%s'"),
-                  connectionType, connectionType_name);
-        goto cleanup;
+        (*def)->type = VIR_DOMAIN_NET_TYPE_USER;
+        (*def)->model = virtualDev;
+
+        virtualDev = NULL;
     } else if (STRCASEEQ(connectionType, "custom")) {
         (*def)->type = VIR_DOMAIN_NET_TYPE_BRIDGE;
         (*def)->model = virtualDev;
-- 
1.7.9


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