apache / apache/cloudstack

Fix potential leaking of volume maps

Đang mở
#6,746 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
component:storage no-issue-activity status:stale type:enhancement
Ngôn ngữ chính
Java
Star
3.1k
Fork
1.4k
Merge trung bình
6 ngày 19 giờ
Pull request đã merge (30 ngày)
32

Mô tả

##### ISSUE TYPE
* Enhancement Request

##### COMPONENT NAME
~~~
Storage
~~~

##### CLOUDSTACK VERSION
~~~
Any
~~~

##### SUMMARY
Unmapping volumes from a hypervisor host upon VM stop or migration is done on a best-effort basis. The VM is already stopped, or already migrated, we try to unmap, but if something goes wrong there is really no recourse or retry and a warning is logged. This leaves a potential of leaking maps to hosts over time.

In code review I've also found edge cases where a VM is moved to "Stopped" state without necessarily cleaning up network or volume resources, these can also lead to leaked maps over time. Examples are force removing a hypervisor host with running VMs on it, and possibly any other code that just calls `vm.setState(State.Stopped)`.

My request is that we be more thorough during VM start in ensuring that our target host and *only* our target host has access to the volume. Or at least call the storage plugin involved to let it decide how to do this. It should be as simple as calling the storage service to "revoke all" just before we grant access, or allowing for an exclusive grant in the storage API.

For example, with the PowerFlex/ScaleIO storage client there is an `unmapVolumeFromAllSdcs` that could be called just prior to granting access to volumes during VM start.

We may need to add a `revokeAllAccess()` method to the `PrimaryDataStoreDriver`, or add a flag to the existing `revokeAccess` to indicate that the storage driver should revoke all.

Or alternatively (I think I like this better), the `grantAccess()` call might gain a flag `boolean exclusive` so the storage driver can be instructed to ensure that only one mapping exists - the one requested. This would be cleaner.

Crucially - we need to avoid exclusive access during the live migration workflows. It seems safe to ensure exclusive access during VM start, however.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Start with PrimaryDataStoreDriver and the grantAccess/revokeAccess call paths used during VM start and live migration. Compare how volume access is handled when a VM starts, stops, or migrates, including the PowerFlex/ScaleIO unmapVolumeFromAllSdcs example. Done means VM start prevents stale mappings while live migration does not use exclusive access.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java
Lĩnh vực
cloud, infrastructure
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.