Permalink
Browse files

Fixes EUCA-2208

Cleanup log messages.
  • Loading branch information...
gelinasc committed Oct 5, 2012
1 parent 3a8a87d commit 2bbac1d1139c8cf6981accb9f7fa3353cb2e3918
Showing with 232 additions and 234 deletions.
  1. +50 −50 node/client-marshal-adb.c
  2. +50 −53 node/handlers.c
  3. +77 −76 node/handlers_default.c
  4. +17 −17 node/handlers_kvm.c
  5. +7 −7 node/handlers_xen.c
  6. +23 −23 node/server-marshal.c
  7. +8 −8 node/xml.c
View

Large diffs are not rendered by default.

Oops, something went wrong.
View

Large diffs are not rendered by default.

Oops, something went wrong.
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -109,7 +109,7 @@ static int doInitialize (struct nc_state_t *nc)
s = system_output (nc->get_info_cmd_path);
#define GET_VALUE(name,var) \
if (get_value (s, name, &var)) { \
- logprintfl (EUCAFATAL, "error: did not find %s in output from %s\n", name, nc->get_info_cmd_path); \
+ logprintfl (EUCAFATAL, "did not find %s in output from %s\n", name, nc->get_info_cmd_path); \
if (s) free (s); \
return ERROR_FATAL; \
}
@@ -132,16 +132,16 @@ static void * rebooting_thread (void *arg)
struct stat statbuf;
int rc = 0;
- logprintfl (EUCADEBUG, "{%u} spawning rebooting thread\n", (unsigned int)pthread_self());
+ logprintfl (EUCADEBUG, "[%s] spawning rebooting thread\n", instance->instanceId);
char * xml = file2str (instance->libvirtFilePath);
if (xml == NULL) {
- logprintfl (EUCAERROR, "cannot obtain XML file %s\n", instance->libvirtFilePath);
+ logprintfl (EUCAERROR, "[%s] cannot obtain XML file %s\n", instance->instanceId, instance->libvirtFilePath);
return NULL;
}
conn = check_hypervisor_conn();
if (! conn) {
- logprintfl (EUCAERROR, "cannot restart instance %s, abandoning it\n", instance->instanceId);
+ logprintfl (EUCAERROR, "[%s] cannot restart instance %s, abandoning it\n", instance->instanceId, instance->instanceId);
change_state (instance, SHUTOFF);
free (xml);
return NULL;
@@ -185,7 +185,7 @@ static void * rebooting_thread (void *arg)
// get credentials, decrypt them
remoteDevStr = get_iscsi_target (volume->remoteDev);
if (!remoteDevStr || !strstr(remoteDevStr, "/dev")) {
- logprintfl(EUCAERROR, "Reattach-volume: failed to get local name of host iscsi device\n");
+ logprintfl(EUCAERROR, "[%s] Reattach-volume: failed to get local name of host iscsi device\n", instance->instanceId);
rc = 1;
} else {
rc = gen_libvirt_attach_xml (volume->volumeId,
@@ -205,14 +205,14 @@ static void * rebooting_thread (void *arg)
err = virDomainAttachDevice (dom, attach_xml);
sem_v (hyp_sem);
if (err) {
- logprintfl (EUCAERROR, "virDomainAttachDevice() failed (err=%d) XML=%s\n", err, attach_xml);
+ logprintfl (EUCAERROR, "[%s] virDomainAttachDevice() failed (err=%d) XML=%s\n", instance->instanceId, err, attach_xml);
} else {
- logprintfl (EUCAINFO, "reattached '%s' to '%s' in domain %s\n", volume->remoteDev, volume->localDevReal, instance->instanceId);
+ logprintfl (EUCAINFO, "[%s] reattached '%s' to '%s' in domain\n", instance->instanceId, volume->remoteDev, volume->localDevReal);
}
}
}
if (dom==NULL) {
- logprintfl (EUCAERROR, "Failed to restart instance %s\n", instance->instanceId);
+ logprintfl (EUCAERROR, "[%s] Failed to restart instance\n", instance->instanceId);
change_state (instance, SHUTOFF);
return NULL;
}
@@ -232,18 +232,18 @@ doRebootInstance( struct nc_state_t *nc,
ncInstance *instance = find_instance (&global_instances, instanceId);
sem_v (inst_sem);
if ( instance == NULL ) {
- logprintfl (EUCAERROR, "cannot find instance %s\n", instanceId);
+ logprintfl (EUCAERROR, "[%s] cannot find instance\n", instanceId);
return ERROR;
}
pthread_t tcb;
// since shutdown/restart may take a while, we do them in a thread
if ( pthread_create (&tcb, NULL, rebooting_thread, (void *)instance) ) {
- logprintfl (EUCAERROR, "failed to spawn a reboot thread\n");
+ logprintfl (EUCAERROR, "[%s] failed to spawn a reboot thread\n", instanceId);
return ERROR_FATAL;
}
if (pthread_detach(tcb)) {
- logprintfl (EUCAERROR, "failed to detach the rebooting thread\n");
+ logprintfl (EUCAERROR, "[%s] failed to detach the rebooting thread\n", instanceId);
return ERROR_FATAL;
}
@@ -275,15 +275,15 @@ doGetConsoleOutput( struct nc_state_t *nc,
sem_v (inst_sem);
if (!instance) {
- logprintfl(EUCAERROR, "doGetConsoleOutput(): cannot locate instance with instanceId=%s\n", instanceId);
+ logprintfl(EUCAERROR, "[%s] cannot locate instance\n", instanceId);
return(1);
}
// read from console.append.log if it exists into dynamically allocated 4K console_append buffer
rc = stat(console_file, &statbuf);
if (rc >= 0) {
if (diskutil_ch (console_file, nc->admin_user_id, nc->admin_user_id, 0) != OK) {
- logprintfl (EUCAERROR, "doGetConsoleOutput(): failed to change ownership of %s\n", console_file);
+ logprintfl (EUCAERROR, "[%s] failed to change ownership of %s\n", instanceId, console_file);
return (1);
}
fd = open(console_file, O_RDONLY);
@@ -305,7 +305,7 @@ doGetConsoleOutput( struct nc_state_t *nc,
rc = stat(console_file, &statbuf);
if (rc >= 0) {
if (diskutil_ch (console_file, nc->admin_user_id, nc->admin_user_id, 0) != OK) {
- logprintfl (EUCAERROR, "doGetConsoleOutput(): failed to change ownership of %s\n", console_file);
+ logprintfl (EUCAERROR, "[%s] failed to change ownership of %s\n", instanceId, console_file);
if (console_append)
free(console_append);
return (1);
@@ -316,7 +316,7 @@ doGetConsoleOutput( struct nc_state_t *nc,
if (rc < 0) {
rc = lseek(fd, (off_t)0, SEEK_SET);
if (rc < 0) {
- logprintfl(EUCAERROR, "cannot seek to beginning of file\n");
+ logprintfl(EUCAERROR, "[%s] cannot seek to beginning of file\n", instanceId);
if (console_append) free(console_append);
return(1);
}
@@ -328,10 +328,10 @@ doGetConsoleOutput( struct nc_state_t *nc,
close(fd);
}
} else {
- logprintfl(EUCAERROR, "cannot open '%s' read-only\n", console_file);
+ logprintfl(EUCAERROR, "[%s] cannot open '%s' read-only\n", instanceId, console_file);
}
} else {
- logprintfl(EUCAERROR, "cannot stat console_output file '%s'\n", console_file);
+ logprintfl(EUCAERROR, "[%s] cannot stat console_output file '%s'\n", instanceId, console_file);
}
// concatenate console_append with console_main, base64-encode this, and put into dynamically allocated buffer consoleOutput
View
@@ -114,14 +114,14 @@ static int doInitialize (struct nc_state_t *nc)
// get resources
if (virNodeGetInfo(nc->conn, &ni)) {
- logprintfl (EUCAFATAL, "error: failed to discover resources\n");
+ logprintfl (EUCAFATAL, "failed to discover resources\n");
return ERROR_FATAL;
}
// dom0-min-mem has to come from xend config file
s = system_output (nc->get_info_cmd_path);
if (get_value (s, "dom0-min-mem", &dom0_min_mem)) {
- logprintfl (EUCAFATAL, "error: did not find dom0-min-mem in output from %s\n", nc->get_info_cmd_path);
+ logprintfl (EUCAFATAL, "did not find dom0-min-mem in output from %s\n", nc->get_info_cmd_path);
free (s);
return ERROR_FATAL;
}
@@ -166,14 +166,14 @@ static int doRebootInstance( struct nc_state_t *nc,
int err=virDomainReboot (dom, 0);
sem_v (hyp_sem);
if (err==0) {
- logprintfl (EUCAINFO, "rebooting Xen domain for instance %s\n", instanceId);
+ logprintfl (EUCAINFO, "[%s] rebooting Xen domain for instance\n", instanceId);
}
sem_p(hyp_sem);
virDomainFree(dom); /* necessary? */
sem_v(hyp_sem);
} else {
if (instance->state != BOOTING && instance->state != STAGING) {
- logprintfl (EUCAWARN, "warning: domain %s to be rebooted not running on hypervisor\n", instanceId);
+ logprintfl (EUCAWARN, "[%s] domain to be rebooted not running on hypervisor\n", instanceId);
}
}
}
@@ -207,7 +207,7 @@ doGetConsoleOutput( struct nc_state_t *nc,
}
sem_v (inst_sem);
if (!instance) {
- logprintfl(EUCAERROR, "doGetConsoleOutput(): cannot locate instance with instanceId=%s\n", instanceId);
+ logprintfl(EUCAERROR, "[%s] cannot locate instance\n", instanceId);
return(1);
}
rc = stat(console_file, &statbuf);
@@ -227,7 +227,7 @@ doGetConsoleOutput( struct nc_state_t *nc,
bufsize = sizeof(char) * 1024 * 64;
console_main = malloc(bufsize);
if (!console_main) {
- logprintfl(EUCAERROR, "doGetConsoleOutput(): out of memory!\n");
+ logprintfl(EUCAERROR, "[%s] out of memory!\n", instanceId);
if (console_append) free(console_append);
return(1);
}
@@ -287,7 +287,7 @@ doGetConsoleOutput( struct nc_state_t *nc,
while(count < 10000 && stat(console_file, &statbuf) < 0) {count++;}
fd = open(console_file, O_RDONLY);
if (fd < 0) {
- logprintfl (EUCAERROR, "ERROR: could not open consoleOutput file %s for reading\n", console_file);
+ logprintfl (EUCAERROR, "[%s] could not open consoleOutput file %s for reading\n", instanceId, console_file);
} else {
FD_ZERO(&rfds);
FD_SET(fd, &rfds);
Oops, something went wrong.

0 comments on commit 2bbac1d

Please sign in to comment.