OpenStack-RBD 导入镜像
方法 1
使用命令导入假镜像
openstack image create "Ubuntu18.04" \ --file ~/cirros-0.4.0-x86_64-disk.img \ --disk-format raw --container-format bare \ --property hw_scsi_model=virtio-scsi \ --property hw_disk_bus=scsi \ --property hw_qemu_guest_agent=yes \ --property os_require_quiesce=yes \ --property os_type=linux \ --property os_admin_user=root \ --min-disk 20 \ --min-ram 2048 \ --public # ................ # id | ef85323a-c0f1-4452-922c-bdb8592fddde # .................rbd 导入
# 解除快照保护 rbd snap unprotect images/ef85323a-c0f1-4452-922c-bdb8592fddde@snap # 删除快照 rbd snap rm images/ef85323a-c0f1-4452-922c-bdb8592fddde@snap # 删除镜像 rbd rm images/ef85323a-c0f1-4452-922c-bdb8592fddde # 导入镜像 ubuntu18.04.raw rbd import ubuntu16.04.raw images/ef85323a-c0f1-4452-922c-bdb8592fddde # 创建快照 rbd snap create images/ef85323a-c0f1-4452-922c-bdb8592fddde@snap # 保护快照 rbd snap protect images/ef85323a-c0f1-4452-922c-bdb8592fddde@snap计算镜像
md5和sha512值# 计算md5值 md5sum ubuntu18.04.raw # ba3cd24377dde5dfdd58728894004abb ubuntu18.04.raw # 计算 sha512值 sha512sum ubuntu18.04.raw # b795f047a1b10ba0b7c95b43b2a481a59289dc4cf2e49845e60b194a911819d3ada03767bbba4143b44c93fd7f66c96c5a621e28dff51d1196dae64974ce240e ubuntu18.04.raw连接数据库,更新数据
UPDATE `glance`.`images` -- 镜像大小 SET `size` = 21474836480, -- 镜像md5值 `checksum` = '7324c73bee3216b5c7a9d27370eb1774', -- sha512 校验 `os_hash_algo` = 'sha512', `os_hash_value` = '5ee4ca048ef161f661cf308654cc7e7bdcb9af6905447c1b098aa3df09a27fd8468ee7573f3e092051422c07e6ee67fb1aab5119172c06d551005b5192562778' WHERE `id` = 'ef85323a-c0f1-4452-922c-bdb8592fddde';
方法 2
导入脚本
最后更新于