刚安装好的devstack环境中无法成功创建cinder volume,创建的volume的status为error:
在cinder scheduler中看到失败log:
2015-10-15 14:12:22.057 ERROR cinder.scheduler.flows.create_volume [req-14f77cef-6ee9-463c-b9ce-2ffd40b4076b ba152f9f637c4bc2810f35cf3d3696dd 0d777ab85d9949c6ab961c6a883f3f40] Failed to run task cinder.scheduler.flows.create_volume.ScheduleCreateVolumeTask;volume:create: No valid host was found. No weighed hosts available
为什么没有cinder host尼?
在cinder volume服务中看到ERROR:
2015-10-15 14:02:37.786 ERROR cinder.volume.manager [req-bccbf6c1-26c7-4503-88aa-090c1fc6501d None None] Failed to initialize driver.
2015-10-15 14:02:37.786 TRACE cinder.volume.manager Traceback (most recent call last):
2015-10-15 14:02:37.786 TRACE cinder.volume.manager File "/opt/stack/cinder/cinder/volume/manager.py", line 322, in init_host
2015-10-15 14:02:37.786 TRACE cinder.volume.manager self.driver.check_for_setup_error()
2015-10-15 14:02:37.786 TRACE cinder.volume.manager File "/usr/local/lib/python2.7/dist-packages/osprofiler/profiler.py", line 105, in wrapper
2015-10-15 14:02:37.786 TRACE cinder.volume.manager return f(*args, **kwargs)
2015-10-15 14:02:37.786 TRACE cinder.volume.manager File "/opt/stack/cinder/cinder/volume/drivers/lvm.py", line 268, in check_for_setup_error
2015-10-15 14:02:37.786 TRACE cinder.volume.manager lvm_conf=lvm_conf_file)
2015-10-15 14:02:37.786 TRACE cinder.volume.manager File "/opt/stack/cinder/cinder/brick/local_dev/lvm.py", line 86, in __init__
2015-10-15 14:02:37.786 TRACE cinder.volume.manager if self._vg_exists() is False:
2015-10-15 14:02:37.786 TRACE cinder.volume.manager File "/opt/stack/cinder/cinder/brick/local_dev/lvm.py", line 123, in _vg_exists
2015-10-15 14:02:37.786 TRACE cinder.volume.manager run_as_root=True)
2015-10-15 14:02:37.786 TRACE cinder.volume.manager File "/opt/stack/cinder/cinder/utils.py", line 155, in execute
2015-10-15 14:02:37.786 TRACE cinder.volume.manager return processutils.execute(*cmd, **kwargs)
2015-10-15 14:02:37.786 TRACE cinder.volume.manager File "/usr/local/lib/python2.7/dist-packages/oslo_concurrency/processutils.py", line 275, in execute
2015-10-15 14:02:37.786 TRACE cinder.volume.manager cmd=sanitized_cmd)
2015-10-15 14:02:37.786 TRACE cinder.volume.manager ProcessExecutionError: Unexpected error while running command.
2015-10-15 14:02:37.786 TRACE cinder.volume.manager Command: sudo cinder-rootwrap /etc/cinder/rootwrap.conf env LC_ALL=C vgs --noheadings -o name stack-volumes-lvmdriver-1
2015-10-15 14:02:37.786 TRACE cinder.volume.manager Exit code: 5
2015-10-15 14:02:37.786 TRACE cinder.volume.manager Stdout: u‘‘
2015-10-15 14:02:37.786 TRACE cinder.volume.manager Stderr: u‘ Volume group "stack-volumes-lvmdriver-1" not found
原来是VG在devstack安装中没有创建,接着手工创建vg:
在devstack脚本中看到默认vg的创建过程
lib/lvm
function _create_lvm_volume_group
$ truncate -s 15G vg_file
[email protected]:/opt/stack/data/cinder$ sudo losetup -f --show vg_file
/dev/loop0
[email protected]:/opt/stack/data/cinder$ sudo vgcreate stack-volumes-lvmdriver-1 /dev/loop0
No physical volume label read from /dev/loop0
Physical volume "/dev/loop0" successfully created
Volume group "stack-volumes-lvmdriver-1" successfully created
重启cinder-volume就可以创建了。