[libvirt] [PATCH] esx: Make the domain part of the hostname optional

Matthias Bolte matthias.bolte at googlemail.com
Sat Jan 16 14:22:01 UTC 2010


Before the driver assumed that there is always a domain part. That's
not true. Now the domain part is handled as optional.
---
 src/esx/esx_driver.c |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 4ed4533..aeb3d07 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -773,14 +773,17 @@ esxGetHostname(virConnectPtr conn)
     }
 
     if (domainName == NULL || strlen(domainName) < 1) {
-        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
-                  "Missing or empty 'domainName' property");
-        goto failure;
-    }
+        complete = strdup(hostName);
 
-    if (virAsprintf(&complete, "%s.%s", hostName, domainName) < 0) {
-        virReportOOMError(NULL);
-        goto failure;
+        if (complete == NULL) {
+            virReportOOMError(NULL);
+            goto failure;
+        }
+    } else {
+        if (virAsprintf(&complete, "%s.%s", hostName, domainName) < 0) {
+            virReportOOMError(NULL);
+            goto failure;
+        }
     }
 
   cleanup:
-- 
1.6.3.3




More information about the libvir-list mailing list