Handle the case that 'numactl' not installed

If the program 'numactl' is not installed, the Zun compute process
fails and the compute node is not up. This commit makes Zun to
be robust in this case.

Change-Id: I0969d52896cc89fe443f312debe2b4f477069952
Closes-Bug: #1808643
This commit is contained in:
Hongbin Lu 2018-12-15 17:12:27 +00:00
parent dcd7cf35d4
commit c0a17036cb

View File

@ -14,6 +14,7 @@
# under the License.
from collections import defaultdict
import errno
import re
from oslo_log import log as logging
@ -56,10 +57,12 @@ class LinuxHost(host_capability.Host):
def get_mem_numa_info(self):
try:
output = utils.execute('numactl', '-H')
except exception.CommandError:
LOG.info("There was a problem while executing numactl -H, "
"Try again without the online column.")
return []
except OSError as e:
if e.errno == errno.ENOENT:
LOG.info("The program 'numactl' is not installed.")
return []
else:
raise
sizes = re.findall("size\: \d*", str(output))
mem_numa = []