]> xenbits.xensource.com Git - libvirt.git/commitdiff
esx: Make the domain part of the hostname optional
authorMatthias Bolte <matthias.bolte@googlemail.com>
Sat, 16 Jan 2010 00:08:27 +0000 (01:08 +0100)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Mon, 18 Jan 2010 00:21:37 +0000 (01:21 +0100)
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

index 2f346c36a6997a4b591e5458f93f2ba8eb019f25..a1cb04973bf40192bdb05a7b2e7ba0175a220206 100644 (file)
@@ -783,14 +783,17 @@ esxGetHostname(virConnectPtr conn)
     }
 
     if (domainName == NULL || strlen(domainName) < 1) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
-                  "Missing or empty 'domainName' property");
-        goto failure;
-    }
+        complete = strdup(hostName);
 
-    if (virAsprintf(&complete, "%s.%s", hostName, domainName) < 0) {
-        virReportOOMError(conn);
-        goto failure;
+        if (complete == NULL) {
+            virReportOOMError(conn);
+            goto failure;
+        }
+    } else {
+        if (virAsprintf(&complete, "%s.%s", hostName, domainName) < 0) {
+            virReportOOMError(conn);
+            goto failure;
+        }
     }
 
   cleanup: