提交 c8b8bbc3 编写于 作者: J John Ferlan

util: Quiet the logging if perf file doesn't exist

Commit id 'b00d7f29' shifted the opening of the /sys/devices/intel_cqm/type
file from event enable to perf event initialization. If the file did not
exist, then an error would be written to the domain log:

2016-09-06 20:51:21.677+0000: 7310: error : virFileReadAll:1360 : Failed to open file '/sys/devices/intel_cqm/type': No such file or directory

Since the error is now handled in virPerfEventEnable by checking if the
event_attr->attrType == 0 for CMT, MBML, and MBMT events - we can just
use the Quiet API in order to not log the error we're going to throw away.

Additionally, rather than using virReportSystemError, use virReportError
and VIR_ERR_ARGUMENT_UNSUPPORTED in order to signify that support isn't there
for that type of perf event - adjust the error message as well.
上级 69f4030a
......@@ -116,7 +116,7 @@ virPerfRdtAttrInit(void)
char *tmp = NULL;
unsigned int attr_type = 0;
if (virFileReadAll("/sys/devices/intel_cqm/type", 10, &buf) < 0)
if (virFileReadAllQuiet("/sys/devices/intel_cqm/type", 10, &buf) < 0)
goto error;
if ((tmp = strchr(buf, '\n')))
......@@ -174,9 +174,9 @@ virPerfEventEnable(virPerfPtr perf,
if (event_attr->attrType == 0 && (type == VIR_PERF_EVENT_CMT ||
type == VIR_PERF_EVENT_MBMT ||
type == VIR_PERF_EVENT_MBML)) {
virReportSystemError(errno,
_("Unable to open perf event for %s"),
virPerfEventTypeToString(event->type));
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED,
_("unable to enable perf event for %s"),
virPerfEventTypeToString(event->type));
return -1;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册