A former Virginia lawmaker has pleaded guilty to felony gun and drug charges and been sentenced to time already served in jail.