Ticket #791 (closed enhancement: invalid)
Add support for libvirt-based latent slaves
|Reported by:||dustin||Owned by:|
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() 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!
Note: See TracTickets for help on using tickets.