本文首先發表在Ceph中國社群,署名Thomas,并由半天河校稿,現貼到個人部落格,以便大家閱讀
英文出處:OpenStack Cinder: discard support for Ceph in Mitaka 歡迎加入 翻譯小組
![](https://img.laitimes.com/img/__Qf2AjLwojIjJCLyojI0JCLicGcq5CawV2YtE2ahRXat1iclRmbpNWLrNWY0NnblB3bvw1cldWYtl2Lcd2bsJ2LcJnZu4WYo1ibllGdzFmYlNnL3d3dvw1LcpDc0RHaiojIsJye.jpg)
Openstack Mitaka 支援一個新的特性。該特性是Nova discard implementation的一個後續實作。現在你可以為每個Cinder後端配置該特性了。
(譯者注:要使用該特性)
Glance
鏡像必須具有
hw_scsi_model=virtio-scsi
及
hw_disk_bus=scsi
屬性。
如果你的鏡像沒有這兩個屬性,可以通過下面的指令更新以添加這兩個屬性:
作為一個運維,你可以通過配置
Cinder Volume
以使你的存儲後端具備報告
discard
的能力。這很簡單,你隻需簡單的将
report_discard_supported = True
添加到
backend section
,如下:
[ceph]
rbd_max_clone_depth =
rbd_flatten_volume_from_snapshot = False
rbd_uuid = ed23bd0-aa89-b0b-b5c6-bf4da08afd
rbd_user = cinder
rbd_pool = volumes
rbd_ceph_conf =
volume_driver = cinder.volume.drivers.rbd.RBDDriver
volume_backend_name = ceph
report_discard_supported = true
最後,重新啟動
Cinder Volume
服務。現在你可以挂載塊裝置了。如果你要驗證塊裝置是否已經支援
discard
,你可以檢視虛拟機的
libvirt xml
配置檔案。或者,在虛拟機裡面檢視檔案
/sys/block/sdb/queue/discard_*
。
每次使用fstrim來回收空間都要小心,因為這會帶來一定的性能損耗。