lchl0388 发表于 2018-6-2 08:16:46

openstack I版的搭建九

  我们现在还差openstack的最后一个模块cinder模块,存储节点,那大家现在就有疑问了,虚拟机的存在哪里呢?
  在结算节点上,即是:

  # 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
  

  

  # 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。
  # cd /usr/local/src/cinder-2014.1
  # python setup.py install
  # mkdir /etc/cinder
  # mkdir /var/log/cinder
  # mkdir /var/lib/cinder
  # mkdir /var/run/cinder
  # cd etc/
  # ls
  cinder
  # cd cinder/
  # ls
  api-paste.inicinder.conf.samplelogging_sample.confpolicy.jsonrootwrap.confrootwrap.d
  # pwd
  /usr/local/src/cinder-2014.1/etc/cinder
  # cp -r * /etc/cinder/
  # pwd
  /usr/local/src/cinder-2014.1/etc/cinder
  # cd /etc/cinder/
  # ls
  api-paste.inicinder.conf.samplelogging_sample.confpolicy.jsonrootwrap.confrootwrap.d
  # mv cinder.conf.sample cinder.conf
  # mv logging_sample.conf logging.conf
  

  修改cinder配置文件
  # cd ~
  # vim /etc/cinder/cinder.conf
  connection = mysql://cinder:cinder@192.168.33.11/cinder
  同步一下数据库
  # cinder-manage db sync
  查看一下成功与否
  # mysql -ucinder -pcinder -e"use cinder;show tables;"
  ERROR 1045 (28000): Access denied for user 'cinder'@'localhost' (using password: YES)
  # 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
  

  
  

  #
  # 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
  

  # grep "^" /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:cinder@192.168.33.11/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
  # grep "^" /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 - /logfile
  log_file=cinder.log
  

  # (Optional) The base directory used for relative --log-file
  # paths (string value)
  # Deprecated group/name - /logdir
  log_dir=/var/log/cinder
  

  # grep "^" /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:cinder@192.168.33.11/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
  # grep "^" /etc/cinder/cinder.conf -c
  18
  

  

  # keystone service-create --name=cinder --type=volume --description="OpenStack Block Storage"
  Expecting an auth URL via either --os-auth-url or env
  # source keystone-admin
  # 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            |
  +-------------+----------------------------------+
  

  

  # 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      |
  +-------------+--------------------------------------------+
  命令直接复制即可:
  # 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
  
页: [1]
查看完整版本: openstack I版的搭建九