Xen 
 
Home About Xen.org Xen Xen Summit Wiki Mailing List Bug Tracker Xen Downloads
 
   
 

xen-devel

[Xen-devel] Problem in adding a function to tools/python/xen/lowlevel/xc

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] Problem in adding a function to tools/python/xen/lowlevel/xc/xc.c
From: "sanjay kushwaha" <sanjay.kushwaha@xxxxxxxxx>
Date: Mon, 28 Apr 2008 11:33:15 -0400
Delivery-date: Mon, 28 Apr 2008 08:33:40 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; bh=2Jh8ZQiWTccmqJogtvt2tifay8lP53AX9jkIb+EWHWU=; b=JZT2dO9alHXAyBAR/9Ouqgxx258c2uhK1+Amr4Jy4C/LmC3PYl5dH9E+CZGvwkMPdLtWFeqUXfmpMJg+1EzI1qRB/RQCMMdFhaqitj5/GBJ+6LG7VaU4A2jLhP5TkDgchdbVIlojJiHdmUNL6S+hyyFM5dgJjCBIWF0aLTZyOZQ=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=Mwnp19msQqV/LwYPbrsZNCXHGf1O/UCNmEDQ4A019FqJkufWD66UNLM9+ndyk0dHf25MUFYCppJv6733ZFyweAd3k814L1I+ZXTT1DgqI0Be2/DE7CkUFCBDoAgfDpzRXal2/hYyb1WIImDzzRj+rxpdDeFnxVY3xSdBoaBKVCU=
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
Hi Folks,
I am trying to add a function to tools/python/xen/lowlevel/xc/xc.c and call that function from XendDomainInfo.py.
The diffs are shown below. the function in question is xc.register_domm_xen as shown below.

The diffs inside XendDomainInfo.py

@@ -2164,6 +2167,14 @@ class XendDomainInfo:
 
             self.info['start_time'] = time.time()
 
+            if self.info.has_key('backend'):
+                for c in self.info['backend']:
+                    if c == "mgmtif":
+                        # Its a Dom-M. handle it accordingly
+                        log.debug("This is a Dom-M")
+                        xc.register_domm_xen(self.domid)
+
             self._stateSet(DOM_STATE_RUNNING)
         except VmError, exn:
             log.exception("XendDomainInfo.initDomain: exception occurred")


The diffs inside xc.c

[root@node4 xc]# hg diff xc.c
diff -r 483d006cc607 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Fri Apr 25 13:46:27 2008 +0100
+++ b/tools/python/xen/lowlevel/xc/xc.c Sun Apr 27 23:45:48 2008 -0400
@@ -1262,6 +1262,20 @@ static PyObject *pyxc_domain_iomem_permi
     return zero;
 }
 
+static PyObject *pyxc_register_domm_xen(XcObject *self, PyObject *args)
+{
+    uint32_t dom;
+
+    if (!PyArg_ParseTuple(args, "i", &dom))
+        return NULL;
+
+    if (xc_register_domm_xen(self->xc_handle, dom) != 0)
+        return NULL;
+
+    Py_INCREF(zero);
+    return zero;
+}
+
 static PyObject *pyxc_domain_set_time_offset(XcObject *self, PyObject *args)
 {
     uint32_t dom;
@@ -1740,6 +1754,13 @@ static PyMethodDef pyxc_methods[] = {
       "Returns: [int] 0 on success; -1 on error.\n" },
 #endif /* __powerpc */
  
+    { "register_domm_xen",
+      (PyCFunction)pyxc_register_domm_xen,
+      METH_VARARGS, "\n"
+      "Register a Domain as Dom-M \n"
+      " dom        [int]: Domain which is to be treated as Dom-M.\n"
+      "Returns: [int] 0 on success; -1 on error.\n" },
+
 #if defined(__i386__) || defined(__x86_64__)
     { "domain_check_cpuid",
       (PyCFunction)pyxc_dom_check_cpuid,


the code compiles fine and gets executed during "xm create" command. but when I try to run the command I get the following error

[root@node4 vm_config_files]# xm create -c pc1_domm
Using config file "./pc1_domm".
Error: error return without exception set
[root@node4 vm_config_files]#

The /var/log/xen/xend.log shows the following error

[2008-04-28 11:27:17 4132] ERROR (XendDomainInfo:443) VM start failed
Traceback (most recent call last):
  File "/root/ksanjay/hp/xen-unstable.hg/dist/install/usr/lib/python/xen/xend/XendDomainInfo.py", line 423, in start
    XendTask.log_progress(31, 60, self._initDomain)
  File "/root/ksanjay/hp/xen-unstable.hg/dist/install/usr/lib/python/xen/xend/XendTask.py", line 209, in log_progress
    retval = func(*args, **kwds)
  File "/root/ksanjay/hp/xen-unstable.hg/dist/install/usr/lib/python/xen/xend/XendDomainInfo.py", line 2175, in _initDomain
    xc.register_domm_xen(self.domid)
SystemError: error return without exception set

So the error happens in the function that I added. I don't know how to fix this problem. interestingly this problem doesn't happen on a 64 bit OS running python2.4. I am experiencing this problem on a 32 bit OS running on a 32 bit machine with python2.4. I tried other python versions 2.4.1 and 2.5.2 but same problem happens.


Could someone please tell me if I am doing anything wrong in the way I am defining the function? Has someone experienced the same problem?

Thanks for your help.

Sanjay

--
----------------------
PhD Candidate, Georgia Tech
http://www.cc.gatech.edu/~ksanjay/
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>