Skip to content

Instantly share code, notes, and snippets.

@omaciel
Created November 8, 2014 16:00
Show Gist options
  • Save omaciel/6e8e0bbcd582a2112e13 to your computer and use it in GitHub Desktop.
Save omaciel/6e8e0bbcd582a2112e13 to your computer and use it in GitHub Desktop.
Clean up Ginger
[root@ginger ~]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 803   qe-sat6iso-rhel65              running
 804   qe-sat6iso-rhel7               running
 919   rhel7abrt                      running
 1132  atomic-host4                   running
 1237  28315344                       running
 1295  33298768                       running
 1304  qe-sat6-rhel66                 running
 1305  qe-sat6-rhel65                 running
 1306  qe-sat6-rhel7                  running
 1310  qe-foreman-rhel66              running
 1311  qe-foreman-rhel7               running
 -     cswiii-rhel65                  shut off
 -     rhel510-base                   shut off
 -     rhel65-base                    shut off
 -     rhel66-base                    shut off
 -     rhel7-base                     shut off

[root@ginger ~]# for ver in 65 66 7; do for name in sat6 foreman; do virsh destroy qe-${name}-rhel${ver} && virsh undefine qe-${name}-rhel${ver}; done; done
Domain qe-sat6-rhel65 destroyed

Domain qe-sat6-rhel65 has been undefined

error: failed to get domain 'qe-foreman-rhel65'
error: Domain not found: no domain with matching name 'qe-foreman-rhel65'

Domain qe-sat6-rhel66 destroyed

Domain qe-sat6-rhel66 has been undefined

Domain qe-foreman-rhel66 destroyed

Domain qe-foreman-rhel66 has been undefined

Domain qe-sat6-rhel7 destroyed

Domain qe-sat6-rhel7 has been undefined

Domain qe-foreman-rhel7 destroyed

Domain qe-foreman-rhel7 has been undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment