205 lines
7.9 KiB
Diff
205 lines
7.9 KiB
Diff
From fbd16cecc72494e8a9450f38197221f2f50c9d0e Mon Sep 17 00:00:00 2001
|
|
From: =?utf-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
|
|
Date: Thu, 16 Apr 2009 15:56:27 +0000
|
|
Subject: [PATCH 1/1] Don't log monitor output to domain log file.
|
|
|
|
It's logged via the logging system already. Prefix monitor debug output with vm
|
|
name.
|
|
---
|
|
src/qemu_driver.c | 60 +++++++++++++++++++++-------------------------------
|
|
1 files changed, 24 insertions(+), 36 deletions(-)
|
|
|
|
diff --git a/src/qemu_driver.c b/src/qemu_driver.c
|
|
index 79ee072..f5b5fa5 100644
|
|
--- a/src/qemu_driver.c
|
|
+++ b/src/qemu_driver.c
|
|
@@ -1710,27 +1710,11 @@ qemudMonitorCommandExtra(const virDomainObjPtr vm,
|
|
goto error;
|
|
}
|
|
}
|
|
-
|
|
- /* Log, but ignore failures to write logfile for VM */
|
|
- if (safewrite(vm->logfile, buf, strlen(buf)) < 0) {
|
|
- char ebuf[1024];
|
|
- VIR_WARN(_("Unable to log VM console data: %s\n"),
|
|
- virStrerror(errno, ebuf, sizeof ebuf));
|
|
- }
|
|
-
|
|
*reply = buf;
|
|
return 0;
|
|
|
|
error:
|
|
- if (buf) {
|
|
- /* Log, but ignore failures to write logfile for VM */
|
|
- if (safewrite(vm->logfile, buf, strlen(buf)) < 0) {
|
|
- char ebuf[1024];
|
|
- VIR_WARN(_("Unable to log VM console data: %s\n"),
|
|
- virStrerror(errno, ebuf, sizeof ebuf));
|
|
- }
|
|
- VIR_FREE(buf);
|
|
- }
|
|
+ VIR_FREE(buf);
|
|
return -1;
|
|
}
|
|
|
|
@@ -2463,7 +2447,7 @@ static int qemudDomainGetMemoryBalloon(virConnectPtr conn,
|
|
goto cleanup;
|
|
}
|
|
|
|
- DEBUG ("balloon reply: '%s'", reply);
|
|
+ DEBUG ("%s: balloon reply: '%s'", vm->def->name, reply);
|
|
if ((offset = strstr(reply, BALLOON_PREFIX)) != NULL) {
|
|
unsigned int memMB;
|
|
char *end;
|
|
@@ -2517,7 +2501,7 @@ static int qemudDomainSetMemoryBalloon(virConnectPtr conn,
|
|
|
|
/* If the command failed qemu prints: 'unknown command'
|
|
* No message is printed on success it seems */
|
|
- DEBUG ("balloon reply: %s", reply);
|
|
+ DEBUG ("%s: balloon reply: %s",vm->def->name, reply);
|
|
if (strstr(reply, "\nunknown command:")) {
|
|
/* Don't set error - it is expected memory balloon fails on many qemu */
|
|
ret = 0;
|
|
@@ -2812,7 +2796,7 @@ static int qemudDomainSave(virDomainPtr dom,
|
|
goto cleanup;
|
|
}
|
|
|
|
- DEBUG ("migrate reply: %s", info);
|
|
+ DEBUG ("%s: migrate reply: %s", vm->def->name, info);
|
|
|
|
/* If the command isn't supported then qemu prints:
|
|
* unknown command: migrate" */
|
|
@@ -3658,7 +3642,7 @@ static int qemudDomainChangeEjectableMedia(virConnectPtr conn,
|
|
/* If the command failed qemu prints:
|
|
* device not found, device is locked ...
|
|
* No message is printed on success it seems */
|
|
- DEBUG ("ejectable media change reply: %s", reply);
|
|
+ DEBUG ("%s: ejectable media change reply: %s", vm->def->name, reply);
|
|
if (strstr(reply, "\ndevice ")) {
|
|
qemudReportError (conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
|
|
_("changing cdrom media failed: %s"), reply);
|
|
@@ -3719,7 +3703,7 @@ static int qemudDomainAttachPciDiskDevice(virConnectPtr conn,
|
|
return -1;
|
|
}
|
|
|
|
- DEBUG ("pci_add reply: %s", reply);
|
|
+ DEBUG ("%s: pci_add reply: %s", vm->def->name, reply);
|
|
/* If the command succeeds qemu prints:
|
|
* OK bus 0... */
|
|
#define PCI_ATTACH_OK_MSG "OK bus 0, slot "
|
|
@@ -3787,7 +3771,7 @@ static int qemudDomainAttachUsbMassstorageDevice(virConnectPtr conn,
|
|
return -1;
|
|
}
|
|
|
|
- DEBUG ("attach_usb reply: %s", reply);
|
|
+ DEBUG ("%s: attach_usb reply: %s",vm->def->name, reply);
|
|
/* If the command failed qemu prints:
|
|
* Could not add ... */
|
|
if (strstr(reply, "Could not add ")) {
|
|
@@ -3841,7 +3825,7 @@ static int qemudDomainAttachHostDevice(virConnectPtr conn,
|
|
return -1;
|
|
}
|
|
|
|
- DEBUG ("attach_usb reply: %s", reply);
|
|
+ DEBUG ("%s: attach_usb reply: %s", vm->def->name, reply);
|
|
/* If the command failed qemu prints:
|
|
* Could not add ... */
|
|
if (strstr(reply, "Could not add ")) {
|
|
@@ -3980,7 +3964,7 @@ static int qemudDomainDetachPciDiskDevice(virConnectPtr conn,
|
|
goto cleanup;
|
|
}
|
|
|
|
- DEBUG ("pci_del reply: %s", reply);
|
|
+ DEBUG ("%s: pci_del reply: %s",vm->def->name, reply);
|
|
/* If the command fails due to a wrong slot qemu prints: invalid slot,
|
|
* nothing is printed on success */
|
|
if (strstr(reply, "invalid slot")) {
|
|
@@ -4210,7 +4194,7 @@ qemudDomainBlockStats (virDomainPtr dom,
|
|
"%s", _("'info blockstats' command failed"));
|
|
goto cleanup;
|
|
}
|
|
- DEBUG ("info blockstats reply: %s", info);
|
|
+ DEBUG ("%s: info blockstats reply: %s", vm->def->name, info);
|
|
|
|
/* If the command isn't supported then qemu prints the supported
|
|
* info commands, so the output starts "info ". Since this is
|
|
@@ -4251,21 +4235,25 @@ qemudDomainBlockStats (virDomainPtr dom,
|
|
if (STRPREFIX (p, "rd_bytes=")) {
|
|
p += 9;
|
|
if (virStrToLong_ll (p, &dummy, 10, &stats->rd_bytes) == -1)
|
|
- DEBUG ("error reading rd_bytes: %s", p);
|
|
+ DEBUG ("%s: error reading rd_bytes: %s",
|
|
+ vm->def->name, p);
|
|
} else if (STRPREFIX (p, "wr_bytes=")) {
|
|
p += 9;
|
|
if (virStrToLong_ll (p, &dummy, 10, &stats->wr_bytes) == -1)
|
|
- DEBUG ("error reading wr_bytes: %s", p);
|
|
+ DEBUG ("%s: error reading wr_bytes: %s",
|
|
+ vm->def->name, p);
|
|
} else if (STRPREFIX (p, "rd_operations=")) {
|
|
p += 14;
|
|
if (virStrToLong_ll (p, &dummy, 10, &stats->rd_req) == -1)
|
|
- DEBUG ("error reading rd_req: %s", p);
|
|
+ DEBUG ("%s: error reading rd_req: %s",
|
|
+ vm->def->name, p);
|
|
} else if (STRPREFIX (p, "wr_operations=")) {
|
|
p += 14;
|
|
if (virStrToLong_ll (p, &dummy, 10, &stats->wr_req) == -1)
|
|
- DEBUG ("error reading wr_req: %s", p);
|
|
+ DEBUG ("%s: error reading wr_req: %s",
|
|
+ vm->def->name, p);
|
|
} else
|
|
- DEBUG ("unknown block stat near %s", p);
|
|
+ DEBUG ("%s: unknown block stat near %s", vm->def->name, p);
|
|
|
|
/* Skip to next label. */
|
|
p = strchr (p, ' ');
|
|
@@ -4477,7 +4465,7 @@ qemudDomainMemoryPeek (virDomainPtr dom,
|
|
goto cleanup;
|
|
}
|
|
|
|
- DEBUG ("memsave reply: %s", info);
|
|
+ DEBUG ("%s: memsave reply: %s", vm->def->name, info);
|
|
|
|
/* Read the memory file into buffer. */
|
|
if (saferead (fd, buffer, size) == (ssize_t) -1) {
|
|
@@ -4794,7 +4782,7 @@ qemudDomainMigratePerform (virDomainPtr dom,
|
|
"%s", _("off-line migration specified, but suspend operation failed"));
|
|
goto cleanup;
|
|
}
|
|
- DEBUG ("stop reply: %s", info);
|
|
+ DEBUG ("%s: stop reply: %s", vm->def->name, info);
|
|
VIR_FREE(info);
|
|
paused = 1;
|
|
|
|
@@ -4811,7 +4799,7 @@ qemudDomainMigratePerform (virDomainPtr dom,
|
|
snprintf (cmd, sizeof cmd, "migrate_set_speed %lum", resource);
|
|
qemudMonitorCommand (vm, cmd, &info);
|
|
|
|
- DEBUG ("migrate_set_speed reply: %s", info);
|
|
+ DEBUG ("%s: migrate_set_speed reply: %s", vm->def->name, info);
|
|
VIR_FREE (info);
|
|
}
|
|
|
|
@@ -4830,7 +4818,7 @@ qemudDomainMigratePerform (virDomainPtr dom,
|
|
goto cleanup;
|
|
}
|
|
|
|
- DEBUG ("migrate reply: %s", info);
|
|
+ DEBUG ("%s: migrate reply: %s", vm->def->name, info);
|
|
|
|
/* Now check for "fail" in the output string */
|
|
if (strstr(info, "fail") != NULL) {
|
|
@@ -4869,7 +4857,7 @@ cleanup:
|
|
vm->def->name);
|
|
}
|
|
else {
|
|
- DEBUG ("cont reply: %s", info);
|
|
+ DEBUG ("%s: cont reply: %s", vm->def->name, info);
|
|
VIR_FREE(info);
|
|
}
|
|
|
|
--
|
|
1.6.0.6
|
|
|