Skip to contentSkip to conversation

Fix xm block-list for inactive managed domains

PATCH New Masaki Kanno 1 participant 1 message Dec 4, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix xm block-list for inactive managed domains

Hi,

This patch slightly improves xm block-list for inactive managed domains.

Currently, the following information is shown when we try xm block-list for inactive managed domains.

# xm block-list vm1
Vdev  BE handle state evt-ch ring-ref BE-path
0      -1   0     -1     -1     -1    ??
1      -1   0     -1     -1     -1    ??
2      -1   0     -1     -1     -1    ??
3      -1   0     -1     -1     -1    ??

The information didn't almost have avails, but I'd like to show correct values in only Vdev(device number) at least. So I send the patch. The following information will be shown by the patch.

# xm block-list vm1
Vdev  BE handle state evt-ch ring-ref BE-path
51712  -1   0     -1     -1     -1    ??
51728  -1   0     -1     -1     -1    ??
51744  -1   0     -1     -1     -1    ??
51760  -1   0     -1     -1     -1    ??

Best regards,
Kan

tools/python/xen/xend/XendDomainInfo.py +12 -1
diff -r a00eb6595d3c tools/python/xen/xend/XendDomainInfo.py
@@ -1018,7 +1018,8 @@ class XendDomainInfo:
             sxprs = []
             dev_num = 0
             for dev_type, dev_info in self.info.all_devices_sxpr():
-                if dev_type != deviceClass:
+                if (deviceClass == 'vbd' and dev_type not in ['vbd', 'tap']) or \
+                   (deviceClass != 'vbd' and dev_type != deviceClass):
                     continue
 
                 if deviceClass == 'vscsi':
@@ -1028,6 +1029,16 @@ class XendDomainInfo:
                         vscsi_devs[1].append(vscsi_dev)
                         dev_num = int(sxp.child_value(vscsi_dev, 'devid'))
                     sxprs.append([dev_num, [vscsi_devs]])
+                elif deviceClass == 'vbd':
+                    dev = sxp.child_value(dev_info, 'dev')
+                    if 'ioemu:' in dev:
+                        (_, dev) = dev.split(':', 1)
+                    try:
+                        (dev_name, _) = dev.split(':', 1)  # Remove ":disk" or ":cdrom"
+                    except ValueError:
+                        dev_name = dev
+                    dev_num = self.getDeviceController('vbd').convertToDeviceNumber(dev_name)
+                    sxprs.append([dev_num, dev_info])
                 else:
                     sxprs.append([dev_num, dev_info])
                     dev_num += 1

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel