[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] xenstore watch for domU shutdown


  • To: xen-devel@xxxxxxxxxxxxxxxxxxx
  • From: David Richardson <daverich04@xxxxxxxxx>
  • Date: Tue, 9 Jan 2007 18:41:52 -0800 (PST)
  • Delivery-date: Tue, 09 Jan 2007 18:41:31 -0800
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=uKdPypkbcZ0CAblLIWB9fyGLphJJZFCqBe5+2Lf3/azdrAzz33oV0Hic+Ng/XLHl1stshCOSCSxjifbyyaNTckFRcnQovrEogC68LjEv3fEImK0KuvS8m4GXiwGV5e/YjF4OydOSTXXVCBcMOKzIr+QFq1J+VKHuSt5O/4YH74w=;
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

Hey everyone,

I'm trying to write a simple python program in dom0 that registers a watch on the xenstore to determine when a domU has shutdown.  Is there a particular token I should use?  Looking through the tools/python/xen/*.py code, I've come across the 'control/shutdown' token... seems promising?

My code is attached below.  As is, if fails to call the registered watch function on a domain shutdown.  Any help or suggestions would be greatly appreciated.  Thanks!

~Dave

#####################BEGIN CODE##############################

from xen.xend.xenstore.xsutil import *
from xen.xend.xenstore.xswatch import *
from sys import argv
from xen.xend.xenstore.xstransact import xstransact

#domid of the domU guest
domid = int(argv[1])

xs = xshandle()
path = xs.get_domain_path(domid)

def myHandleShutdownWatch(_):
    f = open("/scratch/TEST", "w")
    f.write("Shutdown called")
    f.close()
    return True

mywatch = xswatch(path+"/control/shutdown",myHandleShutdownWatch)
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.