Skip to content

Instantly share code, notes, and snippets.

@ties
Created November 11, 2013 20:48
Show Gist options
  • Save ties/7420083 to your computer and use it in GitHub Desktop.
Save ties/7420083 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
"""
The libvirt API is much easier than my old kludge based on `virsh list` and sed…
"""
import libvirt
conn = libvirt.open(None)
for id in conn.listDomainsID():
domain = conn.lookupByID(id)
domain.shutdown()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment