Principle
Operations
Ironic部署过程中会看到有两套kernel initrd , 需要知道他们是用于不同的目的。
一个是deploy image,
- 必须包含ironic python agent
- 作用是dd user image 到裸机的硬盘上。
一个是user image ,有2种:
-
partition image
也叫做half imge,只是一个root partition , 在写到磁盘之后,裸机启动有2种方式:- 从pxe启动,使用这个user image的kernel 和 ramdisk。
- 从硬盘启动,这个需要配置ironic node的local boot特性。
-
whole image
- 包括分区表和bootloader
- 在whole image写到磁盘之后,ironic就不管裸机的启动了,默认是从硬盘启动。
使用方式,参见:
https://docs.openstack.org/project-install-guide/baremetal/draft/configure-glance-images.html
How to Deploy user image ?
无论是使用Half user image, 还是Whole user image, 开始都是使用deploy Image去实现”将 user image 写入到 裸机的硬盘中“ 这一过程, 因此在部署时,要注意配置deploy image
ironic node-update node1 add \
driver_info/deploy_kernel=$DEPLOY_KERNEL_ID \
driver_info/deploy_ramdisk=$DEPLOY_RAMDISK_ID
deploy时是先启动一个小系统,然后将qcow2文件利用iscsi协议写入到硬盘中去。
这个小系统里面要有ironic python agent , 要 iscsi, dd qcow2 到磁盘。
参见
使用Half User Image
上传 half user-os image时,同时也要上传kernel和initrd, 这个image的property要带上kernel , initrd参数。
[root@cloud-sz-kolla-b13-01 ironic]# openstack image list |grep bm-user
| bea4a10b-5ff2-4105-955d-0e79358df311 | bm-user-half-centos6-initrd | active |
| 04a2d4e9-4da7-4870-88bc-71d9282aa622 | bm-user-half-centos6-kernel | active |
| e36a093d-cb18-4a72-bc7f-737502cb0f88 | bm-user-half-centos6-os | active |
| b48ace11-cec3-4a30-8cdd-ee643cccde95 | bm-user-half-centos7-initrd | active |
| 6ab91df6-1ede-4cf5-b824-dd1680ef3860 | bm-user-half-centos7-kernel | active |
| e0750ab1-41d0-419f-a418-475b8a5591f0 | bm-user-half-centos7-os | active |
| e5a3d158-dece-4fbd-ae3b-3bbf3077f560 | bm-user-whole-centos6-os | active |
| bbc8e047-0ab3-4396-b3b4-1497992723eb | bm-user-whole-centos7-os | active |
[root@cloud-b13-01 ironic]# openstack image show bm-user-half-centos7-os
+------------------+-----------------------------------------------------------------------------------------------------+
| Field | Value |
+------------------+-----------------------------------------------------------------------------------------------------+
| checksum | 7cbedc4d391e34bf24d5ad10727c512d |
| container_format | bare |
| created_at | 2017-11-17T02:54:53Z |
| disk_format | qcow2 |
| file | /v2/images/e0750ab1-41d0-419f-a418-475b8a5591f0/file |
| id | e0750ab1-41d0-419f-a418-475b8a5591f0 |
| min_disk | 0 |
| min_ram | 0 |
| name | bm-user-half-centos7-os |
| owner | 21fe1bab6b494fab94e6fded5ebd893a |
| properties | kernel_id='6ab91df6-1ede-4cf5-b824-dd1680ef3860', ramdisk_id='b48ace11-cec3-4a30-8cdd-ee643cccde95' |
| protected | False |
| schema | /v2/schemas/image |
| size | 570490880 |
| status | active |
| tags | |
| updated_at | 2017-11-17T02:54:59Z |
| virtual_size | None |
| visibility | public |
+------------------+-----------------------------------------------------------------------------------------------------+
使用whole image
Whole Image有什么好处呢? 什么时候适合使用Whole image ?
-> 不需要kernel, initrd文件(用于boot 裸机)
-> 方便安装Windows操作系统。
拿centos7 whole image做测试,deploy之前is_whole_disk_image是false , 之后变成了True
| driver_internal_info | {u'agent_url': u'http://192.168.0.112:9999', u'root_uuid_or_disk_id': |
| | u'0x000666fc', u'is_whole_disk_image': True}
Local boot
Local boot是用于在ironic部署完裸机之后,控制裸机的启动方式,通常deploy完之后,裸机依然是pxe启动,参见doc
local boot就是指定从硬盘启动。
如果使用whole image,是否就不需要local boot ?
-》是的,测试发现,使用whole image时,加不加local boot特性都一样:默认都是从硬盘启动。
Whole disk images, on the contrary, support only local boot, and use it by default.
测试部署centos6 half image, 没有配置local boot,但还是报install bootloader failed的错误。
Ironic Inspect
inspect是用来在ironic部署时做硬件检测的, 如果裸机硬盘和网卡都正常,inspect过程是完全可以跳过去的。
inspect 之前
[root@cloud-sz-kolla-b13-01 ironic-deploy-test]# openstack hypervisor show 44e91a6a-4d7d-4f6e-812a-d3b626769b01+----------------------+--------------------------------------+
| Field | Value |
+----------------------+--------------------------------------+
| aggregates | [u'baremetal-hosts'] |
| cpu_info | |
| current_workload | 0 |
| disk_available_least | 10 |
| free_disk_gb | 10 |
| free_ram_mb | 4000 |
| host_ip | 10.54.12.22 |
| hypervisor_hostname | 44e91a6a-4d7d-4f6e-812a-d3b626769b01 |
| hypervisor_type | ironic |
| hypervisor_version | 1 |
| id | 202 |
| local_gb | 10 |
| local_gb_used | 0 |
| memory_mb | 4000 |
| memory_mb_used | 0 |
| running_vms | 0 |
| service_host | cloud-sz-control-b12-02-ironic |
| service_id | 160 |
| state | up |
| status | enabled |
| vcpus | 1 |
| vcpus_used | 0 |
+----------------------+--------------------------------------+
上面的内存,磁盘大小等数据是在添加ironic节点时手动指定的,
ironic node-update $node_name add \
properties/cpus=1 \
properties/memory_mb=4000 \
properties/local_gb=10 \
properties/cpu_arch="x86_64" \
properties/capabilities="boot_option:local"
inspect 之后
[root@cloud-sz-kolla-b13-01 ironic-deploy-test]# openstack hypervisor show 44e91a6a-4d7d-4f6e-812a-d3b626769b01+----------------------+--------------------------------------+
| Field | Value |
+----------------------+--------------------------------------+
| aggregates | [u'baremetal-hosts'] |
| cpu_info | |
| current_workload | 0 |
| disk_available_least | 221 |
| free_disk_gb | 221 |
| free_ram_mb | 524288 |
| host_ip | 10.54.12.22 |
| hypervisor_hostname | 44e91a6a-4d7d-4f6e-812a-d3b626769b01 |
| hypervisor_type | ironic |
| hypervisor_version | 1 |
| id | 202 |
| local_gb | 221 |
| local_gb_used | 0 |
| memory_mb | 524288 |
| memory_mb_used | 0 |
| running_vms | 0 |
| service_host | cloud-sz-control-b12-02-ironic |
| service_id | 160 |
| state | up |
| status | enabled |
| vcpus | 112 |
| vcpus_used | 0 |
+----------------------+--------------------------------------+
所以,如果追求真实的磁盘,内存数据,就不要跳过inspect过程。