Improve error reporting for virConnectGetHostname calls

All drivers have copy + pasted inadequate error reporting which wraps
util.c:virGetHostname. Move all error reporting to this function, and improve
what we report.

Changes from v1:
  Drop the driver wrappers around virGetHostname. This means we still need
  to keep the new conn argument to virGetHostname, but I think it's worth
  it.
This commit is contained in:
Cole Robinson
2009-10-23 13:01:22 -04:00
parent af1e2ede26
commit 517761fd96
11 changed files with 29 additions and 113 deletions

View File

@@ -972,11 +972,10 @@ static int qemudNetworkInit(struct qemud_server *server) {
if (!mdns_name) {
char groupname[64], *localhost, *tmp;
/* Extract the host part of the potentially FQDN */
localhost = virGetHostname();
if (localhost == NULL) {
virReportOOMError(NULL);
localhost = virGetHostname(NULL);
if (localhost == NULL)
goto cleanup;
}
if ((tmp = strchr(localhost, '.')))
*tmp = '\0';
snprintf(groupname, sizeof(groupname)-1, "Virtualization Host %s", localhost);