You're not helping your case any to suggest it's ever okay commit genocide.
"I" do not commit genocide. "I" am not in a position to know read peoples hearts. As Christians, as well as the those the were under the Law Covenant were told by Jehovah that "vengeance is mine, and retribution." None of us are authorized to seek vengeance for ourselves. (De 32:35; Rom 12:19)
It is actually a loving thing for God to act in this way at specific times.
The wicked one is a ransom for the righteous one,
And the treacherous one will be taken in place of the upright.
- Proverbs 21:18
He does not act like this everyday, or we would know it. However, instead, he sets aside a "day of vengeance."
To proclaim the year of Jehovah's goodwill (or "favor.")
And the day of vengeance of our God,
To comfort all who mourn.
- Isaiah 61:2
Remember vengeance is defined as "retribution exacted for an injury or wrong." What the cities of Sodom and Gomorrah received was not genocide but vengeance. It comforted all those that were harmed by them. No more would anyone be hurt by these who were determined to cause others harm.