OpenStack 多节点纳管 vCenter 5.5
2017-04-19 17:55 云物互联 阅读(212) 评论(0) 编辑 收藏 举报目录
测试环境
OpenStack Liberty: 双节点(192.168.1.1/192.168.1.2), 后续内容中分别以 node1/node2 表示双节点.
vCenter 环境:
- VMware vCenter Server Application(192.168.1.100) 账号: root/vmware
- vCenter 层级结构:
vCenter
==> Datacenter-1(datastore1)
==> Cluster-1
==> Host(192.168.1.3)
Nova 配置(OpenStack 纳管 vCenter 虚拟机)
使用 vCenter 驱动配置. 参考文档
现阶段而言, OpenStack 对 vCenter 虚拟机的管理包括 虚拟机的创建/删除/启停/休眠/唤醒/挂起/迁移 等. 但一些高级的 vCenter 功能如 DRS/DAS 等仍然不被支持.
- node1: vim /etc/nova/nova.conf
[DEFAULT]
...
force_config_drive=True
...
config_drive_format=iso9660
compute_driver=vmwareapi.VMwareVCDriver
[vmware]
host_ip=192.168.1.100
host_username=root
host_password=vmware
cluster_name=Cluster-1
datastore_regex=datastore1
wsdl_location=https://192.168.1.100/sdk/vimService.wsdl
insecure=True
- node2: vim /etc/nova/nova.conf
[DEFAULT]
...
force_config_drive=True
config_drive_format=iso9660
...
compute_driver=vmwareapi.VMwareVCDriver
[vmware]
host_ip=192.168.1.100
host_username=root
host_password=vmware
cluster_name=Cluster-1
datastore_regex=datastore1
wsdl_location=https://192.168.1.100/sdk/vimService.wsdl
insecure=True
Glance 配置(OpenStack 纳管 vCenter 镜像)
实际上在接入 vCenter 之后, Glance 的镜像仍能够存放在本地, 但当 vCenter 需要使用这个镜像来启动一个虚拟机时, 首先会将本地的镜像文件上传到 vCenter Datastore 之后才能开始创建, 相当耗时, 所以建议将镜像文件都上传到 Datastore 中.
OpenStack 对 vCenter 镜像的管理包括: 上传/下载 等功能.
- node1: vim /etc/glance/glance-api.conf
[DEFAULT]
...
known_stores = vmware
default_store = vsphere
[glance_store]
stores = file,http,vmware
vmware_server_host = 192.168.1.100
vmware_server_username = root
vmware_server_password = vmware
vmware_datastore_name = datastore1
vmware_datacenter_path = Datacenter-1
vmware_datastores = Datacenter-1:datastore1
vmware_task_poll_interval = 5
vmware_store_image_dir = /openstack_glance
vmware_api_insecure = True
Cinder 配置(OpenStack 纳管 vCenter 块设备)
其实这里与其说是 OpenStack 纳管 vCenter 块设备 不如说是 OpenStack Cinder 为 vCenter 提供块设备功能. 换句话来说, vCenter 能够使用 Cinder 提供的 Volumes 来创建虚拟机和作为存储使用. 除此之外, Cinder 仍能保持对块存储的管理功能, 如: Volumes 的 创建/删除/快照/挂载/卸载 等. 有以下两点需要注意:
- Volumes 的挂载与卸载操作需要关闭虚拟机电源
Cinder 不支持 Volumes 的备份功能
- node1: vim /etc/cinder/cinder.conf
[DEFAULT]
...
default_volume_type = vmware
enabled_backends = vmware
[vmware]
vmware_insecure=True
vmware_host_ip=192.168.1.100
vmware_host_username=root
vmware_host_password=vmware
vmware_volume_folder=Volumes
vmware_wsdl_location=https://192.168.1.100/sdk/vimService.wsdl
volume_driver=cinder.volume.drivers.vmware.vmdk.VMwareVcVmdkDriver
vmware_insecure = True
- node2: vim /etc/cinder/cinder.conf
[DEFAULT]
...
default_volume_type = vmware
enabled_backends = vmware
[vmware]
vmware_insecure = true
vmware_host_ip=192.168.1.100
vmware_host_username=root
vmware_host_password=vmware
vmware_wsdl_location=https://192.168.1.100/sdk/vimService.wsdl
volume_driver = cinder.volume.drivers.vmware.vmdk.VMwareVcVmdkDriver
vmware_insecure = True
NOTE: 需要创建名为 vmware 的类型
cinder type-create vmware
Ceilometer 配置
VMware 暴露的监控最小采集频率是 300s, OpenStack Ceilometer 目前仅提供了对虚拟机的监控能力, 但能够通过其他的 vSphere API 来拿到更多 Datacenter/Cluster/Host/VirtualMachine 的 runtime information, 基本上包含了 CPU/Mem/DiskIO/网络流量 四个常规的监控对象.
- node1: vim /etc/ceilometer/ceilometer.conf
[DEFAULT]
...
hypervisor_inspector=vsphere
[node]
virt_inspector=vmware
[vmware]
host_ip=192.168.1.100
host_username=root
host_password=vmware
wsdl_location=https://192.168.1.100/sdk/vimService.wsdl
insecure=True
[service_credentials]
# 如果是多region,请更改下面配置项
#os_region_name = <RegionName>
- node2: vim /etc/ceilometer/ceilometer.conf
[DEFAULT]
...
hypervisor_inspector=vsphere
[node]
virt_inspector=vmware
[vmware]
host_ip=192.168.1.100
host_username=root
host_password=vmware
wsdl_location=https://192.168.1.100/sdk/vimService.wsdl
insecure=True
[service_credentials]
# 如果是多region,请更改下面配置项
#os_region_name = <RegionName>
测试
- Step1: 重启相关服务
# node1
systemctl restart openstack-nova-compute.service openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
systemctl restart openstack-glance-api.service
systemctl restart openstack-cinder-api.service openstack-cinder-volume.service
systemctl restart openstack-ceilometer-collector.service openstack-ceilometer-api.service
# node2
systemctl restart openstack-nova-compute.service openstack-nova-api.service
systemctl restart openstack-cinder-api.service openstack-cinder-volume.service
systemctl restart openstack-ceilometer-collector.service openstack-ceilometer-api.service
- Step2: 尝试上传镜像文件, 在上传镜像的时候, 我们需要注意以下两点:
NOTE 1: 首先需要知道镜像文件的「disktype 和 adaptertype」, 使用指令 head -20 <vmdk_image_file>
就能够查看相关类型.
[root@seed ~]# head -20 cirros-0.3.2-i386-disk.vmdk
KDMV�9��
# Disk DescriptorFile
version=1
CID=5350c0c0
parentCID=ffffffff
createType="monolithicSparse"
# Extent description
RW 80325 SPARSE "cirros-0.3.2-i386-disk.vmdk"
# The Disk Data Base
#DDB
ddb.virtualHWVersion = "4"
ddb.geometry.cylinders = "79"
ddb.geometry.heads = "16"
ddb.geometry.sectors = "63"
ddb.adapterType = "ide" # adaptertype == ide
���������
NOTE 2: 如果使用指令 qemu-img
将 qcow2/img 格式的镜像文件转换成 vmdk 格式镜像文件时, vmware_disktype
通常为 sparse
, 而 vmware_adaptertype
通常为 ide
, 所以相应的可以使用下面的镜像上传指令:
glance image-create \
--name fanguiju-test-2 \
--container-format bare \
--disk-format vmdk \
--property vmware_disktype="sparse" \
--property vmware_adaptertype="ide" \
< cirros-0.3.2-i386-disk.vmdk
+--------------------+----------------------------------------------------------------------------------+
| Property | Value |
+--------------------+----------------------------------------------------------------------------------+
| checksum | 3fd19141ff969dcb4926b610769e5ba4 |
| container_format | bare |
| created_at | 2017-04-19T08:27:25Z |
| direct_url | vsphere://192.168.1.100/folder/openstack_glance/70d581d4-1829-45c1-ac6c- |
| | ac1755da1650?dcPath=Datacenter-1&dsName=datastore1 |
| disk_format | vmdk |
| id | 70d581d4-1829-45c1-ac6c-ac1755da1650 |
| locations | [{"url": "vsphere://192.168.1.100/folder/openstack_glance/70d581d4-1829-45c1 |
| | -ac6c-ac1755da1650?dcPath=Datacenter-1&dsName=datastore1", "metadata": {}}] |
| min_disk | 0 |
| min_ram | 0 |
| name | fanguiju-test |
| owner | 1774b99ae7374d9b948fb4146fbf49fb |
| protected | False |
| size | 17104896 |
| status | active |
| tags | [] |
| updated_at | 2017-04-19T08:27:28Z |
| virtual_size | None |
| visibility | private |
| vmware_adaptertype | ide |
| vmware_disktype | sparse |
+--------------------+----------------------------------------------------------------------------------+
PS: 建议使用测试镜像文件.
NOTE 3: 如果上传镜像文件失败, 并且通过 glance/api.log 看出为 glance_store 相关的 ERROR, 可以尝试升级 glance_store 的版本. L版管理vmware需要升级 glance-store 的步骤:
[root@seed yum.repos.d]# rpm -ivh https://repos.fedorapeople.org/repos/openstack/openstack-mitaka/rdo-release-mitaka-5.noarch.rpm
[root@seed yum.repos.d]# vim rdo-release.repo
[root@seed yum.repos.d]# yum makecache
[root@seed yum.repos.d]# yum update python-glance-store
Datastore 创建了 openstack_glance 目录:
- Step 3: 启动虚拟机
vCenter 任务流:
在 vCenter 中启动成功:
- Step4: 创建 Cinder volumes 后能在 vCenter「虚拟机与模板」界面看到对应的 Volumes, 然后就可以使用这个 Volumes 来创建虚拟机或作为存储使用了.