Last active
December 29, 2015 11:59
-
-
Save vnugent/7667617 to your computer and use it in GitHub Desktop.
force clean rhev VMs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select vms.vm_guid into temp bad_vms from vms where status=8; | |
select device_id into temp bad_vm_devices from vm_device where type='disk' and device='disk' and vm_id in (select vm_guid from bad_vms); | |
delete from vm_device where vm_id in (select vm_guid from bad_vms); | |
delete from vm_statistics where vm_guid in (select vm_guid from bad_vms); | |
delete from snapshots where vm_id in (select vm_guid from bad_vms); | |
delete from vm_static where vm_guid in (select vm_guid from bad_vms); | |
delete from vm_interface where vm_guid in (select vm_guid from bad_vms); | |
delete from vm_interface_statistics where vm_id in (select vm_guid from bad_vms); | |
delete from vm_dynamic where vm_guid in (select vm_guid from bad_vms); | |
delete from tags_vm_map where vm_id in (select vm_guid from bad_vms); | |
delete from vm_pool_map where vm_guid in (select vm_guid from bad_vms); | |
delete from base_disks where disk_id in (select device_id from bad_vm_devices); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment