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-changelog

[Xen-changelog] [xen-unstable] [XEND] Add more API implementations, add

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XEND] Add more API implementations, add sched_id_get to xc.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 02 Nov 2006 22:09:15 +0000
Delivery-date: Thu, 02 Nov 2006 21:31:00 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Alastair Tse <atse@xxxxxxxxxxxxx>
# Node ID df5431b2b519a8e56bfbe0b092a27f8087828099
# Parent  1f790f5fcdbb10af7a620cb2ae38a40217c152d3
[XEND] Add more API implementations, add sched_id_get to xc.

Signed-off-by: Alastair Tse <atse@xxxxxxxxxxxxx>
---
 tools/python/xen/lowlevel/xc/xc.c              |   20 ++++++++++++++++++++
 tools/python/xen/xend/XendAPI.py               |   10 +++++-----
 tools/python/xen/xend/XendDomainInfo.py        |    8 +++++++-
 tools/python/xen/xend/XendStorageRepository.py |    3 +++
 4 files changed, 35 insertions(+), 6 deletions(-)

diff -r 1f790f5fcdbb -r df5431b2b519 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Wed Nov 01 10:12:13 2006 +0000
+++ b/tools/python/xen/lowlevel/xc/xc.c Thu Oct 26 17:59:49 2006 +0100
@@ -647,6 +647,15 @@ static PyObject *pyxc_shadow_mem_control
     return Py_BuildValue("i", mbarg);
 }
 
+static PyObject *pyxc_sched_id_get(XcObject *self) {
+    
+    int sched_id;
+    if (xc_sched_id(self->xc_handle, &sched_id) != 0)
+        return PyErr_SetFromErrno(xc_error);
+
+    return Py_BuildValue("i", sched_id);
+}
+
 static PyObject *pyxc_sched_credit_domain_set(XcObject *self,
                                               PyObject *args,
                                               PyObject *kwds)
@@ -975,6 +984,12 @@ static PyMethodDef pyxc_methods[] = {
       " image   [str]:      Name of HVM loader image file.\n"
       " vcpus   [int, 1]:   Number of Virtual CPUS in domain.\n\n"
       "Returns: [int] 0 on success; -1 on error.\n" },
+
+    { "sched_id_get",
+      (PyCFunction)pyxc_sched_id_get,
+      METH_NOARGS, "\n"
+      "Get the current scheduler type in use.\n"
+      "Returns: [int] sched_id.\n" },    
 
     { "sedf_domain_set",
       (PyCFunction)pyxc_sedf_domain_set,
@@ -1242,6 +1257,11 @@ PyMODINIT_FUNC initxc(void)
 
     Py_INCREF(xc_error);
     PyModule_AddObject(m, "Error", xc_error);
+
+    /* Expose some libxc constants to Python */
+    PyModule_AddIntConstant(m, "XEN_SCHEDULER_SEDF", XEN_SCHEDULER_SEDF);
+    PyModule_AddIntConstant(m, "XEN_SCHEDULER_CREDIT", XEN_SCHEDULER_CREDIT);
+
 }
 
 
diff -r 1f790f5fcdbb -r df5431b2b519 tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Wed Nov 01 10:12:13 2006 +0000
+++ b/tools/python/xen/xend/XendAPI.py  Thu Oct 26 17:59:49 2006 +0100
@@ -701,23 +701,23 @@ class XendAPI:
     
     def vm_get_actions_after_shutdown(self, session, vm_ref):
         dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
-        return xen_api_success('')
+        return xen_api_success(dom.get_on_shutdown())
     
     def vm_get_actions_after_reboot(self, session, vm_ref):
         dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
-        return xen_api_success('')
+        return xen_api_success(dom.get_on_reboot())
     
     def vm_get_actions_after_suspend(self, session, vm_ref):
         dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
-        return xen_api_success('')
+        return xen_api_success(dom.get_on_suspend())
     
     def vm_get_actions_after_crash(self, session, vm_ref):
         dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
-        return xen_api_success('')
+        return xen_api_success(dom.get_on_crash())
     
     def vm_get_bios_boot(self, session, vm_ref):
         dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
-        return xen_api_success('')
+        return xen_api_success(dom.get_bios_boot())
     
     def vm_get_platform_std_vga(self, session, vm_ref):
         dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
diff -r 1f790f5fcdbb -r df5431b2b519 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Wed Nov 01 10:12:13 2006 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py   Thu Oct 26 17:59:49 2006 +0100
@@ -1655,7 +1655,13 @@ class XendDomainInfo:
     def get_memory_static_min(self):
         return self.info['memory']
     def get_vcpus_policy(self):
-        return '' # TODO
+        sched_id = xc.sched_id_get()
+        if sched_id == xen.lowlevel.xc.XEN_SCHEDULER_SEDF:
+            return 'sedf'
+        elif sched_id == xen.lowlevel.xc.XEN_SCHEDULER_CREDIT:
+            return 'credit'
+        else:
+            return 'unknown'
     def get_vcpus_params(self):
         return '' # TODO
     def get_power_state(self):
diff -r 1f790f5fcdbb -r df5431b2b519 
tools/python/xen/xend/XendStorageRepository.py
--- a/tools/python/xen/xend/XendStorageRepository.py    Wed Nov 01 10:12:13 
2006 +0000
+++ b/tools/python/xen/xend/XendStorageRepository.py    Thu Oct 26 17:59:49 
2006 +0100
@@ -100,6 +100,7 @@ class XendStorageRepository:
         """
         self.lock.acquire()
         try:
+            # create directory if /var/lib/xend/storage does not exist
             if not os.path.exists(XEND_STORAGE_DIR):
                 os.makedirs(XEND_STORAGE_DIR)
                 os.chmod(XEND_STORAGE_DIR, 0700)
@@ -111,6 +112,8 @@ class XendStorageRepository:
                 if filename[-5:] == XEND_STORAGE_QCOW_FILENAME[-5:]:
                     image_uuid = filename[:-5]
                     seen_images.append(image_uuid)
+                    
+                    # add this image if we haven't seen it before
                     if image_uuid not in self.images:
                         qcow_file = XEND_STORAGE_QCOW_FILENAME % image_uuid
                         cfg_file = XEND_STORAGE_VDICFG_FILENAME % image_uuid

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [XEND] Add more API implementations, add sched_id_get to xc., Xen patchbot-unstable <=