If you messed up your VM and made it unbootable, it's often useful to be able to go in and edit /boot/grub/grub.conf. This guestfish script shows how to do that.

editgrub.sh broken-guest.img

See also virt-edit.