openstack I版的搭建九--cinder

                  我們現在還差openstack的最後一個模塊cinder模塊,存儲節點,那大家現在就有疑問了,虛擬機的存在哪裏呢?

在結算節點上,即是:

[root@linux-node2 ~]# ll /var/lib/nova/instances/

總用量 16

drwxr-xr-x 2 root root 4096 8月  23 16:13 95e0d7eb-d3a8-4fe7-9b49-10fb36fb50b3

drwxr-xr-x 2 root root 4096 8月  22 18:40 _base

-rw-r--r-- 1 root root   49 8月  24 09:50 compute_nodes

drwxr-xr-x 2 root root 4096 8月  22 18:46 locks



[root@linux-node2 ~]# tree /var/lib/nova/instances/

/var/lib/nova/instances/

├── 95e0d7eb-d3a8-4fe7-9b49-10fb36fb50b3

│   ├── console.log

│   ├── disk

│   ├── disk.info

│   └── libvirt.xml  ---->通過這個我們可以知道,它們是調用libvirt管理虛擬機的。

├── _base

│   └── 31f37fe39218043e4eff2d8f9015456059062495 --->這個就是傳過來的鏡像。

├── compute_nodes

└── locks

    ├── nova-31f37fe39218043e4eff2d8f9015456059062495

    └── nova-storage-registry-lock


3 directories, 8 files


              接下來,我們要在控制節點裝cinder。

[root@linux-node1 ~]# cd /usr/local/src/cinder-2014.1

[root@linux-node1 cinder-2014.1]# python setup.py install

[root@linux-node1 cinder-2014.1]# mkdir /etc/cinder  

[root@linux-node1 cinder-2014.1]# mkdir /var/log/cinder

[root@linux-node1 cinder-2014.1]# mkdir /var/lib/cinder

[root@linux-node1 cinder-2014.1]# mkdir /var/run/cinder

[root@linux-node1 cinder-2014.1]# cd etc/

[root@linux-node1 etc]# ls

cinder

[root@linux-node1 etc]# cd cinder/

[root@linux-node1 cinder]# ls

api-paste.ini  cinder.conf.sample  logging_sample.conf  policy.json  rootwrap.conf  rootwrap.d

[root@linux-node1 cinder]# pwd

/usr/local/src/cinder-2014.1/etc/cinder

[root@linux-node1 cinder]# cp -r * /etc/cinder/

[root@linux-node1 cinder]# pwd

/usr/local/src/cinder-2014.1/etc/cinder

[root@linux-node1 cinder]# cd /etc/cinder/

[root@linux-node1 cinder]# ls

api-paste.ini  cinder.conf.sample  logging_sample.conf  policy.json  rootwrap.conf  rootwrap.d

[root@linux-node1 cinder]# mv cinder.conf.sample cinder.conf

[root@linux-node1 cinder]# mv logging_sample.conf logging.conf 


修改cinder配置文件

[root@linux-node1 cinder]# cd ~

[root@linux-node1 ~]# vim /etc/cinder/cinder.conf

connection = mysql://cinder:[email protected]/cinder

同步一下數據庫

[root@linux-node1 ~]# cinder-manage db sync

查看一下成功與否

[root@linux-node1 ~]# mysql -ucinder -pcinder -e"use cinder;show tables;"

ERROR 1045 (28000): Access denied for user 'cinder'@'localhost' (using password: YES)

[root@linux-node1 ~]# mysql -h 192.168.33.11 -ucinder -pcinder -e"use cinder;show tables;"

+--------------------------+

| Tables_in_cinder         |

+--------------------------+

| backups                  |

| encryption               |

| iscsi_targets            |

| migrate_version          |

| quality_of_service_specs |

| quota_classes            |

| quota_usages             |

| quotas                   |

| reservations             |

| services                 |

| snapshot_metadata        |

| snapshots                |

| transfers                |

| volume_admin_metadata    |

| volume_glance_metadata   |

| volume_metadata          |

| volume_type_extra_specs  |

| volume_types             |

| volumes                  |

+--------------------------+


# The RabbitMQ broker address where a single node is used.

# (string value)

rabbit_host=192.168.33.11


# The RabbitMQ broker port where a single node is used.

# (integer value)

rabbit_port=5672


# RabbitMQ HA cluster host:port pairs. (list value)

#rabbit_hosts=$rabbit_host:$rabbit_port


# Connect over SSL for RabbitMQ. (boolean value)

#rabbit_use_ssl=false


# The RabbitMQ userid. (string value)

rabbit_userid=guest


# The RabbitMQ password. (string value)

rabbit_password=guest


# The messaging driver to use, defaults to rabbit. Other

# drivers include qpid and zmq. (string value)

rpc_backend=rabbit


# The strategy to use for auth. Supports noauth, keystone, and

