This paper presents a thorough performance analysis of dual-hop cognitive amplify-and-forward (AF) relaying networks under spectrum-sharing mechanism over independent non-identically distributed (i.n.i.d.) 􀀀 fading channels. In order to guarantee the quality-of-service (QoS) of primary networks, both maximum tolerable peak interference power Q at the primary users (PUs) and maximum allowable transmit power P at secondary users (SUs) are considered to constrain transmit power at the cognitive transmitters. For integer-valued fading parameters, a closed-form lower bound for the outage probability (OP) of the considered networks is obtained. Moreover, assuming arbitrary-valued fading parameters, the lower bound in integral form for the OP is derived. In order to obtain further insights on the OP performance, asymptotic expressions for the OP at high SNRs are derived, from which the diversity/coding gains and the diversity-multiplexing gain tradeoff (DMT) of the secondary network can be readily deduced. It is shown that the diversity gain and also the DMT are solely determined by the fading parameters of the secondary network whereas the primary network only affects the coding gain. The derived results include several others available in previously published works as special cases, such as those for Nakagami-m fading channels. In addition, performance evaluation results have been obtained by Monte Carlo computer simulations which have verified the accuracy of the theoretical analysis.