virt-back’s Domfetcher class returns doms from libvirt API

This entry is part 3 of 3 in the series Virt-back
2013-03-02-scale-virt-back-domfetcher-scaled

I’m hooked…

I attended SCaLE 11x, my first technical conference, and had an amazing time. My favorite talk was Michael Day’s “Advancements with Open Virtualization & KVM” (link to slides). Michael’s presentation inspired me to continue my work on virt-back.

During my trip home I used the in-flight wifi to push this commit into the cloud from the clouds! This particular commit re-factored the dom object list generation into a simple-to-use class called Domfetcher. Domfetcher abstracts the libvirt API and grants access to the following helper methods:

get_all_doms( )
Return a list of all dom objects

get_doms_by_names( guest_names=[] )
Accept a list of guest_names, return a list of related dom objects

get_running_doms( )
Return a list of running dom objects

get_shutoff_doms( )
Return a list of shutoff but defined dom objects

This is an example of how to use Domfetcher:

import virtback

# optionally supply hypervisor uri
domfetcher = virtback.Domfetcher()

doms = domfetcher.get_running_doms()

for dom in doms:
    print dom.name()

for dom in doms:
    print dom.info()

for dom in doms:
    print dom.shutdown()

As always thanks for reading!
Series Navigationvirt-back: restoring from backups

Leave a Reply

Your email address will not be published. Required fields are marked *