mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Add more debug logging for libvirtd startup
To facilitate future troubleshooting add a bunch more debugging statements into important startup parts of libvirt
This commit is contained in:
parent
b34324fbf0
commit
50312d4b91
@ -461,6 +461,7 @@ static int daemonSetupNetworking(virNetServerPtr srv,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VIR_DEBUG("Registering unix socket %s", sock_path);
|
||||||
if (!(svc = virNetServerServiceNewUNIX(sock_path,
|
if (!(svc = virNetServerServiceNewUNIX(sock_path,
|
||||||
unix_sock_rw_mask,
|
unix_sock_rw_mask,
|
||||||
unix_sock_gid,
|
unix_sock_gid,
|
||||||
@ -469,15 +470,17 @@ static int daemonSetupNetworking(virNetServerPtr srv,
|
|||||||
config->max_client_requests,
|
config->max_client_requests,
|
||||||
NULL)))
|
NULL)))
|
||||||
goto error;
|
goto error;
|
||||||
if (sock_path_ro &&
|
if (sock_path_ro) {
|
||||||
!(svcRO = virNetServerServiceNewUNIX(sock_path_ro,
|
VIR_DEBUG("Registering unix socket %s", sock_path_ro);
|
||||||
unix_sock_ro_mask,
|
if (!(svcRO = virNetServerServiceNewUNIX(sock_path_ro,
|
||||||
unix_sock_gid,
|
unix_sock_ro_mask,
|
||||||
config->auth_unix_ro,
|
unix_sock_gid,
|
||||||
true,
|
config->auth_unix_ro,
|
||||||
config->max_client_requests,
|
true,
|
||||||
NULL)))
|
config->max_client_requests,
|
||||||
goto error;
|
NULL)))
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
if (virNetServerAddService(srv, svc,
|
if (virNetServerAddService(srv, svc,
|
||||||
config->mdns_adv && !ipsock ?
|
config->mdns_adv && !ipsock ?
|
||||||
@ -491,6 +494,8 @@ static int daemonSetupNetworking(virNetServerPtr srv,
|
|||||||
|
|
||||||
if (ipsock) {
|
if (ipsock) {
|
||||||
if (config->listen_tcp) {
|
if (config->listen_tcp) {
|
||||||
|
VIR_DEBUG("Registering TCP socket %s:%s",
|
||||||
|
config->listen_addr, config->tcp_port);
|
||||||
if (!(svcTCP = virNetServerServiceNewTCP(config->listen_addr,
|
if (!(svcTCP = virNetServerServiceNewTCP(config->listen_addr,
|
||||||
config->tcp_port,
|
config->tcp_port,
|
||||||
config->auth_tcp,
|
config->auth_tcp,
|
||||||
@ -527,6 +532,8 @@ static int daemonSetupNetworking(virNetServerPtr srv,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VIR_DEBUG("Registering TLS socket %s:%s",
|
||||||
|
config->listen_addr, config->tls_port);
|
||||||
if (!(svcTLS =
|
if (!(svcTLS =
|
||||||
virNetServerServiceNewTCP(config->listen_addr,
|
virNetServerServiceNewTCP(config->listen_addr,
|
||||||
config->tls_port,
|
config->tls_port,
|
||||||
@ -1070,8 +1077,10 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!privileged &&
|
if (!privileged &&
|
||||||
migrateProfile() < 0)
|
migrateProfile() < 0) {
|
||||||
|
VIR_ERROR(_("Exiting due to failure to migrate profile"));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
if (config->host_uuid &&
|
if (config->host_uuid &&
|
||||||
virSetHostUUIDStr(config->host_uuid) < 0) {
|
virSetHostUUIDStr(config->host_uuid) < 0) {
|
||||||
@ -1090,6 +1099,7 @@ int main(int argc, char **argv) {
|
|||||||
VIR_ERROR(_("Can't determine pid file path."));
|
VIR_ERROR(_("Can't determine pid file path."));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
VIR_DEBUG("Decided on pid file path '%s'", NULLSTR(pid_file));
|
||||||
|
|
||||||
if (daemonUnixSocketPaths(config,
|
if (daemonUnixSocketPaths(config,
|
||||||
privileged,
|
privileged,
|
||||||
@ -1098,6 +1108,8 @@ int main(int argc, char **argv) {
|
|||||||
VIR_ERROR(_("Can't determine socket paths"));
|
VIR_ERROR(_("Can't determine socket paths"));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
VIR_DEBUG("Decided on socket paths '%s' and '%s'",
|
||||||
|
sock_file, NULLSTR(sock_file_ro));
|
||||||
|
|
||||||
if (godaemon) {
|
if (godaemon) {
|
||||||
char ebuf[1024];
|
char ebuf[1024];
|
||||||
@ -1135,6 +1147,7 @@ int main(int argc, char **argv) {
|
|||||||
old_umask = umask(022);
|
old_umask = umask(022);
|
||||||
else
|
else
|
||||||
old_umask = umask(077);
|
old_umask = umask(077);
|
||||||
|
VIR_DEBUG("Ensuring run dir '%s' exists", run_dir);
|
||||||
if (virFileMakePath(run_dir) < 0) {
|
if (virFileMakePath(run_dir) < 0) {
|
||||||
char ebuf[1024];
|
char ebuf[1024];
|
||||||
VIR_ERROR(_("unable to create rundir %s: %s"), run_dir,
|
VIR_ERROR(_("unable to create rundir %s: %s"), run_dir,
|
||||||
@ -1171,6 +1184,7 @@ int main(int argc, char **argv) {
|
|||||||
/* Beyond this point, nothing should rely on using
|
/* Beyond this point, nothing should rely on using
|
||||||
* getuid/geteuid() == 0, for privilege level checks.
|
* getuid/geteuid() == 0, for privilege level checks.
|
||||||
*/
|
*/
|
||||||
|
VIR_DEBUG("Dropping privileges (if required)");
|
||||||
if (daemonSetupPrivs() < 0) {
|
if (daemonSetupPrivs() < 0) {
|
||||||
ret = VIR_DAEMON_ERR_PRIVS;
|
ret = VIR_DAEMON_ERR_PRIVS;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -1207,11 +1221,13 @@ int main(int argc, char **argv) {
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timeout != -1)
|
if (timeout != -1) {
|
||||||
|
VIR_DEBUG("Registering shutdown timeout %d", timeout);
|
||||||
virNetServerAutoShutdown(srv,
|
virNetServerAutoShutdown(srv,
|
||||||
timeout,
|
timeout,
|
||||||
daemonShutdownCheck,
|
daemonShutdownCheck,
|
||||||
NULL);
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
if ((daemonSetupSignals(srv)) < 0) {
|
if ((daemonSetupSignals(srv)) < 0) {
|
||||||
ret = VIR_DAEMON_ERR_SIGNAL;
|
ret = VIR_DAEMON_ERR_SIGNAL;
|
||||||
@ -1219,11 +1235,13 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (config->audit_level) {
|
if (config->audit_level) {
|
||||||
|
VIR_DEBUG("Attempting to configure auditing subsystem");
|
||||||
if (virAuditOpen() < 0) {
|
if (virAuditOpen() < 0) {
|
||||||
if (config->audit_level > 1) {
|
if (config->audit_level > 1) {
|
||||||
ret = VIR_DAEMON_ERR_AUDIT;
|
ret = VIR_DAEMON_ERR_AUDIT;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
VIR_DEBUG("Proceeding without auditing");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virAuditLog(config->audit_logging);
|
virAuditLog(config->audit_logging);
|
||||||
|
@ -769,20 +769,23 @@ virRegisterStateDriver(virStateDriverPtr driver)
|
|||||||
* Returns 0 if all succeed, -1 upon any failure.
|
* Returns 0 if all succeed, -1 upon any failure.
|
||||||
*/
|
*/
|
||||||
int virStateInitialize(int privileged) {
|
int virStateInitialize(int privileged) {
|
||||||
int i, ret = 0;
|
int i;
|
||||||
|
|
||||||
if (virInitialize() < 0)
|
if (virInitialize() < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
for (i = 0 ; i < virStateDriverTabCount ; i++) {
|
for (i = 0 ; i < virStateDriverTabCount ; i++) {
|
||||||
if (virStateDriverTab[i]->initialize &&
|
if (virStateDriverTab[i]->initialize) {
|
||||||
virStateDriverTab[i]->initialize(privileged) < 0) {
|
VIR_DEBUG("Running global init for %s state driver",
|
||||||
VIR_ERROR(_("Initialization of %s state driver failed"),
|
|
||||||
virStateDriverTab[i]->name);
|
virStateDriverTab[i]->name);
|
||||||
ret = -1;
|
if (virStateDriverTab[i]->initialize(privileged) < 0) {
|
||||||
|
VIR_ERROR(_("Initialization of %s state driver failed"),
|
||||||
|
virStateDriverTab[i]->name);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -271,6 +271,9 @@ virHookCall(int driver,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VIR_DEBUG("Calling hook opstr=%s subopstr=%s extra=%s",
|
||||||
|
opstr, subopstr, extra);
|
||||||
|
|
||||||
cmd = virCommandNewArgList(path, id, opstr, subopstr, extra, NULL);
|
cmd = virCommandNewArgList(path, id, opstr, subopstr, extra, NULL);
|
||||||
|
|
||||||
virCommandAddEnvPassCommon(cmd);
|
virCommandAddEnvPassCommon(cmd);
|
||||||
|
@ -130,6 +130,7 @@ virNetlinkStartup(void)
|
|||||||
{
|
{
|
||||||
if (placeholder_nlhandle)
|
if (placeholder_nlhandle)
|
||||||
return 0;
|
return 0;
|
||||||
|
VIR_DEBUG("Running global netlink initialization");
|
||||||
placeholder_nlhandle = virNetlinkAlloc();
|
placeholder_nlhandle = virNetlinkAlloc();
|
||||||
if (!placeholder_nlhandle) {
|
if (!placeholder_nlhandle) {
|
||||||
virReportSystemError(errno, "%s",
|
virReportSystemError(errno, "%s",
|
||||||
|
Loading…
Reference in New Issue
Block a user