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] Sync Xen API with newer VDB and VI

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XEND] Sync Xen API with newer VDB and VIF specification.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 08 Dec 2006 13:20:37 +0000
Delivery-date: Fri, 08 Dec 2006 05:23:11 -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 61883e3168a6ed1364c50f0d720586fec9202c35
# Parent  93314655b16f62809c83644eed84592ebe4e8001
[XEND] Sync Xen API with newer VDB and VIF specification.

Fix breakage with storing VIF and VBD refs, remove extraneous
debugging. Also fixing some type errors in default values for Xen API
if things are missing in XendConfig.

Signed-off-by: Alastair Tse <atse@xxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendAPI.py        |   11 +++----
 tools/python/xen/xend/XendConfig.py     |    5 +--
 tools/python/xen/xend/XendDomainInfo.py |   46 ++++++++------------------------
 3 files changed, 19 insertions(+), 43 deletions(-)

diff -r 93314655b16f -r 61883e3168a6 tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Thu Dec 07 14:40:13 2006 +0000
+++ b/tools/python/xen/xend/XendAPI.py  Thu Dec 07 16:08:44 2006 +0000
@@ -1036,8 +1036,8 @@ class XendAPI:
     #       regular xm created VBDs
 
     VBD_attr_ro = ['image',
-                   'IO_bandwidth_incoming_kbs',
-                   'IO_bandwidth_outgoing_kbs']
+                   'io_read_kbs',
+                   'io_write_kbs']
     VBD_attr_rw = ['VM',
                    'VDI',
                    'device',
@@ -1113,10 +1113,8 @@ class XendAPI:
     # Xen API: Class VIF
     # ----------------------------------------------------------------
 
-    VIF_attr_ro = ['network_read_kbs',
-                   'network_write_kbs',
-                   'IO_bandwidth_incoming_kbs',
-                   'IO_bandwidth_outgoing_kbs']
+    VIF_attr_ro = ['io_read_kbs',
+                   'io_write_kbs']
     VIF_attr_rw = ['name',
                    'type',
                    'device',
@@ -1138,6 +1136,7 @@ class XendAPI:
             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
+
         for k in cfg.keys():
             if k not in valid_vif_keys:
                 del cfg[k]
diff -r 93314655b16f -r 61883e3168a6 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Thu Dec 07 14:40:13 2006 +0000
+++ b/tools/python/xen/xend/XendConfig.py       Thu Dec 07 16:08:44 2006 +0000
@@ -925,7 +925,6 @@ class XendConfig(dict):
 
             if dev_type == 'vif' and 'ip' in dev_info:
                 dev_info['ip'] = _get_config_ipaddr(config)
-                log.debug('XendConfig: IP Address: %s' % dev_info['ip'])
 
             if dev_type == 'vbd':
                 if dev_info.get('dev', '').startswith('ioemu:'):
@@ -944,12 +943,12 @@ class XendConfig(dict):
                 param = '%s_refs' % dev_type
                 if param not in target:
                     target[param] = []
-                if dev_uuid in target[param]:
+                if dev_uuid not in target[param]:
                     target[param].append(dev_uuid)
             elif dev_type in ('tap',):
                 if 'vbd_refs' not in target:
                     target['vbd_refs'] = []
-                if dev_uuid in target['vbd_refs']:
+                if dev_uuid not in target['vbd_refs']:
                     target['vbd_refs'].append(dev_uuid)
 
             return dev_uuid
diff -r 93314655b16f -r 61883e3168a6 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Thu Dec 07 14:40:13 2006 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py   Thu Dec 07 16:08:44 2006 +0000
@@ -1780,13 +1780,13 @@ class XendDomainInfo:
         return dom_uuid
     
     def get_memory_static_max(self):
-        return self.info.get('memory_static_max')
+        return self.info.get('memory_static_max', 0)
     def get_memory_static_min(self):
-        return self.info.get('memory_static_min')
+        return self.info.get('memory_static_min', 0)
     def get_memory_dynamic_max(self):
-        return self.info.get('memory_dynamic_min')
+        return self.info.get('memory_dynamic_min', 0)
     def get_memory_dynamic_min(self):
-        return self.info.get('memory_dynamic_max')
+        return self.info.get('memory_dynamic_max', 0)
     
     
     def get_vcpus_policy(self):
@@ -1820,7 +1820,7 @@ class XendDomainInfo:
     def get_builder(self):
         return self.info.get('builder', 0)
     def get_boot_method(self):
-        return self.info.get('boot_method', '')
+        return self.info.get('boot_method', XEN_API_BOOT_TYPE[2])
     def get_kernel_image(self):
         return self.info.get('kernel_kernel', '')
     def get_kernel_initrd(self):
@@ -1830,7 +1830,7 @@ class XendDomainInfo:
     def get_grub_cmdline(self):
         return '' # TODO
     def get_pci_bus(self):
-        return 0 # TODO
+        return '' # TODO
     def get_tools_version(self):
         return {} # TODO
     def get_other_config(self):
@@ -1925,18 +1925,16 @@ class XendDomainInfo:
                     
             config['network'] = '' # Invalid for Xend
             config['MTU'] = 1500 # TODO
-            config['network_read_kbs'] = 0.0
-            config['network_write_kbs'] = 0.0
-            config['IO_bandwidth_incoming_kbs'] = 0.0
-            config['IO_bandwidth_outgoing_kbs'] = 0.0
+            config['io_read_kbs'] = 0.0
+            config['io_write_kbs'] = 0.0
 
         if dev_class == 'vbd':
-            config['VDI'] = '' # TODO
+            config['VDI'] = config.get('VDI', '')
             config['device'] = config.get('dev', '')
             config['driver'] = 'paravirtualised' # TODO
             config['image'] = config.get('uname', '')
-            config['IO_bandwidth_incoming_kbs'] = 0.0
-            config['IO_bandwidth_outgoing_kbs'] = 0.0
+            config['io_read_kbs'] = 0.0
+            config['io_write_kbs'] = 0.0
             if config['mode'] == 'r':
                 config['mode'] = 'RO'
             else:
@@ -2050,27 +2048,7 @@ class XendDomainInfo:
         return dev_uuid
 
     def has_device(self, dev_class, dev_uuid):
-        return (dev_uuid in self.info['%s_refs' % dev_class])
-
-    """
-        def stateChar(name):
-            if name in self.info:
-                if self.info[name]:
-                    return name[0]
-                else:
-                    return '-'
-            else:
-                return '?'
-
-        state = reduce(lambda x, y: x + y, map(stateChar, DOM_STATES_OLD))
-
-        sxpr.append(['state', state])
-
-        if self.store_mfn:
-            sxpr.append(['store_mfn', self.store_mfn])
-        if self.console_mfn:
-            sxpr.append(['console_mfn', self.console_mfn])
-    """
+        return (dev_uuid in self.info['%s_refs' % dev_class.lower()])
 
     def __str__(self):
         return '<domain id=%s name=%s memory=%s state=%s>' % \

_______________________________________________
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] Sync Xen API with newer VDB and VIF specification., Xen patchbot-unstable <=