Skip to contentSkip to conversation

align periodic vtds only if hypervisor support is present

PATCH In review Simon Horman 1 participant 2 messages Feb 19, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 align periodic vtds only if hypervisor support is present

Allow xend to work with hypervisors that don't support alignment of periodic vtds.

I'm not sure if there is any interest in this, but it allows older (pre 20109:d9480422034b "hvm: Align periodic vpts") hypervisors when used with newer (>= 20109) xend.

tools/python/xen/xend/XendDomainInfo.py +13 -4
Index: xen-unstable.hg/tools/python/xen/xend/XendDomainInfo.py
===================================================================
@@ -898,15 +898,21 @@ class XendDomainInfo:
         else:
             cur_dev_sxp = self._getDeviceInfo_vscsi(req_devid, None)
             new_dev_sxp = ['vscsi']
+            cur_mode = sxp.children(cur_dev_sxp, 'feature-host')[0]
+            new_dev_sxp.append(cur_mode)
+
             for cur_dev in sxp.children(cur_dev_sxp, 'dev'):
                 if state == xenbusState['Closing']:
+                    if int(cur_mode[1]) == 1:
+                        continue
                     cur_dev_vdev = sxp.child_value(cur_dev, 'v-dev')
                     if cur_dev_vdev == dev['v-dev']:
                         continue
                 new_dev_sxp.append(cur_dev)
 
             if state == xenbusState['Initialising']:
-                new_dev_sxp.append(sxp.child0(dev_sxp, 'dev'))
+                for new_dev in sxp.children(dev_sxp, 'dev'):
+                    new_dev_sxp.append(new_dev)
 
             dev_uuid = sxp.child_value(cur_dev_sxp, 'uuid')
             self.info.device_update(dev_uuid, new_dev_sxp)
@@ -1112,7 +1118,8 @@ class XendDomainInfo:
                         vscsi_dev.append(['frontstate', None])
                         vscsi_devs[1].append(vscsi_dev)
                         dev_num = int(sxp.child_value(vscsi_dev, 'devid'))
-                    sxprs.append([dev_num, [vscsi_devs]])
+                    vscsi_mode = sxp.children(dev_info, 'feature-host')[0]
+                    sxprs.append([dev_num, [vscsi_devs, vscsi_mode]])
                 elif deviceClass == 'vbd':
                     dev = sxp.child_value(dev_info, 'dev')
                     if 'ioemu:' in dev:
@@ -2240,8 +2247,10 @@ class XendDomainInfo:
         # Optionally enable periodic vpt aligning
         vpt_align = self.info["platform"].get("vpt_align")
         if hvm and vpt_align is not None:
-            xc.hvm_set_param(self.domid, HVM_PARAM_VPT_ALIGN,
-                             long(vpt_align))
+	    try:
+                xc.hvm_set_param(self.domid, HVM_PARAM_VPT_ALIGN, vpt_align_l)
+            except Exception, e:
+	        log.warn('Hypervisor does not support HVM_PARAM_VPT_ALIGN\n')
 
         # Set maximum number of vcpus in domain
         xc.domain_max_vcpus(self.domid, int(self.info['VCPUs_max']))
#1 lore raw

Allow xend to work with hypervisors that don't support alignment of periodic vtds.

I'm not sure if there is any interest in this, but it allows older (pre 20109:d9480422034b "hvm: Align periodic vpts") hypervisors when used with newer (>= 20109) xend.

---

There was some noise in the previous patch I posted, apologies for that.

tools/python/xen/xend/XendDomainInfo.py +4 -2
Index: xen-unstable.hg/tools/python/xen/xend/XendDomainInfo.py
===================================================================
@@ -2247,8 +2247,10 @@ class XendDomainInfo:
         # Optionally enable periodic vpt aligning
         vpt_align = self.info["platform"].get("vpt_align")
         if hvm and vpt_align is not None:
-            xc.hvm_set_param(self.domid, HVM_PARAM_VPT_ALIGN,
-                             long(vpt_align))
+	    try:
+                xc.hvm_set_param(self.domid, HVM_PARAM_VPT_ALIGN, vpt_align_l)
+            except Exception, e:
+	        log.warn('Hypervisor does not support HVM_PARAM_VPT_ALIGN\n')
 
         # Set maximum number of vcpus in domain
         xc.domain_max_vcpus(self.domid, int(self.info['VCPUs_max']))