1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| # 构建镜像踩的坑(基于Wallaby版源码做的修改): # 1. apt、pip源为国外源,下载慢,大概率失败,需要替换为国内源 # 2. 编译ubuntu镜像时,宿主机为centos,导致pkg_map解析包名错误。需增加如下环境变量:export DISTRO_NAME=${guest_os} # 3. root密码没有,无法登陆。需下functions_qemu文件中,增加local root_password="inspur_trove@123" # 4. elements guest-agent中source-repository-guest-agent获取位置需要修改,调整为本地代码库及本地文件 # 5. v版之后,guest-agent镜像切换为docker,docker image从docker源上下载。如果本地为http源,则需要打包镜像时将该域名添加为insecure-registries # 6. ubuntu系统自带的systemd-resolved服务,会导致域名解析文件不生效。解决办法如下:ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
# 基础参数 guest_os=ubuntu guest_os_release=bionic dev_mode=false guest_username=ubuntu output_image_path=$HOME/images/trove-guest-${guest_os}-${guest_os_release}.qcow2
# 进入trove/integration/scripts目录,执行如下构建镜像命令,前期准备注意以下两点: # 1. 需要切换为普通用户执行 # 2. 普通用户最好可以免密sudo $ ./trovestack build-image \ ${guest_os} \ ${guest_os_release} \ ${dev_mode} \ ${guest_username} \ ${output_image_path}
# 上传镜像至glance $ openstack image create trove-guest-ubuntu-bionic-a \ --private \ --disk-format qcow2 \ --container-format bare \ --tag trove --tag mysql \ --file ~/trove-guest-ubuntu-bionic.qcow2
# 镜像与trove关联 $ openstack datastore version create 8.0 mysql mysql "" \ --image-tags trove,mysql \ --active --default
# 同步数据库配置 $ trove-manage db_load_datastore_config_parameters mysql 8.0 \ /var/lib/kolla/venv/lib/python3.6/site-packages/trove/templates/mysql/validation-rules.json
# 查看datastore version $ openstack datastore version list mysql
# 删除datastore version $ openstack datastore version delete < datastore version id >
# 更新datastore version关联镜像 $ openstack datastore version set --image < image id > < datastore version id >
|