Except when it is otherwise provided, the party for whom final judgment is given in an action or motion shall recover his costs against the opposite party. When the action is against two or more and there is a judgment for, or discontinuance as to, some, but not all of the defendants, unless the court enter of record that there was reasonable cause for making defendants those for whom there is such judgment, or as to whom there is such discontinuance and shall order otherwise, they shall recover their costs.
Va. Code § 17.1-601