[libvirt] [PATCH 3/4] storage: Avoid unnecessary ternary operators and refactor the code