WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] xenstore watch for domU shutdown

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] xenstore watch for domU shutdown
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=;
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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
<Prev in Thread] Current Thread [Next in Thread>