Fix : UnboundLocalError: local variable 'res' referenced before assignment
Local variable res is accessed before assignment when the vm is not in active or shutoff state.
Local variable res is accessed before assignment when the vm is not in active or shutoff state.