[Buildbot-devel] LibVirtSlave fails to stop VM

Frank Marien frank at apsu.be
Mon Feb 28 14:04:02 UTC 2011


Dear all,

Giving up on LibVirtSlave in 8.3.1 for now. Since it won't stop
, state is always wrong and won't start again.
I've been in the code, but I don't have time to get into it..
all the callbacks.. sorry..

Here's log with __dict__ dump. Hope it helps.

WKR
Frank.


2011-02-28 14:53:54+0100 [HTTPChannel,0,127.0.0.1]  <Build (tarball)>:
stopping build: The web-page 'stop build' button was pressed by
'<unknown>': <no reason specified>

2011-02-28 14:53:54+0100 [HTTPChannel,0,127.0.0.1] addCompleteLog(interrupt)
2011-02-28 14:53:54+0100 [HTTPChannel,0,127.0.0.1]
RemoteCommand.interrupt <RemoteShellCommand '['autoreconf', '-i',
'--force']'> The web-page 'stop build' button was pressed by
'<unknown>': <no reason specified>

2011-02-28 14:53:54+0100 [Broker,5,192.168.122.107] <RemoteShellCommand
'['autoreconf', '-i', '--force']'> rc=-1
2011-02-28 14:53:54+0100 [-] closing log
<buildbot.status.builder.LogFile instance at 0x366d488>
2011-02-28 14:53:54+0100 [-]
releaseLocks(<buildbot.steps.shell.ShellCommand instance at 0x30e18c0>): []
2011-02-28 14:53:54+0100 [-]  step 'bootstrap' complete: exception
2011-02-28 14:53:54+0100 [-]  <Build (tarball)>: build finished
2011-02-28 14:53:54+0100 [-] 'LOG: [<buildbot.status.builder.LogFile
instance at 0x3662cb0>, <buildbot.status.builder.LogFile instance at
0x3662a70>, <buildbot.status.builder.LogFile instance at 0x366d488>,
<buildbot.status.builder.LogFile instance at 0x30d8368>]'
2011-02-28 14:53:54+0100 [-] sending mail (100001 bytes) to []
2011-02-28 14:53:54+0100 [-] Starting factory
<twisted.mail.smtp.ESMTPSenderFactory instance at 0x3811170>
2011-02-28 14:53:54+0100 [-] Got buildFinished notification - attempting
to insubstantiate
2011-02-28 14:53:54+0100 [-] Attempting to stop 'arch32'

2011-02-28 14:53:54+0100 [-] HEY HEY HEY dict is [{'domain': None,
'substantiated': True, 'namedServices': {}, 'base_image':
'/vms/arch32.img', 'max_builds': 1, 'locks': [], 'pb_registration':
<buildbot.pbmanager.Registration object at 0x30ca350>, 'botmaster':
<buildbot.master.BotMaster instance at 0x2dd7cf8>, 'slave_commands':
{'svn': '2.11', 'stat': '2.11', 'shell': '2.11', 'bzr': '2.11', 'p4':
'2.11', 'uploadFile': '2.11', 'uploadDirectory': '2.11', 'mkdir':
'2.11', 'darcs': '2.11', 'downloadFile': '2.11', 'cvs': '2.11', 'repo':
'2.11', 'p4sync': '2.11', 'rmdir': '2.11', 'git': '2.11', 'cpdir':
'2.11', 'hg': '2.11', 'bk': '2.11'}, 'build_wait_timer': None,
'insubstantiate_after_build': True, '_shutdown_callback_handle':
('shutdown', ('before', <bound method LibVirtSlave._soft_disconnect of
<LibVirtSlave 'arch32', current builders: (tarball)>>, (), {'fast':
True})), 'access': [], 'slavename': 'arch32', 'slave_environ': {'TERM':
'linux', 'SHELL': '/bin/bash', 'SHLVL': '1', 'PWD': '/home/buildslave',
'LOGNAME': 'buildslave', 'USER': 'buildslave', 'HOME':
'/home/buildslave', 'PATH':
'/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/maven/bin:/usr/bin/core_perl',
'_': '/usr/bin/buildslave'}, 'lastMessageReceived': 1298901234.730405,
'slavebuilders': {'(tarball)': <LatentSlaveBuilder builder='(tarball)'
slave='arch32'>}, 'image': '/vms/snapshots/arch32.tmp',
'missing_timeout': 30, 'xml': None, 'slave_system': 'posix', 'slave':
<twisted.spread.pb.RemoteReference instance at 0x36541b8>, 'parent':
<buildbot.master.BotMaster instance at 0x2dd7cf8>, 'slave_basedir':
'/home/buildslave', 'running': 1, 'notify_on_missing': [], 'services':
[], 'password': '<password>', 'properties': {'slavename': 'arch32'},
'building': set([]), 'missing_timer': None, 'name': 'arch32',
'cheap_copy': True, 'connection': <buildbot.libvirtbuildslave.Connection
object at 0x2c4c350>, 'slave_status':
<buildbot.status.builder.SlaveStatus instance at 0x2c55758>,
'graceful_shutdown': False, 'build_wait_timeout': 1200}]



