Random   •   Archives   •   RSS   •   About   •   Contact

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

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!




Want comments on your site?

Remarkbox — is a free SaaS comment service which embeds into your pages to keep the conversation in the same place as your contentr. It works everywhere, even static HTML sites like this one!

Remarks: virt-back's Domfetcher class returns doms from libvirt API

© Russell Ballestrini.