]> git.ipfire.org Git - thirdparty/libvirt.git/commit
util: Produce friendlier error message to user
authorLuyao Huang <lhuang@redhat.com>
Wed, 21 Oct 2015 04:13:41 +0000 (12:13 +0800)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 21 Oct 2015 20:19:42 +0000 (16:19 -0400)
commit4f9e61f648d81d8edd5dba9a0553a4ac581ddc29
treec0392a3e8f7ba4c259464b45fde54860ec3df811
parente802d7efb4c0809a5fc756048dc34b2d15b7618d
util: Produce friendlier error message to user

Commit id '1c24cfe9' added error messages for virNumaSetPagePoolSize;
however, virNumaGetHugePageInfo also uses virNumaGetHugePageInfoPath
in order to build the path, but it never checked upon return if
the built path exists which could lead to an error message as follows:

$ virsh freepages 0 1
error: Failed to open file
    '/sys/devices/system/node/node0/hugepages/hugepages-1kB/free_hugepages':
    No such file or directory

Rather than add the same message for the other two callers, adjust
the virNumaGetHugePageInfoPath in order not only build the path, but
also check if the built path exists.  If the path does not exist,
then generate the error message and return failure.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
src/util/virnuma.c