Cinder服务使用
Cinder环境
重新创建卷组cinder-volumes
[root@openstack centos]# vgremove cinder-volumes
Configuration setting "snapshot_autoextend_percent" invalid. It's not part of any section.
Configuration setting "snapshot_autoextend_threshold" invalid. It's not part of any section.
Volume group "cinder-volumes" successfully removed
[root@openstack centos]# pvremove /dev/loop1
Configuration setting "snapshot_autoextend_percent" invalid. It's not part of any section.
Configuration setting "snapshot_autoextend_threshold" invalid. It's not part of any section.
Labels on physical volume "/dev/loop1" successfully wiped
[root@openstack centos]# pvdisplay
Configuration setting "snapshot_autoextend_percent" invalid. It's not part of any section.
Configuration setting "snapshot_autoextend_threshold" invalid. It's not part of any section.
--- Physical volume ---
PV Name /dev/sda2
VG Name centos
PV Size 286.91 GiB / not usable 3.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 73447
Free PE 1
Allocated PE 73446
PV UUID wWjJHc-i4A0-JuRb-OCrb-5aFn-YPli-cKOo9W
[root@openstack cinder]# fdisk /dev/sda
The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/sda: 500.1 GB, 500107862016 bytes, 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x0009d821
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 602710015 300841984 8e Linux LVM
/dev/sda3 602710016 798031871 97660928 8e Linux LVM
Command (m for help): q
[root@openstack cinder]# pvcreate /dev/sda3
Configuration setting "snapshot_autoextend_percent" invalid. It's not part of any section.
Configuration setting "snapshot_autoextend_threshold" invalid. It's not part of any section.
Physical volume "/dev/sda3" successfully created
[root@openstack cinder]# pvdisplay
Configuration setting "snapshot_autoextend_percent" invalid. It's not part of any section.
Configuration setting "snapshot_autoextend_threshold" invalid. It's not part of any section.
--- Physical volume ---
PV Name /dev/sda2
VG Name centos
PV Size 286.91 GiB / not usable 3.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 73447
Free PE 1
Allocated PE 73446
PV UUID wWjJHc-i4A0-JuRb-OCrb-5aFn-YPli-cKOo9W
"/dev/sda3" is a new physical volume of "93.14 GiB"
--- NEW Physical volume ---
PV Name /dev/sda3
VG Name
PV Size 93.14 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID sfF8Ys-NkAr-XZmT-Hkaa-xVCO-g2BY-mC7mHK
[root@openstack cinder]# vgcreate cinder-volumes /dev/sda3
Configuration setting "snapshot_autoextend_percent" invalid. It's not part of any section.
Configuration setting "snapshot_autoextend_threshold" invalid. It's not part of any section.
Volume group "cinder-volumes" successfully created
[root@openstack cinder]# systemctl restart openstack-cinder-volume.service target.service
[root@openstack cinder]# cinder-manage service list
No handlers could be found for logger "oslo_config.cfg"
/usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:241: NotSupportedWarning: Configuration option(s) ['use_tpool'] not supported
exception.NotSupportedWarning
Binary Host Zone Status State Updated At
cinder-backup openstack nova enabled :-) 2016-04-14 08:15:25
cinder-scheduler openstack nova enabled :-) 2016-04-14 08:15:25
cinder-volume openstack nova enabled :-) 2016-04-14 08:15:16
Openstack 问题处理
cinder-volume服务启动失败
[root@openstack openstack]# cinder-manage service list
No handlers could be found for logger "oslo_config.cfg"
/usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:241: NotSupportedWarning: Configuration option(s) ['use_tpool'] not supported
exception.NotSupportedWarning
Binary Host Zone Status State Updated At
cinder-backup openstack nova enabled :-) 2016-04-14 08:44:31
cinder-scheduler openstack nova enabled :-) 2016-04-14 08:44:31
cinder-volume openstack nova enabled XXX 2016-04-14 08:29:44
[root@openstack openstack]# systemctl start openstack-cinder-volume.service
A dependency job for openstack-cinder-volume.service failed. See 'journalctl -xe' for details.
[root@openstack openstack]# journalctl -xe
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit openstack-losetup.service has failed.
--
-- The result is failed.
Apr 14 16:44:43 openstack.rdo systemd[1]: Dependency failed for OpenStack Cinder Volume Server.
-- Subject: Unit openstack-cinder-volume.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit openstack-cinder-volume.service has failed.
--
-- The result is dependency.
Apr 14 16:44:43 openstack.rdo systemd[1]: Job openstack-cinder-volume.service/start failed with result 'dependency'.
Apr 14 16:44:43 openstack.rdo systemd[1]: Unit openstack-losetup.service entered failed state.
Apr 14 16:44:43 openstack.rdo systemd[1]: openstack-losetup.service failed.
Apr 14 16:44:43 openstack.rdo polkitd[916]: Unregistered Authentication Agent for unix-process:9686:87206 (system bus name :1.105, object path /org/fr
Apr 14 16:44:51 openstack.rdo account-server[1309]: Beginning replication run
Apr 14 16:44:51 openstack.rdo account-server[1309]: Replication run OVER
Apr 14 16:44:51 openstack.rdo account-server[1309]: Attempted to replicate 0 dbs in 0.00175 seconds (0.00000/s)
Apr 14 16:44:51 openstack.rdo account-server[1309]: Removed 0 dbs
Apr 14 16:44:51 openstack.rdo account-server[1309]: 0 successes, 0 failures
Apr 14 16:44:51 openstack.rdo account-server[1309]: no_change:0 ts_repl:0 diff:0 rsync:0 diff_capped:0 hashmatch:0 empty:0
Apr 14 16:44:52 openstack.rdo object-server[1279]: Begin object update sweep
Apr 14 16:44:52 openstack.rdo object-server[9755]: Object update sweep of swiftloopback completed: 0.00s, 0 successes, 0 failures
Apr 14 16:44:52 openstack.rdo object-server[1279]: Object update sweep completed: 0.02s
Apr 14 16:44:57 openstack.rdo container-server[1333]: Beginning replication run
Apr 14 16:44:57 openstack.rdo container-server[1333]: Replication run OVER
Apr 14 16:44:57 openstack.rdo container-server[1333]: Attempted to replicate 0 dbs in 0.00048 seconds (0.00000/s)
Apr 14 16:44:57 openstack.rdo container-server[1333]: Removed 0 dbs
Apr 14 16:44:57 openstack.rdo container-server[1333]: 0 successes, 0 failures
Apr 14 16:44:57 openstack.rdo container-server[1333]: no_change:0 ts_repl:0 diff:0 rsync:0 diff_capped:0 hashmatch:0 empty:0
根据日志可以看出是openstack-cinder-volume.service服务没起来,因为我前面删掉了原本的loop设备,所以导致这个问题,我们先看下这两个service文件,正确的阅读方式请参见 systemd.unit 中文手册
[root@openstack ~]# cd /usr/lib/systemd/system/
[root@openstack system]# cat openstack-cinder-volume.service
[Unit]
Description=OpenStack Cinder Volume Server
After=syslog.target network.target
[Service]
Type=simple
User=cinder
ExecStart=/usr/bin/cinder-volume --config-file /usr/share/cinder/cinder-dist.conf --config-file /etc/cinder/cinder.conf --logfile /var/log/cinder/volume.log
[Install]
WantedBy=multi-user.target
[root@openstack system]# cat openstack-losetup.service
[Unit]
Description=Setup cinder-volume loop device
DefaultDependencies=false
Before=openstack-cinder-volume.service
After=local-fs.target
[Service]
Type=oneshot
ExecStart=/usr/bin/sh -c '/usr/sbin/losetup -j /var/lib/cinder/cinder-volumes | /usr/bin/grep /var/lib/cinder/cinder-volumes || /usr/sbin/losetup -f /var/lib/cinder/cinder-volumes'
ExecStop=/usr/bin/sh -c '/usr/sbin/losetup -j /var/lib/cinder/cinder-volumes | /usr/bin/cut -d : -f 1 | /usr/bin/xargs /usr/sbin/losetup -d'
TimeoutSec=60
RemainAfterExit=yes
[Install]
RequiredBy=openstack-cinder-volume.service
既然我们已经自己手动创建了cinder-volumes,那么我们就不需要openstack-losetup.service这个脚本了,所以我们把Before+RequiredBy去掉即可
[root@openstack system]# cat openstack-losetup.service
[Unit]
Description=Setup cinder-volume loop device
DefaultDependencies=false
#Before=openstack-cinder-volume.service
After=local-fs.target
[Service]
Type=oneshot
ExecStart=/usr/bin/sh -c '/usr/sbin/losetup -j /var/lib/cinder/cinder-volumes | /usr/bin/grep /var/lib/cinder/cinder-volumes || /usr/sbin/losetup -f /var/lib/cinder/cinder-volumes'
ExecStop=/usr/bin/sh -c '/usr/sbin/losetup -j /var/lib/cinder/cinder-volumes | /usr/bin/cut -d : -f 1 | /usr/bin/xargs /usr/sbin/losetup -d'
TimeoutSec=60
RemainAfterExit=yes
[Install]
#RequiredBy=openstack-cinder-volume.service
重启系统
[root@openstack Init]# cinder-manage service list
No handlers could be found for logger "oslo_config.cfg"
/usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:241: NotSupportedWarning: Configuration option(s) ['use_tpool'] not supported
exception.NotSupportedWarning
Binary Host Zone Status State Updated At
cinder-backup openstack nova enabled :-) 2016-04-14 10:06:47
cinder-scheduler openstack nova enabled :-) 2016-04-14 10:06:48
cinder-volume openstack nova enabled :-) 2016-04-14 10:06:48