2011-02-28 14:53:54+0100 [-] Unhandled Error
        Traceback (most recent call last):
          File
"/usr/lib/python2.7/site-packages/buildbot/process/base.py", line 478,
in allStepsDone
            return self.buildFinished(text, self.result)
          File
"/usr/lib/python2.7/site-packages/buildbot/process/base.py", line 511,
in buildFinished
            self.deferred.callback(self)
          File
"/usr/lib/python2.7/site-packages/twisted/internet/defer.py", line 361,
in callback
            self._startRunCallbacks(result)
          File
"/usr/lib/python2.7/site-packages/twisted/internet/defer.py", line 455,
in _startRunCallbacks
            self._runCallbacks()
        --- <exception caught here> ---
          File
"/usr/lib/python2.7/site-packages/twisted/internet/defer.py", line 542,
in _runCallbacks
            current.result = callback(current.result, *args, **kw)
          File
"/usr/lib/python2.7/site-packages/buildbot/process/base.py", line 225,
in _release_slave
            self.slavebuilder.buildFinished()
          File
"/usr/lib/python2.7/site-packages/buildbot/process/builder.py", line
317, in buildFinished
            self.slave.buildFinished(self)
          File
"/usr/lib/python2.7/site-packages/buildbot/libvirtbuildslave.py", line
266, in buildFinished
            self.insubstantiate()
          File
"/usr/lib/python2.7/site-packages/buildbot/buildslave.py", line 715, in
insubstantiate
            d = self.stop_instance(fast)
          File
"/usr/lib/python2.7/site-packages/buildbot/libvirtbuildslave.py", line
241, in stop_instance
            d = domain.destroy()
        exceptions.AttributeError: 'int' object has no attribute 'destroy'




On 02/23/2011 07:29 PM, Neal Chant wrote:
> On Tue, 2011-02-22 at 22:51 +0100, Frank Marien wrote:
> 
>> Trying to use a libvirt buildslave..
>> Not getting anywhere with the 2-line example in the docs..
>>
>> I can instantiate a Connection object with the parameters found in the
>> class docs, using the URL I used in virt-manager,
>> that will make an ssh connection, just fine.
>>
>> But filling it out as a parameter to the LibVirtSlave constructor
>> (_init_) yields an assert.. as well as not using it at all.
>> (I can't access the box from here.. no details until thursday)
>>
>> My question: does anyone have a snippet of master config where you use
>> LibVirtSlave. That would really help me..
> 
> Hi,
> 
> The below worked in 7.i_forget.
> 
> note, if you require instant off there is a timeout setting to change in
> buildslave.py. build_wait_timeout
> 
> HTH
> Neal
> 
> ============================================================
> 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]
> 		
> 		# Start VM
> 		#if libvirt.VIR_DOMAIN_SHUTOFF == run_state:
> 		#	print "In _start_instance()"
> 		#	host.create() # create _is_ start
> 
> 		# Resume VM
> 		if libvirt.VIR_DOMAIN_PAUSED == run_state:
> 			print "In _start_instance()"		
> 			host.resume() # resume _is_ take from suspended state
> 
> 	def stop_instance(self, fast=False):
> 		return threads.deferToThread(
> 	            self._stop_instance, fast)
>      
> 	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.
>         	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
> 
> 		# Stop VM
> 		#run_state = host.info()[0]
> 		#if libvirt.VIR_DOMAIN_RUNNING == run_state:
> 		#	print "In _stop_instance()"
> 		#	host.destroy() # destroy _is_ halt
> 
> 		# Pause VM
> 		run_state = host.info()[0]
> 		if libvirt.VIR_DOMAIN_RUNNING == run_state:
> 			print "In _stop_instance()"
> 			host.suspend() # suspend
> 
> # This is the dictionary that the buildmaster pays attention to. We also
> use
> # a shorter alias to save typing.
> c = BuildmasterConfig = {}
> 
> ####### BUILDSLAVES
> 
> c['slaves'] = [VirshBuildSlave("win7-x64", "APASSWORD")]
> ============================================================
> 
> 

-- 
--
"Agile & Free"

N Frank Marien
C APSU EBVBA
T +32 2 66 999 35
F +32 2 791 57 05
E frank at apsu.be
I #apsu(freenode)
U http://apsu.be/




More information about the devel mailing list