1.报错信息
Stdout: u"Formatting '/var/lib/cinder/mnt/6ee3397902b681df883306df8b4f29e0/volume-82db7b50-c1a2-45f8-9c2e-ca8f15a4037d', fmt=qcow2 size=1073741824 cluster_size=65536 preallocation=metadata lazy_refcounts=off refcount_bits=16\n"
Stderr: u'qemu-img: /var/lib/cinder/mnt/6ee3397902b681df883306df8b4f29e0/volume-82db7b50-c1a2-45f8-9c2e-ca8f15a4037d: Could not create file: Permission denied\n'
2.debug 调试显示
在/usr/lib/python2.7/site-packages/cinder/volume/drivers/remotefs.py中加入debug调试信息
def _create_qcow2_file(self, path, size_gb):
"""Creates a QCOW2 file of a given size in GiB."""
LOG.debug("run_as_root: %s", self._execute_as_root)
self._execute('qemu-img', 'create', '-f', 'qcow2',
'-o', 'preallocation=metadata',
path, str(size_gb * units.Gi),
run_as_root=self._execute_as_root)
0fb671e33fc04231bee58fea69f6944c - default default] run_as_root: False _create_qcow2_file /usr/lib/python2.7/site-packages/cinder/volume/drivers/remotefs.py:399
未使用root权限运行导致
原因:
查看/usr/lib/python2.7/site-packages/cinder/volume/drivers/nfs.py中代码
if self.configuration.nas_secure_file_operations == 'true':
self._execute_as_root = False
当nas_secure_file_operations 设置为true时会将_execute_as_root 设置为False
所以更高配置文件nfs backend的配置nas_secure_file_operations 为False后解决