[XEND] Default values for VBD mode and cpu_weight.
authorAlastair Tse <atse@xensource.com>
Thu, 4 Jan 2007 16:30:20 +0000 (16:30 +0000)
committerAlastair Tse <atse@xensource.com>
Thu, 4 Jan 2007 16:30:20 +0000 (16:30 +0000)
Signed-off-by: Alastair Tse <atse@xensource.com>
tools/python/xen/xend/XendDomainInfo.py

index 2df5316fcfab363e6e40f2d3a4f7d683332d9ebd..46386871fa6f0e6d054d482783cb581d5cead0d0 100644 (file)
@@ -914,7 +914,7 @@ class XendDomainInfo:
         return self.info.get('cpu_cap', 0)
 
     def getWeight(self):
-        return self.info['cpu_weight']
+        return self.info.get('cpu_weight', 256)
 
     def setResume(self, state):
         self._resume = state
@@ -1991,7 +1991,7 @@ class XendDomainInfo:
             config['image'] = config.get('uname', '')
             config['io_read_kbs'] = 0.0
             config['io_write_kbs'] = 0.0
-            if config['mode'] == 'r':
+            if config.get('mode', 'r') == 'r':
                 config['mode'] = 'RO'
             else:
                 config['mode'] = 'RW'