CLOUDSTACK-8858: listVolumes API fails for a particular domain with NPE.#830
Conversation
Summary: listVolumes API fails when volume associated vm instance has NULL or invalid state. Fix the code to guard this situation since this should not block volume listing.
|
PIng @DaanHoogland can you review this please? I'll run some tests. |
|
Though I would like to see how this situation is reproduced, the code is fine and sensible. LGTM |
|
I have the same concern with Daan. How to reproduce this issue ? mysql> select * from volumes where volume_type is null or provisioning_type is null or state is null; |
|
@DaanHoogland , @ustcweizhou mysql> SELECT id, name, volume_type, state, vm_state FROM cloud.volume_view where vm_state is null; |
|
@sureshanaparti How do we force such a situation to occur? |
|
mysql> SELECT id, name, volume_type, state, vm_state FROM cloud.volume_view where vm_state is null and vm_id is not null; even in vm_instance mysql> select * from vm_instance where state is null; |
|
@ustcweizhou , Same with my result set as well. mysql> SELECT id, name, volume_type, state, vm_state FROM cloud.volume_view where vm_state is null and vm_id is not null; |
|
The volumes, in Ready state and are not attached to any VM have their vm_state has null and querying such volumes may result in NPE. These changes are only to safe guard. |
|
@sureshanaparti please notice the code: if the volume is not attached, this judgment returns false. |
|
@ustcweizhou , Yes. I agree. In case on instance id, vm_state is not null. |
|
LGTM |
|
Merging as it has 2LGTMs |
CLOUDSTACK-8858: listVolumes API fails for a particular domain with NPE.CLOUDSTACK-8858: listVolumes API fails for a particular domain with NPE. Summary: listVolumes API fails when volume associated vm instance has NULL or invalid state. Fix the code to guard this situation since this should not block volume listing. * pr/830: CLOUDSTACK-8858: listVolumes API fails for a particular domain with NPE. Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
CLOUDSTACK-8858: listVolumes API fails for a particular domain with NPE.
Summary: listVolumes API fails when volume associated vm instance has NULL or invalid state. Fix the code to guard this situation since this should not block volume listing.