# deprecated. (string value)

auth_strategy=keystone


[keystone_authtoken]


#

# Options defined in keystoneclient.middleware.auth_token

#


# Prefix to prepend at the beginning of the path (string

# value)

#auth_admin_prefix=


# Host providing the admin Identity API endpoint (string

# value)

auth_host=192.168.33.11


# Port of the admin Identity API endpoint (integer value)

auth_port=35357


# Protocol of the admin Identity API endpoint(http or https)

# (string value)

auth_protocol=http


# Complete public Identity API endpoint (string value)

auth_uri=http://192.168.33.11:5000


# Keystone account username (string value)

admin_user=admin


# Keystone account password (string value)

admin_password=admin


# Keystone service account tenant name to validate user tokens

# (string value)

admin_tenant_name=admin


[root@linux-node1 ~]# grep "^[a-z]" /etc/cinder/cinder.conf 

rabbit_host=192.168.33.11

rabbit_port=5672

rabbit_userid=guest

rabbit_password=guest

rpc_backend=rabbit

auth_strategy=keystone

connection = mysql://cinder:[email protected]/cinder

auth_host=192.168.33.11

auth_port=35357

auth_protocol=https

auth_uri=http://192.168.33.11:5000

admin_user=admin

admin_password=admin

admin_tenant_name=admin

[root@linux-node1 ~]# grep "^[a-z]" /etc/cinder/cinder.conf -c

14

# Print debugging output (set logging level to DEBUG instead

# of default WARNING level). (boolean value)

debug=true


# Print more verbose output (set logging level to INFO instead

# of default WARNING level). (boolean value)

verbose=true


# (Optional) Name of log file to output to. If no default is

# set, logging will go to stdout. (string value)

# Deprecated group/name - [DEFAULT]/logfile

log_file=cinder.log


# (Optional) The base directory used for relative --log-file

# paths (string value)

# Deprecated group/name - [DEFAULT]/logdir

log_dir=/var/log/cinder


[root@linux-node1 ~]# grep "^[a-z]" /etc/cinder/cinder.conf 

rabbit_host=192.168.33.11

rabbit_port=5672

rabbit_userid=guest

rabbit_password=guest

rpc_backend=rabbit

auth_strategy=keystone

debug=true

verbose=true

log_file=cinder.log

log_dir=/var/log/cinder

connection = mysql://cinder:[email protected]/cinder

auth_host=192.168.33.11

auth_port=35357

auth_protocol=https

auth_uri=http://192.168.33.11:5000

admin_user=admin

admin_password=admin

admin_tenant_name=admin

[root@linux-node1 ~]# grep "^[a-z]" /etc/cinder/cinder.conf -c

18



[root@linux-node1 ~]# keystone service-create --name=cinder --type=volume --description="OpenStack Block Storage"

Expecting an auth URL via either --os-auth-url or env[OS_AUTH_URL]

[root@linux-node1 ~]# source keystone-admin 

[root@linux-node1 ~]# keystone service-create --name=cinder --type=volume --description="OpenStack Block Storage"

+-------------+----------------------------------+

|   Property  |              Value               |

+-------------+----------------------------------+

| description |     OpenStack Block Storage      |

|   enabled   |               True               |

|      id     | 86c57c01cfa8434e9e70417b7da8b463 |

|     name    |              cinder              |

|     type    |              volume              |

+-------------+----------------------------------+



[root@linux-node1 ~]# keystone endpoint-create \

> --service-id=86c57c01cfa8434e9e70417b7da8b463 \

> --publicurl=http://192.168.33.11:8776/v1/%\(tenant_id\)s \

> --internalurl=http://192.168.33.11:8776/v1/%\(tenant_id\)s \

> --adminurl=http://192.168.33.11:8776/v1/%\(tenant_id\)s

+-------------+--------------------------------------------+

|   Property  |                   Value                    |

+-------------+--------------------------------------------+

|   adminurl  | http://192.168.33.11:8776/v1/%(tenant_id)s |

|      id     |      a3b214ba716f4b49b83afc0117b789f0      |

| internalurl | http://192.168.33.11:8776/v1/%(tenant_id)s |

|  publicurl  | http://192.168.33.11:8776/v1/%(tenant_id)s |

|    region   |                 regionOne                  |

|  service_id |      86c57c01cfa8434e9e70417b7da8b463      |

+-------------+--------------------------------------------+

命令直接複製即可:

[root@linux-node1 ~]# keystone endpoint-create --service-id=86c57c01cfa8434e9e70417b7da8b463 --publicurl=http://192.168.33.11:8776/v1/%\(tenant_id\)s --internalurl=http://192.168.33.11:8776/v1/%\(tenant_id\)s --adminurl=

http://192.168.33.11:8776/v1/%\(tenant_id\)s


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章