這篇文章主要介紹如何實現(xiàn)openstack主機內(nèi)存ram超額分配,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!
成都創(chuàng)新互聯(lián)公司是網(wǎng)站建設(shè)技術(shù)企業(yè),為成都企業(yè)提供專業(yè)的成都網(wǎng)站建設(shè)、做網(wǎng)站,網(wǎng)站設(shè)計,網(wǎng)站制作,網(wǎng)站改版等技術(shù)服務(wù)。擁有10余年豐富建站經(jīng)驗和眾多成功案例,為您定制適合企業(yè)的網(wǎng)站。10余年品質(zhì),值得信賴!
openstack提供資源利用率的方式一種主要途徑是創(chuàng)建虛擬機時對內(nèi)存進行超額分配。在對物理主機的選擇策略如下代碼所示:
def host_passes(self, host_state, filter_properties): """Only return hosts with sufficient available RAM.""" instance_type = filter_properties.get('instance_type') requested_ram = instance_type['memory_mb'] free_ram_mb = host_state.free_ram_mb total_usable_ram_mb = host_state.total_usable_ram_mb ram_allocation_ratio = self._get_ram_allocation_ratio(host_state, filter_properties) memory_mb_limit = total_usable_ram_mb * ram_allocation_ratio used_ram_mb = total_usable_ram_mb - free_ram_mb usable_ram = memory_mb_limit - used_ram_mb if not usable_ram >= requested_ram: LOG.debug("%(host_state)s does not have %(requested_ram)s MB " "usable ram, it only has %(usable_ram)s MB usable ram.", {'host_state': host_state, 'requested_ram': requested_ram, 'usable_ram': usable_ram}) return False # save oversubscription limit for compute node to test against: host_state.limits['memory_mb'] = memory_mb_limit return True
total_usable_ram_mb為物理主機所能提供的物理內(nèi)存,如4G,8G,ram_allocation_ration為內(nèi)存超額分配系數(shù),在nova.conf中設(shè)置。openstack默認超額分配系數(shù)為1.5。free_ram_mb為主機剩余內(nèi)存值,該值可為負數(shù)。used_ram_mb為以分配內(nèi)存,一般為該主機上已創(chuàng)建虛擬機內(nèi)存總和。memory_mb_limit為超額后的內(nèi)存,當(dāng)剩余可以可用的useble_ram內(nèi)存小于虛擬機的創(chuàng)建時所需內(nèi)存時,表示該主機無法創(chuàng)建虛擬機,系統(tǒng)將不會選擇該主機創(chuàng)建虛擬機。
以上是“如何實現(xiàn)openstack主機內(nèi)存ram超額分配”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
網(wǎng)站名稱:如何實現(xiàn)openstack主機內(nèi)存ram超額分配
鏈接分享:http://chinadenli.net/article38/joiipp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供關(guān)鍵詞優(yōu)化、網(wǎng)站收錄、電子商務(wù)、企業(yè)建站、網(wǎng)站建設(shè)、營銷型網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)