[Buildbot-commits] [SPAM] [Buildbot] #791: Add support for libvirt-based latent slaves

Buildbot buildbot-devel at lists.sourceforge.net
Sun Apr 11 15:47:38 UTC 2010


#791: Add support for libvirt-based latent slaves
------------------------+---------------------------------------------------
Reporter:  dustin       |       Owner:       
    Type:  enhancement  |      Status:  new  
Priority:  major        |   Milestone:  0.8.+
 Version:  0.8.0        |    Keywords:       
------------------------+---------------------------------------------------
 Here's a paste from nelly on IRC:

 {{{
 from twisted.internet import defer, threads
 from buildbot.buildslave import AbstractLatentBuildSlave
 import libvirt

 class VirshBuildSlave(AbstractLatentBuildSlave):
         #def __init__(self, name, password):
         #       self.virsh_name = name
         #       self.host_passwd = password

         #To use, subclass and implement start_instance and stop_instance.
         def start_instance(self):
                 return threads.deferToThread(self._start_instance)

         def _start_instance(self):
                 # responsible for starting instance that will try to
 connect with this
                 # master. Should return deferred. Problems should use an
 errback. The
                 # callback value can be None, or can be an iterable of
 short strings to
                 # include in the "substantiate success" status message,
 such as
                 # identifying the instance that started.
                 conn = libvirt.open(None)
                 if conn == None:
                         raise NotImplementedError # Should really raise a
 better error
                 try:
                         host = conn.lookupByName(self.slavename)
                 except:
                         raise NotImplementedError # Should really raise a
 better error

                 run_state = host.info()[0]
                 if libvirt.VIR_DOMAIN_PAUSED == run_state:
                         host.resume()

         def stop_instance(self, fast=False):
                 # responsible for shutting down instance. Return a
 deferred. If `fast`,
                 # we're trying to shut the master down, so callback as
 soon as is safe.
                 # Callback value is ignored.
                 raise NotImplementedError
 }}}

 It doesn't stop instances, and seems to only pause/unpause (not
 startup/shutdown), but it's a start!

-- 
Ticket URL: <http://buildbot.net/trac/ticket/791>
Buildbot <http://buildbot.net/>
Buildbot: build/test automation


More information about the Commits mailing list