[libvirt] [PATCH] Don't fail qemu driver intialization if we can't determine hugepage size

Otherwise we fail like libvirt version: 1.2.7, package: 6 (root 2014-08-08-16:09:22 bogon) virAuditOpen:62 : Unable to initialize audit layer: Protocol not supported virFileGetDefaultHugepageSize:2958 : internal error: Unable to parse /proc/meminfo virStateInitialize:749 : Initialization of QEMU state driver failed: internal error: Unable to parse /proc/meminfo daemonRunStateInit:922 : Driver state initialization failed if the data can't be determined. Reference: http://bugs.debian.org/757609 --- src/util/virfile.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/util/virfile.c b/src/util/virfile.c index f9efc65..b6f5e3f 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -2953,8 +2953,9 @@ virFileGetDefaultHugepageSize(unsigned long long *size) goto cleanup; if (!(c = strstr(meminfo, HUGEPAGESIZE_STR))) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to parse %s"), + virReportError(VIR_ERR_NO_SUPPORT, + _("%s not found in %s"), + HUGEPAGESIZE_STR, PROC_MEMINFO); goto cleanup; } -- 2.0.1

On 10.08.2014 13:51, Guido Günther wrote:
Otherwise we fail like
libvirt version: 1.2.7, package: 6 (root 2014-08-08-16:09:22 bogon) virAuditOpen:62 : Unable to initialize audit layer: Protocol not supported virFileGetDefaultHugepageSize:2958 : internal error: Unable to parse /proc/meminfo virStateInitialize:749 : Initialization of QEMU state driver failed: internal error: Unable to parse /proc/meminfo daemonRunStateInit:922 : Driver state initialization failed
if the data can't be determined.
Reference: http://bugs.debian.org/757609 --- src/util/virfile.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/util/virfile.c b/src/util/virfile.c index f9efc65..b6f5e3f 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -2953,8 +2953,9 @@ virFileGetDefaultHugepageSize(unsigned long long *size) goto cleanup;
if (!(c = strstr(meminfo, HUGEPAGESIZE_STR))) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to parse %s"), + virReportError(VIR_ERR_NO_SUPPORT, + _("%s not found in %s"), + HUGEPAGESIZE_STR, PROC_MEMINFO); goto cleanup; }
This merely changes the error code and error message. But the initialization will fail anyway. Well, it would up till d26e81083. But the error message you suggests is more verbose and describes the origin of fault more accurately. ACK Michal

On Mon, Aug 11, 2014 at 11:17:10AM +0200, Michal Privoznik wrote:
On 10.08.2014 13:51, Guido Günther wrote:
Otherwise we fail like
libvirt version: 1.2.7, package: 6 (root 2014-08-08-16:09:22 bogon) virAuditOpen:62 : Unable to initialize audit layer: Protocol not supported virFileGetDefaultHugepageSize:2958 : internal error: Unable to parse /proc/meminfo virStateInitialize:749 : Initialization of QEMU state driver failed: internal error: Unable to parse /proc/meminfo daemonRunStateInit:922 : Driver state initialization failed
if the data can't be determined.
Reference: http://bugs.debian.org/757609 --- src/util/virfile.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/util/virfile.c b/src/util/virfile.c index f9efc65..b6f5e3f 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -2953,8 +2953,9 @@ virFileGetDefaultHugepageSize(unsigned long long *size) goto cleanup;
if (!(c = strstr(meminfo, HUGEPAGESIZE_STR))) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to parse %s"), + virReportError(VIR_ERR_NO_SUPPORT, + _("%s not found in %s"), + HUGEPAGESIZE_STR, PROC_MEMINFO); goto cleanup; }
This merely changes the error code and error message. But the initialization will fail anyway. Well, it would up till d26e81083. But the error message you suggests is more verbose and describes the origin of fault more accurately.
Initialization doesn't fail anymore with this since we have: if (privileged && virFileFindHugeTLBFS(&cfg->hugetlbfs, &cfg->nhugetlbfs) < 0) { /* This however is not implemented on all platforms. */ virErrorPtr err = virGetLastError(); if (err && err->code != VIR_ERR_NO_SUPPORT) goto error; } in virQEMUDriverConfigNew so we only warn in this case. In case someone has hugetlbfs_mount in qemu.conf we still fail hard which is IMHO correct in this case.
ACK
Thanks. I'll wait a bit more before pushding in case this isn't the desired behviour! Cheers, -- Guido
Michal

On Mon, Aug 11, 2014 at 11:17:10AM +0200, Michal Privoznik wrote:
On 10.08.2014 13:51, Guido Günther wrote:
Otherwise we fail like
libvirt version: 1.2.7, package: 6 (root 2014-08-08-16:09:22 bogon) virAuditOpen:62 : Unable to initialize audit layer: Protocol not supported virFileGetDefaultHugepageSize:2958 : internal error: Unable to parse /proc/meminfo virStateInitialize:749 : Initialization of QEMU state driver failed: internal error: Unable to parse /proc/meminfo daemonRunStateInit:922 : Driver state initialization failed
if the data can't be determined.
Reference: http://bugs.debian.org/757609 --- src/util/virfile.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/util/virfile.c b/src/util/virfile.c index f9efc65..b6f5e3f 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -2953,8 +2953,9 @@ virFileGetDefaultHugepageSize(unsigned long long *size) goto cleanup;
if (!(c = strstr(meminfo, HUGEPAGESIZE_STR))) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to parse %s"), + virReportError(VIR_ERR_NO_SUPPORT, + _("%s not found in %s"), + HUGEPAGESIZE_STR, PROC_MEMINFO); goto cleanup; }
This merely changes the error code and error message. But the initialization will fail anyway. Well, it would up till d26e81083. But the error message you suggests is more verbose and describes the origin of fault more accurately.
ACK
Pushed now. Thanks. -- Guido
participants (2)
-
Guido Günther
-
Michal Privoznik