]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commit
virNumaSetPagePoolSize: Produce friendlier error message
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 8 Jun 2015 12:05:25 +0000 (14:05 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 10 Jun 2015 15:27:16 +0000 (17:27 +0200)
commit1c24cfe9d8016f7561af7b295835f4d1973243b2
tree2303586c12ca07a4712a0c78c36806f7dcb6a4be
parentc178d38b8faabf93521b4013bc6772c0f5e6b9e0
virNumaSetPagePoolSize: Produce friendlier error message

https://bugzilla.redhat.com/show_bug.cgi?id=1224587

The function takes two important arguments (among many others): @node
and @page_size. From these two a path under /sys is constructed. The
path is then used to read and write the desired size of huge pages
pool. However, if the path does not exists due to either @node or
@page_size having nonexistent value (e.g. there's no such NUMA node or
no page size like -2), an cryptic error message is produced:

  virsh # allocpages --pagesize 2049 --pagecount 8 --cellno -2
  error: Failed to open file '/sys/devices/system/node/node-2/hugepages/hugepages-2049kB/nr_hugepages': No such file or directory

Add two more checks to catch this and therefore produce much more
friendlier error messages.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/util/virnuma.c