1.登錄控制節點任意一臺服務器,將鏡像上傳到此節點 (建議所有鏡像都存放統一路徑,路徑可以自定義,也可以新建一個文件用來存放鏡像)
注:上傳鏡像用任意方式都行,crt或者其他工具!!!
2.編寫上傳腳本
[root@controller01 ~]# vi uplod.sh
#!/bin/bash
glance image-create --name \$1 --file \$2 --disk-format raw --container-format bare --visibility public --progress
#腳本參數說明,$1是在glance中看到的名字(自定義的名字),$2是上傳的鏡像路徑,最好加上絕對路徑
3.執行獲得權限腳本
[root@controller01 ~]# chmod uplod.sh
4.執行上傳腳本
格式:bash upload.sh 在glance中看到鏡像名字(自定義名字) 鏡像真是的名字(最好用絕對路徑)
例如:
[root@controller01 ~]# bash upload.sh win2008r2 /home/raw/20180112-win2008r2.raw
5.檢查鏡像是否上傳成功
[root@controller01 ~]# sh /root/admin-openrc.sh
[root@controller01 ~]# glance image-list