mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
Don't log monitor output to domain log file.
It's logged via the logging system already. Prefix monitor debug output with vm name.
This commit is contained in:
parent
a6c612a4ad
commit
5caa1e0eb0
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
||||
Do Apr 16 17:48:30 CEST 2009 Guido Günther <agx@sigxcpu.org>
|
||||
|
||||
* src/qemu_driver.c (qemudMonitorCommandExtra): don't log monitor
|
||||
output to domain log file. It's logged via the logging system
|
||||
already.
|
||||
(qemudDomainGetMemoryBalloon, qemudDomainSave,
|
||||
qemudDomainChangeEjectableMedia, qemudDomainAttachPciDiskDevice,
|
||||
qemudDomainAttachUsbMassstorageDevice, qemudDomainAttachHostDevice,
|
||||
qemudDomainDetachPciDiskDevice, qemudDomainBlockStats,
|
||||
qemudDomainMemoryPeek, qemudDomainMigratePerform): prefix monitor
|
||||
debug output with vm name.
|
||||
|
||||
Do Apr 16 16:48:51 CEST 2009 Guido Günther <agx@sigxcpu.org>
|
||||
|
||||
* src/qemud.c (remoteReadConfigFile): don't hardcode buffer for
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user