<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                部署一臺大容量后端存儲節點 采用nfs共享鏡像池 結合linux硬鏈接技術 結合openstack hash值鏡像ID生成代碼 優點:快速啟動、鏡像備份、適合快速開發測試私有云環境 難點:環境要穩定、快速孵化、網絡帶寬、計算資源、存儲資源要足 注析: 1、`/var/lib/nova/instances`目錄是計算節點虛擬機文件目錄 2、`/var/lib/nova/instance/_base`下面是存在的cache,這個本質是鏡像,只是權限和宿舍用戶不一樣而已,同時,我們可以通過ln硬鏈接生成放在這個目錄下,`_base`目錄下的文件不能丟失,否則依賴cache創建的虛擬機將無法啟動,如果想要重新使用這個虛擬機就需要將cache重新放回到目錄下并在對于的計算節點執行如下命令:`nova restet-state --active error-vm-id`。如果刪除了原來的鏡像需要定期清理ln,防止撐爆磁盤! 3、`/var/lib/glance/images`是控制節點上存鏡像的目錄 如果要孵化一個很大的虛擬機(孵化時間長容易造成孵化失敗),在dashboard創建的話速度會很慢(首次創建很慢) 查看流量的工具nload 使用命令:nload 查看流量 如果在生產環境中我們可以預先把鏡像的ln(鏡像ID值)移動到`/var/lib/nova/instances/_base`下,再創建虛擬機的時候會非常快,快的原因是不需要再下載虛擬機鏡像了 總結: 0、nfs-backend節點 install build 網卡最好萬兆 1、每個計算節點`/var/lib/nova/instance/_base` 都要預先有`image cache(ln硬鏈接生成的)` 2、`/var/lib/glance/images ---ln---> /var/lib/glance/imagecache` 這兩個目錄是在一個`nfs-backend`節點上的,而且都是一個文件系統下的 3、定時,自動,無縫隙(間隔時間要非常小) 做ln,寫腳本:python腳本 腳本代碼如下: ``` import os import logging import logging.handlers import hashlib import commands LOG_FILE = ‘ln_all_images.log’ handler = logging.handlers.RotatingFileHandler(LOG_FILE, maxBytes = 1024*1024, backupCount = 5) fmt = '%(asctime)s - %(filename)s:%(lineno)s - %(name)s - %(message)s' formatter = logging.Formatter(fmt) handler.setFormatter(formatter) logger = logging.getLogger('images') logger.addHandler(handler) logger.setLevel(logging.DEBUG) #imges_list = commands.getoutput("ls -l tr /var/lib/glance/images | awk 'NR>1{ print $NF }‘").strip().split('\n') imges_list = commands.getoutput("""glance image-list | awk -F"|" '{print $2}' |grep -v -E '(ID|^$'""").strip().split() status = commands.getoutput("""openstack image list | awk 'NR>2{ print $6} |grep -v -E '(ID|^$'""").strip().split() queued = "queued" saving = "saving" #print status #print type(staus) if queued in status or saving in stauts: ????????????????? image_list_1 = commands.getoutput(ls -l tr /var/lib/glance/images | awk 'NR>1 {1[NR]=$0} END {for (i=1;i<=NR-3;i++)print l[i]}' | awk '{print $9}' | awk '{ print $9}' |grep -v ^$").strip().split() logger.info('new snapshoot is creating now...') for ida in image_list_1: ?????????????????????????????????image_id = ida.strip() image_id_hash = hashlib.sha1() image_id_hash.update(ida) newid1 = image_id_hash.hexdigest() commands.getoutput('ln /var/lib/glance/images/{0} /var/lib/glance/imagecache/{1}'.format(ida,newid1)) commands.getoutput('chown qemu:qemu /var/lib/glance/imagecache/{0}'.format(newid1)) commands.getoutput('chmod 644 /var/lib/glance/imagecache/{0}').format(newid1)) else: image_list_2 = commands.getoutput("ls -l tr /var/lib/glance/images | awk 'NR>1{ print $NF }'").strip().split() logger.info('no image take snapshoot, ln all images...') for ida in image_list_2: ??????????????????????????????????image_id = ida.strip() image_id_hash = hashlib.sha1() image_id_hash.update(ida) newid2 = image_id_hash.hexdigest() commands.getoutput('ln /var/lib/glance/images/{0} /var/lib/glance/imagecache/{1}'.format(ida,newid2)) commands.getoutput('chown qemu:qemu /var/lib/glance/imagecache/{0}'.format(newid2)) commands.getoutput('chmod 644 /var/lib/glance/imagecache/{0}').format(newid2)) #logger.info('in %s successful...' %(idb)) ``` 4、定時可以通過linux的crontab,自動用腳本`ln_all_images.py`,無縫隙定時執行,每10秒執行一次`* * * * * sleep 10`; ``` * * * * * source /root/admin-openrc && /usr/bin/python /root/ln_all_images.py * * * * * sleep 10; source /root/admin-openrc && /usr/bin/python /root/ln_all_images.py * * * * * sleep 20; source /root/admin-openrc && /usr/bin/python /root/ln_all_images.py * * * * * sleep 30; source /root/admin-openrc && /usr/bin/python /root/ln_all_images.py * * * * * sleep 40; source /root/admin-openrc && /usr/bin/python /root/ln_all_images.py * * * * * sleep 50; source /root/admin-openrc && /usr/bin/python /root/ln_all_images.py ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看