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] Only return valid VIF and VBD para

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XEND] Only return valid VIF and VBD parameters via Xen API.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 08 Dec 2006 13:20:39 +0000
Delivery-date: Fri, 08 Dec 2006 05:23:31 -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 84580e109557eee9a25c4b3a75cbcd828074b46a
# Parent  ec9259920f85181265b6a13f243de592ff3b161e
[XEND] Only return valid VIF and VBD parameters via Xen API.

Also fix typo for memory_dynamic_{min,max}.

Signed-off-by: Alastair Tse <atse@xxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendAPI.py        |   19 +++++++++++++++----
 tools/python/xen/xend/XendDomainInfo.py |    4 ++--
 2 files changed, 17 insertions(+), 6 deletions(-)

diff -r ec9259920f85 -r 84580e109557 tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Thu Dec 07 16:09:04 2006 +0000
+++ b/tools/python/xen/xend/XendAPI.py  Thu Dec 07 16:43:22 2006 +0000
@@ -1057,7 +1057,16 @@ class XendAPI:
         cfg = vm.get_dev_xenapi_config('vbd', vbd_ref)
         if not cfg:
             return xen_api_error(XEND_ERROR_VBD_INVALID)
-        return xen_api_success(cfg)
+
+        valid_vbd_keys = self.VBD_attr_ro + self.VBD_attr_rw + \
+                         self.Base_attr_ro + self.Base_attr_rw
+
+        return_cfg = {}
+        for k in cfg.keys():
+            if k in valid_vbd_keys:
+                return_cfg[k] = cfg[k]
+                
+        return xen_api_success(return_cfg)
 
     def VBD_media_change(self, session, vbd_ref, vdi_ref):
         return xen_api_error(XEND_ERROR_UNSUPPORTED)
@@ -1134,14 +1143,16 @@ class XendAPI:
         cfg = vm.get_dev_xenapi_config('vif', vif_ref)
         if not cfg:
             return xen_api_error(XEND_ERROR_VIF_INVALID)
+        
         valid_vif_keys = self.VIF_attr_ro + self.VIF_attr_rw + \
                          self.Base_attr_ro + self.Base_attr_rw
 
+        return_cfg = {}
         for k in cfg.keys():
-            if k not in valid_vif_keys:
-                del cfg[k]
+            if k in valid_vif_keys:
+                return_cfg[k] = cfg[k]
             
-        return xen_api_success(cfg)
+        return xen_api_success(return_cfg)
 
     # class methods
     def VIF_create(self, session, vif_struct):
diff -r ec9259920f85 -r 84580e109557 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Thu Dec 07 16:09:04 2006 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py   Thu Dec 07 16:43:22 2006 +0000
@@ -1784,9 +1784,9 @@ class XendDomainInfo:
     def get_memory_static_min(self):
         return self.info.get('memory_static_min', 0)
     def get_memory_dynamic_max(self):
+        return self.info.get('memory_dynamic_max', 0)
+    def get_memory_dynamic_min(self):
         return self.info.get('memory_dynamic_min', 0)
-    def get_memory_dynamic_min(self):
-        return self.info.get('memory_dynamic_max', 0)
     
     
     def get_vcpus_policy(self):

_______________________________________________
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] Only return valid VIF and VBD parameters via Xen API., Xen patchbot-unstable <=